public abstract class AbstractContainmentAdapter
extends java.lang.Object
implements org.eclipse.ui.IContainmentAdapter
IContainmentAdapter
for Handly-based models.
Containment adapters provide a way to test element containment in a model-independent way. Each model may contribute a containment adapter via an adapter factory. The workbench will use the containment adapter to test if a given resource is part of a working set for the model.
ResourceWorkingSetFilter| Constructor and Description |
|---|
AbstractContainmentAdapter() |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
checkContext(int flags)
Returns whether the
CHECK_CONTEXT flag is set. |
protected static boolean |
checkIfAncestor(int flags)
Returns whether the
CHECK_IF_ANCESTOR flag is set. |
protected static boolean |
checkIfChild(int flags)
Returns whether the
CHECK_IF_CHILD flag is set. |
protected static boolean |
checkIfDescendant(int flags)
Returns whether the
CHECK_IF_DESCENDANT flag is set. |
protected boolean |
contains(IElement containmentContext,
IElement element,
int flags)
Returns whether the given element is considered contained in the given
containment context or if it is the context itself.
|
protected boolean |
contains(IElement containmentContext,
org.eclipse.core.resources.IResource resource,
int flags)
Returns whether the given resource is considered contained in the given
containment context or if it corresponds to the context itself.
|
boolean |
contains(java.lang.Object containmentContext,
java.lang.Object element,
int flags) |
protected IContentAdapter |
getContentAdapter()
Returns the content adapter that defines a mapping between elements
of a Handly-based model and the working set's content.
|
protected abstract IElement |
getElementFor(org.eclipse.core.resources.IResource resource)
Returns the model element corresponding to the given resource,
or
null if no such element can be found. |
protected boolean |
isAncestorOf(IElement element,
IElement other)
Returns whether the element is an ancestor of the other element.
|
protected boolean |
isAncestorOf(org.eclipse.core.resources.IResource resource,
org.eclipse.core.resources.IResource other)
Returns whether the resource is an ancestor of the other resource.
|
public boolean contains(java.lang.Object containmentContext,
java.lang.Object element,
int flags)
This implementation returns false if the specified containment
context could not be adapted to an IElement through the content adapter. Otherwise, it attempts to adapt the
given element to an IElement either via the content adapter
or, failing that, by first attempting to adapt it to an IResource
and then calling getElementFor(IResource). If the given element
could be adapted to an IElement, this implementation delegates
to contains(IElement, IElement, int). If the given element could
be adapted to an IResource but not to an IElement,
this implementation delegates to contains(IElement, IResource, int).
Otherwise, false is returned.
contains in interface org.eclipse.ui.IContainmentAdapterprotected abstract IElement getElementFor(org.eclipse.core.resources.IResource resource)
null if no such element can be found.resource - never nullnull if no such element can be foundprotected IContentAdapter getContentAdapter()
Default implementation returns a NullContentAdapter.
Subclasses may override.
IContentAdapter (never null)protected boolean contains(IElement containmentContext, IElement element, int flags)
containmentContext - never nullelement - never nullflags - one or more of CHECK_CONTEXT,
CHECK_IF_CHILD, CHECK_IF_ANCESTOR,
CHECK_IF_DESCENDENT logically ORed togethertrue if the given element is considered contained
in the given containment context or if it is context itself, and
false otherwiseprotected boolean isAncestorOf(IElement element, IElement other)
element - never nullother - never nulltrue if the element is an ancestor
of the other element, and false otherwiseprotected boolean contains(IElement containmentContext, org.eclipse.core.resources.IResource resource, int flags)
containmentContext - never nullresource - never nullflags - one or more of CHECK_CONTEXT,
CHECK_IF_CHILD, CHECK_IF_ANCESTOR,
CHECK_IF_DESCENDENT logically ORed togethertrue if the given resource is considered contained
in the given containment context or if it corresponds to the context
itself, and false otherwiseprotected boolean isAncestorOf(org.eclipse.core.resources.IResource resource,
org.eclipse.core.resources.IResource other)
resource - never nullother - never nulltrue if the resource is an ancestor
of the other resource, and false otherwiseprotected static boolean checkContext(int flags)
CHECK_CONTEXT flag is set.flags - one or more of CHECK_CONTEXT,
CHECK_IF_CHILD, CHECK_IF_ANCESTOR,
CHECK_IF_DESCENDENT logically ORed togethertrue if the CHECK_CONTEXT flag is set,
and false otherwiseprotected static boolean checkIfChild(int flags)
CHECK_IF_CHILD flag is set.flags - one or more of CHECK_CONTEXT,
CHECK_IF_CHILD, CHECK_IF_ANCESTOR,
CHECK_IF_DESCENDENT logically ORed togethertrue if the CHECK_IF_CHILD flag is set,
and false otherwiseprotected static boolean checkIfAncestor(int flags)
CHECK_IF_ANCESTOR flag is set.flags - one or more of CHECK_CONTEXT,
CHECK_IF_CHILD, CHECK_IF_ANCESTOR,
CHECK_IF_DESCENDENT logically ORed togethertrue if the CHECK_IF_ANCESTOR flag
is set, and false otherwiseprotected static boolean checkIfDescendant(int flags)
CHECK_IF_DESCENDANT flag is set.flags - one or more of CHECK_CONTEXT,
CHECK_IF_CHILD, CHECK_IF_ANCESTOR,
CHECK_IF_DESCENDENT logically ORed togethertrue if the CHECK_IF_DESCENDANT flag
is set, and false otherwiseCopyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0