Package org.eclipse.ui.model
Class AdaptableList
java.lang.Object
org.eclipse.ui.model.WorkbenchAdapter
org.eclipse.ui.model.AdaptableList
- All Implemented Interfaces:
IAdaptable
,IWorkbenchAdapter
,IWorkbenchAdapter2
,IWorkbenchAdapter3
A modifiable list of
IAdaptable
objects. The list is adaptable
to IWorkbenchAdapter
, and can be used to display an arbitrary
set of adaptable objects in a viewer.
This class is not intended to be subclassed.
- Since:
- 3.0
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Fields inherited from class org.eclipse.ui.model.WorkbenchAdapter
NO_CHILDREN
-
Constructor Summary
ConstructorDescriptionCreates a new adaptable list.AdaptableList
(int initialCapacity) Creates a new adaptable list with the given initial capacity.Creates a new adaptable list containing the elements of the specified collection, in the order they are returned by the collection's iterator.AdaptableList
(IAdaptable[] newChildren) Creates a new adaptable list containing the given children. -
Method Summary
Modifier and TypeMethodDescriptionadd
(IAdaptable adaptable) Adds the given adaptable object to this list.<T> T
getAdapter
(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.Object[]
Returns the elements in this list.Object[]
The default implementation of thisIWorkbenchAdapter
method returns the empty list.Object[]
getTypedChildren
(Class type) Return the elements in this list in an array of the given type.void
remove
(IAdaptable adaptable) Removes the given adaptable object from this list.int
size()
Returns the number of children in this list.toString()
Methods inherited from class org.eclipse.ui.model.WorkbenchAdapter
getBackground, getFont, getForeground, getImageDescriptor, getLabel, getParent, getStyledText
-
Field Details
-
children
-
-
Constructor Details
-
AdaptableList
public AdaptableList()Creates a new adaptable list. All of the elements in the list must implementIAdaptable
. -
AdaptableList
public AdaptableList(int initialCapacity) Creates a new adaptable list with the given initial capacity. All of the elements in the list must implementIAdaptable
.- Parameters:
initialCapacity
- the initial capacity of the list
-
AdaptableList
Creates a new adaptable list containing the given children.- Parameters:
newChildren
- the list of children
-
AdaptableList
Creates a new adaptable list containing the elements of the specified collection, in the order they are returned by the collection's iterator. All of the elements in the list must implementIAdaptable
.- Parameters:
c
- the initial elements of this list (element type:IAdaptable
)
-
-
Method Details
-
add
Adds the given adaptable object to this list.- Parameters:
adaptable
- the new element- Returns:
- this list
-
remove
Removes the given adaptable object from this list.- Parameters:
adaptable
- the element to remove
-
size
public int size()Returns the number of children in this list.- Returns:
- the length of this list
-
getAdapter
Description copied from interface:IAdaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.Clients may implement this method but should generally call
Adapters.adapt(Object, Class, boolean)
rather than invoking it directly.- Specified by:
getAdapter
in interfaceIAdaptable
- Type Parameters:
T
- the class type- Parameters:
adapter
- the adapter class to look up- Returns:
- a object of the given class, or
null
if this object does not have an adapter for the given class
-
getChildren
Description copied from class:WorkbenchAdapter
The default implementation of thisIWorkbenchAdapter
method returns the empty list. Subclasses may override.- Specified by:
getChildren
in interfaceIWorkbenchAdapter
- Overrides:
getChildren
in classWorkbenchAdapter
- Parameters:
o
- The object to get the children for.- Returns:
- Object[]
-
getChildren
Returns the elements in this list.- Returns:
- the elements in this list
-
getTypedChildren
Return the elements in this list in an array of the given type.- Parameters:
type
- the type of the array to create- Returns:
- the elements in the list
- Since:
- 3.1
-
toString
-