# Class AbstractWorkingSet

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

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

Direct Known Subclasses:
  `AggregateWorkingSet, WorkingSet`

public abstract class AbstractWorkingSet extends Object implements IAdaptable, IWorkingSet, Cloneable
Abstract baseclass for IWorkingSet implementations.

Since:
  3.2

## Field Summary

Fields
Modifier and Type
Field
Description
`protected List<IAdaptable>`
`elements`
`protected static final String`
`FACTORY_ID`
`protected IMemento`
`workingSetMemento`

## Constructor Summary

Constructors
Constructor
Description
`AbstractWorkingSet(String name, String label)`
Create a new instance of this class

## Method Summary

Modifier and Type
Method
Description
`protected AbstractWorkingSet`
`clone()`
`void`
`connect(IWorkingSetManager manager)`
Connect this working set to a manger.
`void`
`disconnect()`
Disconnect this working set from its manager, if any.
`protected void`
`fireWorkingSetChanged(String property, Object oldValue)`
`<T> T`
`getAdapter(Class<T> adapter)`
Returns the receiver if the requested type is either IWorkingSet or IPersistableElement.
`IAdaptable[]`
`getElements()`
Returns the elements that are contained in this working set.
`protected List<IAdaptable>`
`getElementsArray()`
Returns the elements array list.
`String`
`getFactoryId()`
Returns the id of the element factory which should be used to re-create this object.
`final ImageDescriptor`
`getImage()`
Returns the working set icon.
`String`
`getLabel()`
Return the name of this working set, formated for the end user.
`protected IWorkingSetManager`
`getManager()`
`String`
`getName()`
Returns the name of the working set.
`protected void`
`internalSetElements(IAdaptable[] newElements)`
Create a copy of the elements to store in the receiver.
`boolean`
`isEmpty()`
Returns whether this working set is currently empty (has no elements).
`void`
`setLabel(String label)`
Set the name of this working set, formated for the end user.
`void`
`setName(String newName)`
Sets the name of the working set.

### Methods inherited from class Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface IPersistable

`saveState`

### Methods inherited from interface IWorkingSet

`adaptElements, getId, getImageDescriptor, isAggregateWorkingSet, isEditable, isSelfUpdating, isVisible, setElements, setId`

## Field Details

### FACTORY_ID

protected static final String FACTORY_ID

See Also:
  - Constant Field Values

### elements

protected List<IAdaptable> elements

### workingSetMemento

protected IMemento workingSetMemento

## Constructor Details

### AbstractWorkingSet

public AbstractWorkingSet(String name, String label)
Create a new instance of this class

Parameters:
  `name` - the unique name for this working set
  `label` - the user-friendly name for this working set

## Method Details

### getAdapter

public <T> T getAdapter(Class<T> adapter)
Returns the receiver if the requested type is either IWorkingSet or IPersistableElement.

Specified by:
  `getAdapter` in interface `IAdaptable`
Type Parameters:
  `T` - the class type
Parameters:
  `adapter` - the requested type
Returns:
  the receiver if the requested type is either IWorkingSet or IPersistableElement.

### getName

public String getName()
Description copied from interface: `IWorkingSet`
Returns the name of the working set.

Specified by:
  `getName` in interface `IWorkingSet`
Returns:
  the name of the working set

### setName

public void setName(String newName)
Description copied from interface: `IWorkingSet`
Sets the name of the working set. The working set name should be unique. The working set name must not have leading or trailing whitespace.

Specified by:
  `setName` in interface `IWorkingSet`
Parameters:
  `newName` - the name of the working set

### connect

public void connect(IWorkingSetManager manager)
Connect this working set to a manger.

Parameters:
  `manager` - the manager to connect to

### disconnect

public void disconnect()
Disconnect this working set from its manager, if any.

### fireWorkingSetChanged

protected void fireWorkingSetChanged(String property, Object oldValue)

### internalSetElements

protected void internalSetElements(IAdaptable[] newElements)
Create a copy of the elements to store in the receiver.

Parameters:
  `newElements` - the elements to store a copy of in the receiver.

### getElements

public IAdaptable[] getElements()
Description copied from interface: `IWorkingSet`
Returns the elements that are contained in this working set.

This method might throw an `IllegalStateException` if the working set is invalid.

Specified by:
  `getElements` in interface `IWorkingSet`
Returns:
  the working set's elements

### getElementsArray

protected List<IAdaptable> getElementsArray()
Returns the elements array list. Lazily restores the elements from persistence memento.

Returns:
  the elements array list

### getManager

protected IWorkingSetManager getManager()

### getFactoryId

public String getFactoryId()
Description copied from interface: `IPersistableElement`
Returns the id of the element factory which should be used to re-create this object.

Factory ids are declared in extensions to the standard extension point `"org.eclipse.ui.elementFactories"`.

Specified by:
  `getFactoryId` in interface `IPersistableElement`
Returns:
  the element factory id
See Also:
  - `IElementFactory`

### getLabel

public String getLabel()
Description copied from interface: `IWorkingSet`
Return the name of this working set, formated for the end user. Often this value is the same as the one returned from `IWorkingSet.getName()`.

Specified by:
  `getLabel` in interface `IWorkingSet`
Returns:
  the name of this working set, formated for the end user

### setLabel

public void setLabel(String label)
Description copied from interface: `IWorkingSet`
Set the name of this working set, formated for the end user.

Specified by:
  `setLabel` in interface `IWorkingSet`
Parameters:
  `label` - the label for this working set. If `null` is supplied then the value of `IWorkingSet.getName()` will be used.

### isEmpty

public boolean isEmpty()
Description copied from interface: `IWorkingSet`
Returns whether this working set is currently empty (has no elements).

Specified by:
  `isEmpty` in interface `IWorkingSet`
Returns:
  whether this working set is currently empty

### getImage

public final ImageDescriptor getImage()
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`.

Specified by:
  `getImage` in interface `IWorkingSet`
Returns:
  the working set icon or `null`.

### clone

protected AbstractWorkingSet clone()

Overrides:
  `clone` in class `Object`