Project Groups - UI Proposal
- April 20, 2007
- Jesse Glick
- Many NetBeans IDE users have different areas of work that they use the IDE for. For example, they might have some Java EE projects for a web application for their employer, but work on some personal Java SE projects in the evening. NetBeans lets you open and close projects at any time, but if there are a lot of projects in each group this may be cumbersome and error-prone. Switching user directories is an unreasonable workaround to this issue. Therefore, a number of users have requested that the IDE provide some facility for them to group projects together to make them easier to open and close as a unit. This proposed feature implements such a facility.See: issue #50683 and ProjectGroups50683
Definitions and Basic Behavior
A group is a persistent collection of IDE projects. The persistence is in the user directory and is thus per-user (not shared with other IDE users). A group has a display name. If one of the projects in it is set as the main project, that information is persisted as well.
Switching to a group means setting the active group, of which there can be just one at a time. Initially there is no group open and you can switch back to this null group to disable the group feature for a while. When you switch to a group, you replace the currently open set of projects (and main project) with the projects specified in the group. An open group is pristine if the set of projects it specifies is the same as the set of projects actually open (including the main project setting).
By default the group support module is in basic mode. There is a switch that will put it into advanced mode, with more features. If it is found that few people use the advanced features, they should be removed. For this reason, the module supports UI gesture collection in case we can get people to turn on this form of logging.
A group has a kind which controls its behavior. In basic mode, there is only one kind so this option is not exposed in the GUI. The available kinds are:
- Autosynch free groups are available in basic mode. This is simply an arbitrary collection of projects. While open, the group tracks the set of open projects (as well as the main project)—or more precisely, when it is closed it saves the set of projects open at the time, and when opened reopens the same set. This kind of group is always pristine. It mimics the behavior of having multiple user directories that you can switch between.
- Non-autosynch free groups are available in advanced mode. They differ from autosynch free groups in that the group definition does not get changed automatically when you open and close projects while the group is selected. You can however update the definition to the set of currently open projects, making it pristine if it was not before. As for all kinds of group, the main project selection is always tracked automatically. The advantage of this kind of group would be for people who keep a fixed set of projects for a long period of time and do not want this definition to be modified just because they temporarily open some other projects to look at them.
- Master project groups are based on a master project. The group always contains the master project, its required projects, and any other projects required by those projects transitively. The main project is initially set to the master project, though if changed that change will be persisted. This kind of group best models complex applications such as Java EE EARs, Maven projects with all dependencies, etc.
- Folder groups are based on a disk folder. The group always contains the set of projects contained anywhere inside this folder. This kind of group could be used to model everything contained in a VCS checkout, for example.
A submenu is installed in the File menu called Project Group, with items:
- One radio button menu item per available group, plus a special item (none) at the end. The active group (or (none)) will be selected. If a group menu item is selected, the IDE switches to that group. (Progress messages in the status line indicate what is happening since this can be slow.)If the active group is pristine, the menu item will be disabled, since selecting it again would not change anything.
- A separator.
- An item New Group… which opens the New Group dialog (below).
- If a group is active, an item Properties which opens a properties dialog (below).
- If a group is active, an item Remove which deletes the group.
- A checkbox menu item for Advanced Mode.
The same submenu is also added to the context menu for the blank parts of the Projects tab.
The module has a few dialogs. Help buttons are not currently bound to help IDs but could be.
Create New Group [Basic Mode]
The user enters a Name (any characters permitted) for the new group. If Use Currently Open Projects is checked, the group initially contains open projects; the name is then defaulted to the name of the current main project, if any.
Create New Group [Advanced Mode]
The user selects a kind of group to make.
For free groups, Automatically Track Open Projects determines autosynch mode. Name is sometimes defaulted, as in basic mode.
For master project groups, the Master Project text field (read-only) shows the path to the master project, which must be selected using Browse…. Name is set to the master project’s name when chosen but may be overridden.
For folder groups, the Folder text field (editable) gives the path to the top folder, which may be selected using Browse…. Name is set to the base name of the folder when chosen but may be overridden.
Free Group Properties [Basic Mode]
Name may be edited to rename the group. OK closes and applies changes. Cancel just closes the dialog.
Free Group Properties [Advanced Mode]
As in basic mode, but Automatically Track Open Projects may be checked on or off. Synchronize Now is enabled only for a non-pristine group, i.e. with Automatically Track Open Projects unchecked and some projects opened or closed since the group was last selected; when clicked, the group definition is updated and button becomes disabled at once.
Master Project Group Properties
Master Project is read-only and displays the master project’s path. It could be made editable with a Browse… button but this seems unnecessary.
Folder Group Properties
Folder is read-only and displays the path to the top-level folder. Again it could be made editable if desired.