Working Sets

Users often find it necessary to filter views such as the navigator view in order to reduce clutter.  Plug-ins can assist in filtering using different techniques.

Working set selection dialog

If your plug-in implements a view that shows resources (or objects that are adaptable to IResource), you should support working sets.  IWorkingSetManager provides API for manipulating working sets.  You can obtain an IWorkingSetManager using IWorkbench API.

IWorkingSetManager manager = workbench.getWorkingSetManager();

IWorkingSetManager allows you to manipulate and create working sets:

IWorkingSetManager also provides property change notification as working sets are added, removed, or as they change.  If your view or editor needs to respond to changes in the selected working set, it can add a listener for CHANGE_WORKING_SET_CONTENT_CHANGE.

Adding New Working Set Types

For many plug-ins, using IWorkingSetManager to provide resource filtering is sufficient.  If your plug-in needs to define working sets differently, it can register a new type of working set using org.eclipse.ui.workingSets.  The Java tooling uses this feature to define a Java working set type.  Working set types are shown when the user decides to add a working set.

Working set dialog showing list of available types

 

When you define your own type of working set, you can use IWorkingSet.getId protocol to ensure that the working set matches the type that you have defined.  Any working sets that you create programmatically must have their id set to the id of a working set page that can display the working set elements.  This id is used to ensure that the proper working set edit page is launched when the user edits the working set.  A null id indicates that the working set should use the default resource working set type.

See the org.eclipse.ui.workingSets extension point documentation and IWorkingSet protocol for more detail.