This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 91031

Summary: Better integration of project settings with groups
Product: projects Reporter: Jesse Glick <jglick>
Component: Generic Projects UIAssignee: Milos Kleint <mkleint>
Status: RESOLVED FIXED    
Severity: blocker CC: mkleint
Priority: P1 Keywords: API_REVIEW, API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 215492, 50683, 197577    
Attachments: Initial attempt; doesn't really work too well
suggested API in project.uiapi
implementation in projectui
usage of api from mavenFileOwnerQuery

Description Jesse Glick 2006-12-13 17:44:41 UTC
After the impl of issue #50683, some project settings seem like they should be
tied to the active group, but are not. For example, the last opened project
location should probably be group-specific.

Also, the Recent Projects list shows projects "closed" by switching groups,
which is probably undesirable.
Comment 1 Jesse Glick 2006-12-13 17:46:18 UTC
Created attachment 36652 [details]
Initial attempt; doesn't really work too well
Comment 2 Jan Lahoda 2006-12-13 20:08:08 UTC
I also think that the last opened project location should be group specific, and
I would consider this P3 at least (but feel free to change it back to P4 if you
disagree).
Comment 3 Jesse Glick 2009-12-04 09:46:47 UTC
See also bug #168578.
Comment 4 Milos Kleint 2012-07-26 11:12:43 UTC
another usecase for group specific settings is usage of maven binary and settings.xml file for a certain project group only.
Comment 5 Jesse Glick 2012-07-26 13:09:53 UTC
(In reply to comment #4)
> usage of maven binary and settings.xml file for a certain project group only

Bug #197577 (defining that in a parent POM) would probably suffice for this use case.
Comment 6 Jesse Glick 2012-07-26 13:11:06 UTC
(In reply to comment #5)
> Bug #197577

Sorry, just noticed you have that as blocked by this issue, but in fact it could be done without any reference to project groups.
Comment 7 Milos Kleint 2012-07-26 13:15:20 UTC
 disagree. maven executable maybe, but anything that can touch the location of
local repository is suspicious and needs to be handled en-block for all opened
projects. (and maven executable contains a setting file)

Forgot to mention that MavenFileOwnerQueryImpl should probably keep the
persistent caches on project group level as well. It solves the problem with 
multiple branch checkouts pointing to the same spot in local repository
Comment 8 Jesse Glick 2012-07-26 13:28:56 UTC
Comment #7 perhaps intended to be added to bug #197577 rather than here.
Comment 9 Milos Kleint 2012-08-16 18:25:34 UTC
Created attachment 123211 [details]
suggested API in project.uiapi
Comment 10 Milos Kleint 2012-08-16 18:25:56 UTC
Created attachment 123212 [details]
implementation in projectui
Comment 11 Milos Kleint 2012-08-16 18:26:17 UTC
Created attachment 123213 [details]
usage of api from mavenFileOwnerQuery
Comment 12 Milos Kleint 2012-08-16 18:40:01 UTC
please review the following new api.

2 parts: 
1. a getter for ProjectGroup in OpenProjects, containing currently just name and preferences. Ideally we would have the same pattern as with root preferences. NbPreferences.forModule(Class) but it turned out the impl is using some classes unaccessible from projectui. So we use forPackage(Class) instead.

2. New listener and event that gets fired when project group starts changing and when it finishes.

Two example usages in the diffs, one preserving the last opened project directory on group level and the in maven support, reset the external roots preferences on group change and use group private preferences. That's useful especially when working on multiple branches of the same code.
Comment 13 Milos Kleint 2012-08-23 11:17:49 UTC
thanks for review, I will integrate tomorrow
Comment 14 Jaroslav Tulach 2012-08-24 12:30:48 UTC
Y01 ProjectGroupChangeListener should extend EventListener to follow JavaBeans specification

Y02 Maybe constructor of ProjectGroupChangeEvent should not be public (as the only place that constructs it should be OpenProjects class).
Comment 15 Milos Kleint 2012-08-24 13:18:24 UTC
(In reply to comment #14)
> Y01 ProjectGroupChangeListener should extend EventListener to follow JavaBeans
> specification

Ok. Done.

> 
> Y02 Maybe constructor of ProjectGroupChangeEvent should not be public (as the
> only place that constructs it should be OpenProjects class).

It's actually OpenProjectsList in project.ui module. I've tried applying the trampoline pattern but it turned out too complicated to ripped it out after all. The potential for abuse of that constructor is fairly small.
Comment 16 Milos Kleint 2012-08-27 12:20:50 UTC
considered done, Maven's fileownerquery implementation and basic project settings like recent projects or last opened dir are now group specific..
Comment 17 Quality Engineering 2012-08-29 02:40:48 UTC
Integrated into 'main-golden', will be available in build *201208290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a003014d9d36
User: Milos Kleint <mkleint@netbeans.org>
Log: #91031 api for listening on changes in project groups, and querying the currently active group. group exposes a root Preferences not usable for settings that should be group specific