Package org.eclipse.handly.model
Interface IElementExtension
- All Superinterfaces:
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
Modifier and TypeMethodDescriptiondefault boolean
exists()
Returns whether this element exists in the model.default <T> T
getAncestor
(Class<T> ancestorType) Returns the closest ancestor of this element that has the given type (excluding this element).default IElement[]
Returns the immediate children of this element.default <T> T[]
getChildren
(Class<T> childType) Returns the immediate children of this element that have the given type.default URI
Returns a file system location for this element.default String
getName()
Returns the name of this element, ornull
if this element has no name.default IElement
Returns the element directly containing this element, ornull
if this element has no parent.default org.eclipse.core.resources.IResource
Returns the innermost resource enclosing this element, ornull
if this element is not enclosed in a workspace resource.default IElement
getRoot()
Returns the root element containing this element.
-
Method Details
-
getName
Returns the name of this element, ornull
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
Returns the element directly containing this element, ornull
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
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
Returns the closest ancestor of this element that has the given type (excluding this element). Returnsnull
if no such ancestor can be found. This is a handle-only method.- Parameters:
ancestorType
- the given type (notnull
)- 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, ornull
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 whenorg.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
Returns a file system location for this element. The resulting URI is suitable to passing toEFS.getStore(URI)
. Returnsnull
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, andfalse
if this element does not exist
-
getChildren
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
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 (notnull
)- 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
-