public interface ISourceConstructImplSupport extends ISourceElementImplSupport, ISourceConstructImplExtension
ISourceConstructImplExtension
to minimize the effort required to implement
that interface. Clients may implement ("mix in") this interface directly or
extend SourceConstruct
.
In general, the members first defined in this interface are not intended to be referenced outside the subtype hierarchy.
IElementImplExtension.CloseHint
NEW_ELEMENTS, NO_BODY
CLOSE_HINT, FORCE_OPEN
Modifier and Type | Method and Description |
---|---|
default void |
buildStructure_(IContext context,
org.eclipse.core.runtime.IProgressMonitor monitor)
Creates and initializes bodies for this element and for each non-
openable child element (and their non-openable children,
recursively). |
default boolean |
defaultEquals_(java.lang.Object obj)
A default implementation of
IElement.equals(Object) cannot be provided in
an interface, but clients can implement equals by
delegating to this default method. |
default int |
defaultHashCode_()
A default implementation of
IElement.hashCode() cannot be provided in
an interface, but clients can implement hashCode by
delegating to this default method. |
default boolean |
exists_()
Returns whether this element exists in the model.
|
default boolean |
isOpenable_()
Returns whether this element is "openable".
|
default void |
toStringName_(java.lang.StringBuilder builder,
IContext context) |
default void |
validateExistence_(IContext context)
Validates if this element may be "opened", i.e., begin existence
in the model.
|
checkInRange, getSourceElementAt_, getSourceElementAt_, getSourceElementInfo_
canEqual_, close_, findBody_, getChildrenFromBody_, getElementManager_, getModel_, newDoesNotExistException_, open_, openParent_, peekAtBody_, remove_, removing_, toString_, toStringAncestors_, toStringBody_, toStringChildren_
close_, getBody_, getBody_, getChildren_
getModelManager_
getOccurrenceCount_, setOccurrenceCount_
getParent_, getResource_
default int defaultHashCode_()
IElementImplSupport
IElement.hashCode()
cannot be provided in
an interface, but clients can implement hashCode
by
delegating to this default method.
By default, the hash code for an element is a combination of hash codes
for its name and its parent element. This method is specialized in ISourceConstructImplSupport
to include the element's occurrence count,
and in ISourceFileImplSupport
to return the hash code for the
underlying IFile
, if there is one. This method is not intended
to be replaced by clients; if necessary, clients should override
hashCode
directly.
defaultHashCode_
in interface IElementImplSupport
default boolean defaultEquals_(java.lang.Object obj)
IElementImplSupport
IElement.equals(Object)
cannot be provided in
an interface, but clients can implement equals
by
delegating to this default method.
By default, two elements that implement this interface are equal if they
are identical or if they can equal
each other
and both have equal names and parents. This method is specialized in
ISourceConstructImplSupport
and ISourceFileImplSupport
to also compare occurrence counts and underlying IFile
s
respectively. This method is not intended to be replaced by clients;
if necessary, clients should override equals
directly.
defaultEquals_
in interface IElementImplSupport
obj
- the object with which to comparetrue
if this element is equal to the given object,
and false
otherwisedefault boolean exists_()
IElementImpl
Handles may or may not be backed by an actual element. Handles that are backed by an actual element are said to "exist".
exists_
in interface IElementImpl
exists_
in interface IElementImplSupport
true
if this element exists in the model, and
false
if this element does not existdefault boolean isOpenable_()
An openable element knows how to open itself on demand (i.e. initialize its body and put it in the body cache). When opening an element, it is ensured that all openable parent elements are open. On the other hand, opening an element should open only those child elements that are not openable: all other children will open themselves on demand.
This implementation always returns false
.
isOpenable_
in interface IElementImplSupport
true
if this element is openable,
false
otherwisedefault void validateExistence_(IContext context) throws org.eclipse.core.runtime.CoreException
Note that ancestor elements may or may not exist; this method need not explicitly verify their existence.
This implementation throws assertion error; the openable parent builds the whole structure and determines child existence.
validateExistence_
in interface IElementImplSupport
context
- the operation context (not null
)org.eclipse.core.runtime.CoreException
- if this element shall not existIElementImplSupport.newDoesNotExistException_()
default void buildStructure_(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
openable
child element (and their non-openable children,
recursively). Uses the IElementImplSupport.NEW_ELEMENTS
map in the given context
to associate the created bodies with their respective elements.
This implementation throws assertion error; the openable parent builds the whole structure in one go.
buildStructure_
in interface IElementImplSupport
context
- the operation context (not null
)monitor
- a progress monitor (not null
).
The caller must not rely on IProgressMonitor.done()
having been called by the receiverorg.eclipse.core.runtime.CoreException
- if the structure could not be determineddefault void toStringName_(java.lang.StringBuilder builder, IContext context)
toStringName_
in interface IElementImplSupport