Interface IElementExtension

  • All Superinterfaces:
    IElement

    public interface IElementExtension
    extends IElement
    Model implementors may opt to extend this interface, which extends IElement with a number of default methods.

    This interface is not intended to be referenced for purposes other than extension.

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default boolean exists()
      Returns whether this element exists in the model.
      default <T> T getAncestor​(java.lang.Class<T> ancestorType)
      Returns the closest ancestor of this element that has the given type (excluding this element).
      default IElement[] getChildren()
      Returns the immediate children of this element.
      default <T> T[] getChildren​(java.lang.Class<T> childType)
      Returns the immediate children of this element that have the given type.
      default java.net.URI getLocationUri()
      Returns a file system location for this element.
      default java.lang.String getName()
      Returns the name of this element, or null if this element has no name.
      default IElement getParent()
      Returns the element directly containing this element, or null if this element has no parent.
      default org.eclipse.core.resources.IResource getResource()
      Returns the innermost resource enclosing this element, or null if this element is not enclosed in a workspace resource.
      default IElement getRoot()
      Returns the root element containing this element.
    • Method Detail

      • getName

        default java.lang.String getName()
        Returns the name of this element, or null if this element has no name. This is a handle-only method.
        Returns:
        the element name, or null if this element has no name
      • getParent

        default IElement getParent()
        Returns the element directly containing this element, or null if this element has no parent. This is a handle-only method.
        Returns:
        the parent element, or null if this element has no parent
      • getRoot

        default IElement getRoot()
        Returns the root element containing this element. Returns this element if it has no parent. This is a handle-only method.
        Returns:
        the root element (never null)
      • getAncestor

        default <T> T getAncestor​(java.lang.Class<T> ancestorType)
        Returns the closest ancestor of this element that has the given type (excluding this element). Returns null if no such ancestor can be found. This is a handle-only method.
        Parameters:
        ancestorType - the given type (not null)
        Returns:
        the closest ancestor of this element that has the given type (excluding this element), or null if no such ancestor can be found
      • getResource

        default org.eclipse.core.resources.IResource getResource()
        Returns the innermost resource enclosing this element, or null if this element is not enclosed in a workspace resource. This is a handle-only method.

        Note that it is safe to call this method and test the return value for null even when org.eclipse.core.resources bundle is not available.

        Returns:
        the innermost resource enclosing this element, or null if this element is not enclosed in a workspace resource
      • getLocationUri

        default java.net.URI getLocationUri()
        Returns a file system location for this element. The resulting URI is suitable to passing to EFS.getStore(URI). Returns null if no location can be determined.
        Returns:
        a file system location for this element, or null if no location can be determined
      • exists

        default boolean exists()
        Returns whether this element exists in the model.

        Handles may or may not be backed by an actual element. Handles that are backed by an actual element are said to "exist".

        Returns:
        true if this element exists in the model, and false if this element does not exist
      • getChildren

        default IElement[] getChildren()
                                throws org.eclipse.core.runtime.CoreException
        Returns the immediate children of this element. Unless otherwise specified by the implementing element, the children are in no particular order.
        Returns:
        the immediate children of this element (never null). Clients must not modify the returned array.
        Throws:
        org.eclipse.core.runtime.CoreException - if this element does not exist or if an exception occurs while accessing its corresponding resource
      • getChildren

        default <T> T[] getChildren​(java.lang.Class<T> childType)
                             throws org.eclipse.core.runtime.CoreException
        Returns the immediate children of this element that have the given type. Unless otherwise specified by the implementing element, the children are in no particular order.
        Parameters:
        childType - the given type (not null)
        Returns:
        the immediate children of this element that have the given type (never null). Clients must not modify the returned array.
        Throws:
        org.eclipse.core.runtime.CoreException - if this element does not exist or if an exception occurs while accessing its corresponding resource