public interface IElementImpl extends IElement
IElement
s must implement this interface.Modifier and Type | Method and Description |
---|---|
default boolean |
equalsAndSameParentChain_(IElement other)
Returns whether this element is equal to the given element and belongs
to the same parent chain as the given element.
|
boolean |
exists_()
Returns whether this element exists in the model.
|
IElement[] |
getChildren_(IContext context,
org.eclipse.core.runtime.IProgressMonitor monitor)
Returns the immediate children of this element.
|
default <T> T[] |
getChildrenOfType_(java.lang.Class<T> type,
IContext context,
org.eclipse.core.runtime.IProgressMonitor monitor)
Returns the immediate children of this element that have the given type.
|
default java.lang.String |
getHandleMemento_()
Returns a string representation of this element handle that can be used
to recreate the handle via the model's
IElementHandleFactory . |
default java.net.URI |
getLocationUri_()
Returns a file system location for this element.
|
IModel |
getModel_()
Returns the model that owns this element.
|
java.lang.String |
getName_()
Returns the name of this element, or
null
if this element has no name. |
IElement |
getParent_()
Returns the element directly containing this element,
or
null if this element has no parent. |
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.
|
default java.lang.String |
toDisplayString_(IContext context)
Returns a string representation of this element in a form suitable for
displaying to the user, e.g., in message dialogs.
|
java.lang.String |
toString_(IContext context)
Returns a string representation of this element in a form suitable for
debugging purposes.
|
java.lang.String getName_()
null
if this element has no name. This is a handle-only method.null
if this element has no nameIElement getParent_()
null
if this element has no parent.
This is a handle-only method.null
if this element has
no parentdefault IElement getRoot_()
null
)default boolean equalsAndSameParentChain_(IElement other)
This implementation accounts for the most general case where equal
elements may belong to different parent chains. For example, in JDT, equal
JarPackageFragmentRoots may belong to different Java projects. Specific
models can provide an optimized implementation. For example, it would be
possible to just return equals(other)
if it were known for
a model that equal elements might not belong to different parent chains.
other
- may be null
true
if this element is equal to the given element
and belongs to the same parent chain, and false
otherwiseIModel getModel_()
null
)default java.lang.String getHandleMemento_()
IElementHandleFactory
.
The format of the string is not specified, but the representation is
stable across workbench sessions. This is a handle-only method.null
if this element is unable to provide a handle mementoorg.eclipse.core.resources.IResource getResource_()
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.
null
if this element is not enclosed in a workspace resourcedefault java.net.URI getLocationUri_()
EFS.getStore(URI)
. Returns
null
if no location can be determined.null
if no location can be determinedboolean exists_()
Handles may or may not be backed by an actual element. Handles that are backed by an actual element are said to "exist".
true
if this element exists in the model, and
false
if this element does not existIElement[] getChildren_(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
context
- the operation context (not null
)monitor
- a progress monitor, or null
if progress reporting is not desired. The caller must not rely on
IProgressMonitor.done()
having been called by the receivernull
).
Clients must not modify the returned array.org.eclipse.core.runtime.CoreException
- if this element does not exist or if an
exception occurs while accessing its corresponding resourcedefault <T> T[] getChildrenOfType_(java.lang.Class<T> type, IContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
type
- not null
context
- the operation context (not null
)monitor
- a progress monitor, or null
if progress reporting is not desired. The caller must not rely on
IProgressMonitor.done()
having been called by the receivernull
). Clients must not modify the returned
array.org.eclipse.core.runtime.CoreException
- if this element does not exist or if an
exception occurs while accessing its corresponding resourcejava.lang.String toString_(IContext context)
Implementations are encouraged to support common options defined in
ToStringOptions
and
interpret the FORMAT_STYLE
as follows:
context
- not null
null
)default java.lang.String toDisplayString_(IContext context)
Implementations are encouraged to support common options defined in
ToStringOptions
and may
interpret the FORMAT_STYLE
as they see fit in a way that is specific to the model.
No hard rules apply, but usually the string representation does not list
the element's children regardless of the format style, and a FULL
representation fully identifies the element within the model.
context
- not null
null
)Copyright (c) 2014, 2018 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0