Package org.eclipse.ui

## Interface IWorkingSetManager

All Known Subinterfaces:
  `ILocalWorkingSetManager`

    public interface IWorkingSetManager

A working set manager stores working sets and provides property change notification when a working set is added or removed.

The workbench working set manager can be accessed using `IWorkbench#getWorkingSetManager()`

This interface is not intended to be implemented by clients.

Since:
  2.0 initial version, 3.0 added createWorkingSet(IMemento)
See Also:
  `IWorkingSet`
Restriction:
  This interface is not intended to be implemented by clients.

### Field Summary

Fields
`static String` `CHANGE_WORKING_SET_ADD` Change event id when a working set is added newValue of the PropertyChangeEvent will be the added working set. oldValue will be null.
`static String` `CHANGE_WORKING_SET_CONTENT_CHANGE` Change event id when the working set contents changed newValue of the PropertyChangeEvent will be the changed working set.
`static String` `CHANGE_WORKING_SET_LABEL_CHANGE` Change event id when the working set label changed. newValue of the PropertyChangeEvent will be the changed working set.
`static String` `CHANGE_WORKING_SET_NAME_CHANGE` Change event id when the working set name changed. newValue of the PropertyChangeEvent will be the changed working set.
`static String` `CHANGE_WORKING_SET_REMOVE` Change event id when a working set is removed newValue of the PropertyChangeEvent will be null. oldValue will be the removed working set.
`static String` `CHANGE_WORKING_SET_UPDATER_INSTALLED` Change event id when a working set updater got installed.
`static String` `CHANGE_WORKING_SET_UPDATER_UNINSTALLED` Change event id when a working set updater got uninstalled.

### Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods
`void` `addPropertyChangeListener​(IPropertyChangeListener listener)` Adds a property change listener.
`void` `addRecentWorkingSet​(IWorkingSet workingSet)` Adds a working set to the top of the list of most recently used working sets, making it the most recently used working set.
`void` `addToWorkingSets​(IAdaptable element, IWorkingSet[] workingSets)` Utility method that will add the `element` to each given working set in `workingSets` if possible.
`void` `addWorkingSet​(IWorkingSet workingSet)` Adds a working set to the receiver.
`IWorkingSet` `createAggregateWorkingSet​(String name, String label, IWorkingSet[] components)` Create a working set that is the union of a collection of other working sets.
`IWorkingSet` `createWorkingSet​(String name, IAdaptable[] elements)` Creates a new working set.
`IWorkingSet` `createWorkingSet​(IMemento memento)` Re-creates and returns a working set from the state captured within the given memento.
`IWorkingSetEditWizard` `createWorkingSetEditWizard​(IWorkingSet workingSet)` Creates a working set edit wizard for the specified working set.
`IWorkingSetNewWizard` `createWorkingSetNewWizard​(String[] workingSetIds)` Creates a working set new wizard.
`IWorkingSetSelectionDialog` `createWorkingSetSelectionDialog​(Shell parent)` Deprecated. use createWorkingSetSelectionDialog(parent, true) instead
`IWorkingSetSelectionDialog` `createWorkingSetSelectionDialog​(Shell parentShell, boolean multi)` Creates a working set selection dialog that lists all working sets and allows the user to add, remove and edit working sets.
`IWorkingSetSelectionDialog` `createWorkingSetSelectionDialog​(Shell parentShell, boolean multi, String[] workingsSetIds)` Creates a working set selection dialog that lists all working sets with the specified ids and allows the user to add, remove and edit working sets with the specified ids.
`void` `dispose()` Disposes the working set manager.
`IWorkingSet[]` `getAllWorkingSets()` Returns an array of all working sets stored in the receiver including those that are marked as being not visible.
`IWorkingSet[]` `getRecentWorkingSets()` Returns the list of most recently used working sets.
`int` `getRecentWorkingSetsLength()` Returns the maximum length of the recent working sets list.
`IWorkingSet` `getWorkingSet​(String name)` Returns the working set with the specified name.
`IWorkingSet[]` `getWorkingSets()` Returns an array of all working sets stored in the receiver.
`void` `removePropertyChangeListener​(IPropertyChangeListener listener)` Removes the property change listener.
`void` `removeWorkingSet​(IWorkingSet workingSet)` Removes the working set
`void` `setRecentWorkingSetsLength​(int length)` Sets maximum length of the recent working sets list.

### Field Detail

#### CHANGE_WORKING_SET_ADD

    static final String CHANGE_WORKING_SET_ADD

Change event id when a working set is added newValue of the PropertyChangeEvent will be the added working set. oldValue will be null.

See Also:
  `IPropertyChangeListener`, Constant Field Values

#### CHANGE_WORKING_SET_REMOVE

    static final String CHANGE_WORKING_SET_REMOVE

Change event id when a working set is removed newValue of the PropertyChangeEvent will be null. oldValue will be the removed working set.

See Also:
  `IPropertyChangeListener`, Constant Field Values

#### CHANGE_WORKING_SET_CONTENT_CHANGE

    static final String CHANGE_WORKING_SET_CONTENT_CHANGE

Change event id when the working set contents changed newValue of the PropertyChangeEvent will be the changed working set.

See Also:
  `IPropertyChangeListener`, Constant Field Values

#### CHANGE_WORKING_SET_NAME_CHANGE

    static final String CHANGE_WORKING_SET_NAME_CHANGE

Change event id when the working set name changed. newValue of the PropertyChangeEvent will be the changed working set.

See Also:
  `IPropertyChangeListener`, Constant Field Values

#### CHANGE_WORKING_SET_LABEL_CHANGE

    static final String CHANGE_WORKING_SET_LABEL_CHANGE

Change event id when the working set label changed. newValue of the PropertyChangeEvent will be the changed working set.

Since:
  3.2
See Also:
  `IPropertyChangeListener`, Constant Field Values

#### CHANGE_WORKING_SET_UPDATER_INSTALLED

    static final String CHANGE_WORKING_SET_UPDATER_INSTALLED

Change event id when a working set updater got installed. NewValue of the PropertyChangeEvent will be the installed updater. OldValue will be `null`

Since:
  3.1
See Also:
  Constant Field Values

#### CHANGE_WORKING_SET_UPDATER_UNINSTALLED

    static final String CHANGE_WORKING_SET_UPDATER_UNINSTALLED

Change event id when a working set updater got uninstalled. NewValue will be `null` OldValue of the PropertyChangeEvent will be the uninstalled updater.

Since:
  3.3
See Also:
  Constant Field Values

### Method Detail

#### addPropertyChangeListener

    void addPropertyChangeListener​(IPropertyChangeListener listener)

Adds a property change listener.

Parameters:
  `listener` - the property change listener to add

#### addRecentWorkingSet

    void addRecentWorkingSet​(IWorkingSet workingSet)

Adds a working set to the top of the list of most recently used working sets, making it the most recently used working set. The last (oldest) item will be deleted if the list exceeds the size limit.

Parameters:
  `workingSet` - the working set to add to the list of most recently used working sets.

#### addWorkingSet

    void addWorkingSet​(IWorkingSet workingSet)

Adds a working set to the receiver. The working set must not exist yet.

Parameters:
  `workingSet` - the working set to add

#### createWorkingSet

    IWorkingSet createWorkingSet​(String name,
                                 IAdaptable[] elements)

Creates a new working set. The working set is not added to the working set manager.

Parameters:
  `name` - the name of the new working set. Should not have leading or trailing whitespace.
  `elements` - the working set contents
Returns:
  a new working set with the specified name and content

#### createAggregateWorkingSet

    IWorkingSet createAggregateWorkingSet​(String name,
                                          String label,
                                          IWorkingSet[] components)

Create a working set that is the union of a collection of other working sets. One connected (via `addWorkingSet(IWorkingSet)` this working set will be automatically updated to reflect the contents of the component sets, should they themselves change.

Parameters:
  `name` - the name of the new working set. Should not have leading or trailing whitespace.
  `label` - the user-friendly label the working set
  `components` - the component working sets
Returns:
  a new working set with the specified name and content
Since:
  3.2

#### createWorkingSet

    IWorkingSet createWorkingSet​(IMemento memento)

Re-creates and returns a working set from the state captured within the given memento.

Parameters:
  `memento` - a memento containing the state for the working set
Returns:
  the restored working set, or `null` if it could not be created
Since:
  3.0

#### createWorkingSetEditWizard

    IWorkingSetEditWizard createWorkingSetEditWizard​(IWorkingSet workingSet)

Creates a working set edit wizard for the specified working set. The working set will already be set in the wizard. The caller is responsible for creating and opening a wizard dialog. Example: `IWorkingSetEditWizard wizard = workingSetManager.createWorkingSetEditWizard(workingSet); if (wizard != null) { WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); if (dialog.open() == Window.OK) { workingSet = wizard.getSelection(); } }`

Parameters:
  `workingSet` - working set to create a working set edit wizard for.
Returns:
  a working set edit wizard to edit the specified working set or `null` if no edit wizard has been defined for the working set. If the defined edit wizard for the working set could not be loaded a default IResource based wizard will be returned. If the default edit wizard can not be loaded `null` is returned.
Since:
  2.1

#### createWorkingSetNewWizard

    IWorkingSetNewWizard createWorkingSetNewWizard​(String[] workingSetIds)

Creates a working set new wizard. The wizard will allow creating new working sets. Returns `null` if there aren't any working set definitions that support creation of working sets.

Example: `IWorkingSetNewWizard wizard= workingSetManager.createWorkingSetNewWizard(null); if (wizard != null) { WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); if (dialog.open() == Window.OK) { ... } }`

Parameters:
  `workingSetIds` - a list of working set ids which are valid workings sets to be created or `null` if all currently available working set types are valid
Returns:
  the working set new wizard or `null`
Since:
  3.1

#### createWorkingSetSelectionDialog

    @Deprecated
    IWorkingSetSelectionDialog createWorkingSetSelectionDialog​(Shell parent)

Deprecated.
use createWorkingSetSelectionDialog(parent, true) instead

Parameters:
  `parent` - the parent shell
Returns:
  the dialog

#### createWorkingSetSelectionDialog

    IWorkingSetSelectionDialog createWorkingSetSelectionDialog​(Shell parentShell,
                                                               boolean multi)

Creates a working set selection dialog that lists all working sets and allows the user to add, remove and edit working sets. The caller is responsible for opening the dialog with `IWorkingSetSelectionDialog#open`, and subsequently extracting the selected working sets using `IWorkingSetSelectionDialog#getSelection`.

Parameters:
  `parentShell` - the parent shell of the working set selection dialog
  `multi` - true= `IWorkingSetSelectionDialog#getSelection()` returns the working sets chosen in the dialog as an array of working set. false= `IWorkingSetSelectionDialog#getSelection()` returns an array having a single aggregate working set of all working sets selected in the dialog.
Returns:
  a working set selection dialog

#### createWorkingSetSelectionDialog

    IWorkingSetSelectionDialog createWorkingSetSelectionDialog​(Shell parentShell,
                                                               boolean multi,
                                                               String[] workingsSetIds)

Creates a working set selection dialog that lists all working sets with the specified ids and allows the user to add, remove and edit working sets with the specified ids. The caller is responsible for opening the dialog with `IWorkingSetSelectionDialog#open`, and subsequently extracting the selected working sets using `IWorkingSetSelectionDialog#getSelection`.

Parameters:
  `parentShell` - the parent shell of the working set selection dialog
  `multi` - true= `IWorkingSetSelectionDialog#getSelection()` returns the working sets chosen in the dialog as an array of working set. false= `IWorkingSetSelectionDialog#getSelection()` returns an array having a single aggregate working set of all working sets selected in the dialog.
  `workingsSetIds` - a list of working set ids which are valid workings sets to be selected, created, removed or edited, or `null` if all currently available working set types are valid
Returns:
  a working set selection dialog
Since:
  3.1

#### getRecentWorkingSets

    IWorkingSet[] getRecentWorkingSets()

Returns the list of most recently used working sets. The most recently used working set appears first in the list.

Returns:
  the list of most recently used working sets

#### getWorkingSet

    IWorkingSet getWorkingSet​(String name)

Returns the working set with the specified name. Returns null if there is no working set with that name.

Parameters:
  `name` - the name of the working set to return
Returns:
  the working set with the specified name.

#### getWorkingSets

    IWorkingSet[] getWorkingSets()

Returns an array of all working sets stored in the receiver. The array is sorted by names. Any working set whose `IWorkingSet.isVisible()` method returns false will not be included in this array. For a complete list of working sets please use `getAllWorkingSets()`.

Returns:
  the working sets stored in the receiver

#### getAllWorkingSets

    IWorkingSet[] getAllWorkingSets()

Returns an array of all working sets stored in the receiver including those that are marked as being not visible.

Returns:
  the working sets stored in the receiver
Since:
  3.2
See Also:
  `IWorkingSet.isVisible()`

#### removePropertyChangeListener

    void removePropertyChangeListener​(IPropertyChangeListener listener)

Removes the property change listener.

Parameters:
  `listener` - the property change listener to remove

#### removeWorkingSet

    void removeWorkingSet​(IWorkingSet workingSet)

Removes the working set

Parameters:
  `workingSet` - the working set to remove

#### dispose

    void dispose()

Disposes the working set manager.

Since:
  3.1

#### addToWorkingSets

    void addToWorkingSets​(IAdaptable element,
                          IWorkingSet[] workingSets)

Utility method that will add the `element` to each given working set in `workingSets` if possible. This method will invoke `IWorkingSet.adaptElements(IAdaptable[])` for the element on each working set and the result of this method will be used rather than the original element in the addition operation.

Parameters:
  `element` - the element to adapt and then add to the working sets
  `workingSets` - the working sets to add the element to
Since:
  3.4

#### setRecentWorkingSetsLength

    void setRecentWorkingSetsLength​(int length)

Sets maximum length of the recent working sets list.

Parameters:
  `length` - maximum number of recent working sets to be kept in the list
Since:
  3.7

#### getRecentWorkingSetsLength

    int getRecentWorkingSetsLength()

Returns the maximum length of the recent working sets list.

Returns:
  the maximum length of the recent working sets list.
Since:
  3.7