Class AdaptableList

    • Constructor Summary

      Constructors 
      Constructor Description
      AdaptableList()
      Creates a new adaptable list.
      AdaptableList​(int initialCapacity)
      Creates a new adaptable list with the given initial capacity.
      AdaptableList​(java.util.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.
    • Field Detail

      • children

        protected java.util.List children
    • Constructor Detail

      • AdaptableList

        public AdaptableList()
        Creates a new adaptable list. All of the elements in the list must implement IAdaptable.
      • AdaptableList

        public AdaptableList​(int initialCapacity)
        Creates a new adaptable list with the given initial capacity. All of the elements in the list must implement IAdaptable.
        Parameters:
        initialCapacity - the initial capacity of the list
      • AdaptableList

        public AdaptableList​(IAdaptable[] newChildren)
        Creates a new adaptable list containing the given children.
        Parameters:
        newChildren - the list of children
      • AdaptableList

        public AdaptableList​(java.util.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. All of the elements in the list must implement IAdaptable.
        Parameters:
        c - the initial elements of this list (element type: IAdaptable)
    • Method Detail

      • add

        public AdaptableList add​(IAdaptable adaptable)
        Adds the given adaptable object to this list.
        Parameters:
        adaptable - the new element
        Returns:
        this list
      • remove

        public void remove​(IAdaptable adaptable)
        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

        public <T> T getAdapter​(java.lang.Class<T> adapter)
        Description copied from interface: IAdaptable
        Returns an object which is an instance of the given class associated with this object. Returns null 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 interface IAdaptable
        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

        public java.lang.Object[] getChildren​(java.lang.Object o)
        Description copied from class: WorkbenchAdapter
        The default implementation of this IWorkbenchAdapter method returns the empty list. Subclasses may override.
        Specified by:
        getChildren in interface IWorkbenchAdapter
        Overrides:
        getChildren in class WorkbenchAdapter
        Parameters:
        o - The object to get the children for.
        Returns:
        Object[]
      • getChildren

        public java.lang.Object[] getChildren()
        Returns the elements in this list.
        Returns:
        the elements in this list
      • getTypedChildren

        public java.lang.Object[] getTypedChildren​(java.lang.Class type)
        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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object