Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page

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.

  • Resource filters can be used to filter by file name.  Plug-ins contribute resource filters that the user can enable using a view's filter selection dialog.
  • Working sets can be used to filter resources by only including specified resources.  Working sets are selected using the view's working set dialog.

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:

  • createWorkingSetSelectionDialog - returns a working set dialog that shows the user the current working sets. You can get the selected working sets from the dialog once it is closed.
  • createWorkingSetEditWizard - returns a working set edit wizard for editing the specified working set
  • getWorkingSets() - returns a list of all defined working sets
  • getWorkingSet(String name) - returns a working set specified by name

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.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire