Package org.eclipse.ui.internal

# Class WorkingSet

java.lang.Object
org.eclipse.ui.internal.AbstractWorkingSet
org.eclipse.ui.internal.WorkingSet

All Implemented Interfaces:
  `Cloneable`, `IAdaptable`, `IPersistable`, `IPersistableElement`, `IWorkingSet`

public class WorkingSet extends AbstractWorkingSet
A working set holds a number of IAdaptable elements. A working set is intended to group elements for presentation to the user or for operations on a set of elements.

Since:
  2.0
See Also:
  - `IWorkingSet`

## Field Summary

### Fields inherited from class org.eclipse.ui.internal.AbstractWorkingSet

`elements, FACTORY_ID, workingSetMemento`

## Constructor Summary

Constructors
Modifier
Constructor
Description
``
`WorkingSet(String name, String label, IAdaptable[] elements)`
Creates a new working set.
`protected`
`WorkingSet(String name, String label, IMemento memento)`
Creates a new working set from a memento.

## Method Summary

Modifier and Type
Method
Description
`IAdaptable[]`
`adaptElements(IAdaptable[] objects)`
Transforms the supplied elements into elements that are suitable for containment in this working set.
`boolean`
`equals(Object object)`
Tests the receiver and the object for equality
`String`
`getId()`
Returns the working set id.
`ImageDescriptor`
`getImageDescriptor()`
Returns the working set icon.
`int`
`hashCode()`
Returns the hash code.
`boolean`
`isAggregateWorkingSet()`
Returns whether this working set is an aggregate working set or not.
`boolean`
`isEditable()`
Returns whether this working set can be edited or not.
`boolean`
`isSelfUpdating()`
Returns `true` if this working set is capable of updating itself and reacting to changes in the state of its members.
`boolean`
`isVisible()`
Returns whether this working set should be shown in user interface components that list working sets by name.
`void`
`saveState(IMemento memento)`
Implements IPersistableElement.
`void`
`setElements(IAdaptable[] newElements)`
Sets the elements that are contained in this working set.
`void`
`setId(String pageId)`
Sets the working set id.
`String`
`toString()`

### Methods inherited from class org.eclipse.ui.internal.AbstractWorkingSet

`clone, connect, disconnect, fireWorkingSetChanged, getAdapter, getElements, getElementsArray, getFactoryId, getImage, getLabel, getManager, getName, internalSetElements, isEmpty, setLabel, setName`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### WorkingSet

public WorkingSet(String name, String label, IAdaptable[] elements)
Creates a new working set.

Parameters:
  `name` - the name of the new working set. Should not have leading or trailing whitespace.
  `label` - the label of the new working set
  `elements` - the content of the new working set. May be empty but not `null`.

### WorkingSet

protected WorkingSet(String name, String label, IMemento memento)
Creates a new working set from a memento.

Parameters:
  `name` - the name of the new working set. Should not have leading or trailing whitespace.
  `memento` - persistence memento containing the elements of the working set.

## Method Details

### equals

public boolean equals(Object object)
Tests the receiver and the object for equality

Overrides:
  `equals` in class `Object`
Parameters:
  `object` - object to compare the receiver to
Returns:
  true=the object equals the receiver, the name is the same. false otherwise

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### isEditable

public boolean isEditable()
Returns whether this working set can be edited or not. To make a working set editable the attribute `pageClass` of the extension defining a working set must be provided.

Returns:
  `true` if the working set can be edited; otherwise `false`

### getId

public String getId()
Description copied from interface: `IWorkingSet`
Returns the working set id. Returns `null` if no working set id has been set. This is one of the ids defined by extensions of the org.eclipse.ui.workingSets extension point. It is used by the workbench to determine the page to use in the working set edit wizard. The default resource edit page is used if this value is `null`.

Returns:
  the working set id. May be `null`

### getImageDescriptor

public ImageDescriptor getImageDescriptor()
Description copied from interface: `IWorkingSet`
Returns the working set icon. Currently, this is one of the icons specified in the extensions of the org.eclipse.ui.workingSets extension point. The extension is identified using the value returned by `getId()`. Returns `null` if no icon has been specified in the extension or if `getId()` returns `null`.

Returns:
  the working set icon or `null`.

### hashCode

public int hashCode()
Returns the hash code.

Overrides:
  `hashCode` in class `Object`
Returns:
  the hash code.

### saveState

public void saveState(IMemento memento)
Implements IPersistableElement. Persist the working set name and working set contents. The contents has to be either IPersistableElements or provide adapters for it to be persistent.

Parameters:
  `memento` - the storage area for object's state
See Also:
  - `IPersistable.saveState(IMemento)`

### setElements

public void setElements(IAdaptable[] newElements)
Description copied from interface: `IWorkingSet`
Sets the elements that are contained in this working set.

Parameters:
  `newElements` - the elements to set in this working set

### setId

public void setId(String pageId)
Description copied from interface: `IWorkingSet`
Sets the working set id. This is one of the ids defined by extensions of the org.eclipse.ui.workingSets extension point. It is used by the workbench to determine the page to use in the working set edit wizard. The default resource edit page is used if this value is `null`.

Parameters:
  `pageId` - the working set id. May be `null`

### isVisible

public boolean isVisible()
Description copied from interface: `IWorkingSet`
Returns whether this working set should be shown in user interface components that list working sets by name.

Returns:
  `true` if the working set should be shown in the user interface; otherwise `false`

### isSelfUpdating

public boolean isSelfUpdating()
Description copied from interface: `IWorkingSet`
Returns `true` if this working set is capable of updating itself and reacting to changes in the state of its members. For non-aggregate working sets this means that the working set has an `IWorkingSetUpdater` installed while for aggregates it means that all component sets have `IWorkingSetUpdater`s installed. Otherwise returns `false`.

Returns:
  whether the set is self-updating or not

### isAggregateWorkingSet

public boolean isAggregateWorkingSet()
Description copied from interface: `IWorkingSet`
Returns whether this working set is an aggregate working set or not.

It is recommended that clients of aggregate working sets treat them in a specific way. Please see the documentation for `IWorkbenchPage.getAggregateWorkingSet()` for details.

If this is true, you can cast this working set to an `IAggregateWorkingSet`

Returns:
  whether this working set is an aggregate working set or not

### adaptElements

public IAdaptable[] adaptElements(IAdaptable[] objects)
Description copied from interface: `IWorkingSet`
Transforms the supplied elements into elements that are suitable for containment in this working set. This is useful for UI elements which wish to filter contributions to working sets based on applicability. This is a hint, however, and is not considered when the `IWorkingSet.setElements(IAdaptable[])` method is invoked.

Parameters:
  `objects` - the objects to transform
Returns:
  an array of transformed elements that be empty if no elements from the original array are suitable
See Also:
  - `IWorkingSetElementAdapter`
  - `BasicWorkingSetElementAdapter`