public class AdaptableList extends WorkbenchAdapter implements IAdaptable
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.
IWorkbenchAdapter
Modifier and Type | Field and Description |
---|---|
protected List |
children |
NO_CHILDREN
Constructor and Description |
---|
AdaptableList()
Creates a new adaptable list.
|
AdaptableList(Collection c)
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.
|
AdaptableList(int initialCapacity)
Creates a new adaptable list with the given initial capacity.
|
Modifier and Type | Method and Description |
---|---|
AdaptableList |
add(IAdaptable adaptable)
Adds the given adaptable object to this list.
|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
Object[] |
getChildren()
Returns the elements in this list.
|
Object[] |
getChildren(Object o)
The default implementation of this
IWorkbenchAdapter 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.
|
String |
toString() |
getBackground, getFont, getForeground, getImageDescriptor, getLabel, getParent, getStyledText
protected List children
public AdaptableList()
IAdaptable
.public AdaptableList(int initialCapacity)
IAdaptable
.initialCapacity
- the initial capacity of the listpublic AdaptableList(IAdaptable[] newChildren)
newChildren
- the list of childrenpublic AdaptableList(Collection c)
IAdaptable
.c
- the initial elements of this list (element type:
IAdaptable
)public AdaptableList add(IAdaptable adaptable)
adaptable
- the new elementpublic void remove(IAdaptable adaptable)
adaptable
- the element to removepublic int size()
public Object getAdapter(Class adapter)
IAdaptable
null
if
no such object can be found.getAdapter
in interface IAdaptable
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given classpublic Object[] getChildren(Object o)
WorkbenchAdapter
IWorkbenchAdapter
method
returns the empty list. Subclasses may override.getChildren
in interface IWorkbenchAdapter
getChildren
in class WorkbenchAdapter
o
- The object to get the children for.public Object[] getChildren()
public Object[] getTypedChildren(Class type)
type
- the type of the array to create
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.