Class StateBasedContainer
- java.lang.Object
-
- org.eclipse.xtext.resource.impl.AbstractCompoundSelectable
-
- org.eclipse.xtext.resource.impl.AbstractContainer
-
- org.eclipse.xtext.resource.impl.ResourceDescriptionsBasedContainer
-
- org.eclipse.xtext.resource.containers.StateBasedContainer
-
- All Implemented Interfaces:
IContainer
,IResourceDescription.Event.Listener
,ISelectable
public class StateBasedContainer extends ResourceDescriptionsBasedContainer
A specialized container which is based on some long living lightweight state. Acontainer state
is used to decide about the actually contained resource descriptions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.xtext.resource.IContainer
IContainer.Manager
-
-
Field Summary
-
Fields inherited from interface org.eclipse.xtext.resource.IContainer
NULL_CONTAINER
-
-
Constructor Summary
Constructors Constructor Description StateBasedContainer(IResourceDescriptions descriptions, IContainerState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<org.eclipse.emf.common.util.URI,IResourceDescription>
doGetUriToDescription()
protected java.lang.Iterable<IEObjectDescription>
filterByURI(java.lang.Iterable<IEObjectDescription> unfiltered)
java.lang.Iterable<IEObjectDescription>
getExportedObjects()
java.lang.Iterable<IEObjectDescription>
getExportedObjects(org.eclipse.emf.ecore.EClass type, QualifiedName qualifiedName, boolean ignoreCase)
java.lang.Iterable<IEObjectDescription>
getExportedObjectsByObject(org.eclipse.emf.ecore.EObject object)
java.lang.Iterable<IEObjectDescription>
getExportedObjectsByType(org.eclipse.emf.ecore.EClass type)
IResourceDescription
getResourceDescription(org.eclipse.emf.common.util.URI uri)
int
getResourceDescriptionCount()
java.lang.Iterable<IResourceDescription>
getResourceDescriptions()
protected IContainerState
getState()
boolean
hasResourceDescription(org.eclipse.emf.common.util.URI uri)
boolean
isEmpty()
Clients may want to check the selectable to skip its processing in case it is empty.java.lang.String
toString()
-
Methods inherited from class org.eclipse.xtext.resource.impl.ResourceDescriptionsBasedContainer
contains, descriptionsChanged, getDescriptions, getUriToDescription, isUriToDescriptionCacheEnabled, setUriToDescriptionCacheEnabled
-
Methods inherited from class org.eclipse.xtext.resource.impl.AbstractContainer
getSelectables
-
-
-
-
Constructor Detail
-
StateBasedContainer
public StateBasedContainer(IResourceDescriptions descriptions, IContainerState state)
-
-
Method Detail
-
getState
protected final IContainerState getState()
- Since:
- 2.20
-
filterByURI
protected java.lang.Iterable<IEObjectDescription> filterByURI(java.lang.Iterable<IEObjectDescription> unfiltered)
- Overrides:
filterByURI
in classResourceDescriptionsBasedContainer
-
hasResourceDescription
public boolean hasResourceDescription(org.eclipse.emf.common.util.URI uri)
- Specified by:
hasResourceDescription
in interfaceIContainer
- Overrides:
hasResourceDescription
in classResourceDescriptionsBasedContainer
- Returns:
true
if the container can provide aresource description with the given uri
.
-
getResourceDescriptionCount
public int getResourceDescriptionCount()
- Specified by:
getResourceDescriptionCount
in interfaceIContainer
- Overrides:
getResourceDescriptionCount
in classResourceDescriptionsBasedContainer
- Returns:
- the total number of resource descriptions returned by
IContainer.getResourceDescriptions()
-
isEmpty
public boolean isEmpty()
Description copied from interface:ISelectable
Clients may want to check the selectable to skip its processing in case it is empty. Implementations should be fast and not require expensive precalculation. Selectable may returnfalse
if it is too expensive to compute the actual result.- Specified by:
isEmpty
in interfaceISelectable
- Overrides:
isEmpty
in classAbstractCompoundSelectable
- Returns:
true
if the selectable does not provide any descriptions.
-
getResourceDescription
public IResourceDescription getResourceDescription(org.eclipse.emf.common.util.URI uri)
- Specified by:
getResourceDescription
in interfaceIContainer
- Overrides:
getResourceDescription
in classResourceDescriptionsBasedContainer
- Returns:
- the
IResourceDescription
for the given URI, or null is this container does not contain such anIResourceDescription
. The result may be a cached view on the actual content of the underlying resource.
-
getResourceDescriptions
public java.lang.Iterable<IResourceDescription> getResourceDescriptions()
- Specified by:
getResourceDescriptions
in interfaceIContainer
- Overrides:
getResourceDescriptions
in classResourceDescriptionsBasedContainer
- Returns:
- the
IResourceDescription
contained in this container. The result is nevernull
. The result may be a cached view on the actual content of the underlying resources.
-
doGetUriToDescription
protected java.util.Map<org.eclipse.emf.common.util.URI,IResourceDescription> doGetUriToDescription()
- Overrides:
doGetUriToDescription
in classResourceDescriptionsBasedContainer
-
getExportedObjects
public java.lang.Iterable<IEObjectDescription> getExportedObjects()
- Specified by:
getExportedObjects
in interfaceISelectable
- Overrides:
getExportedObjects
in classAbstractCompoundSelectable
- Returns:
- all exported elements. May not be
null
.
-
getExportedObjectsByType
public java.lang.Iterable<IEObjectDescription> getExportedObjectsByType(org.eclipse.emf.ecore.EClass type)
- Specified by:
getExportedObjectsByType
in interfaceISelectable
- Overrides:
getExportedObjectsByType
in classResourceDescriptionsBasedContainer
- Returns:
- all elements which match the given type. May not be
null
.
-
getExportedObjectsByObject
public java.lang.Iterable<IEObjectDescription> getExportedObjectsByObject(org.eclipse.emf.ecore.EObject object)
- Specified by:
getExportedObjectsByObject
in interfaceISelectable
- Overrides:
getExportedObjectsByObject
in classAbstractContainer
- Returns:
- all elements which match the given instance. May not be
null
.
-
getExportedObjects
public java.lang.Iterable<IEObjectDescription> getExportedObjects(org.eclipse.emf.ecore.EClass type, QualifiedName qualifiedName, boolean ignoreCase)
- Specified by:
getExportedObjects
in interfaceISelectable
- Overrides:
getExportedObjects
in classResourceDescriptionsBasedContainer
- Returns:
- all elements which match the given qualified name and type. May not be
null
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Since:
- 2.4
-
-