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 stateis 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)IResourceDescriptiongetResourceDescription(org.eclipse.emf.common.util.URI uri)intgetResourceDescriptionCount()java.lang.Iterable<IResourceDescription>getResourceDescriptions()protected IContainerStategetState()booleanhasResourceDescription(org.eclipse.emf.common.util.URI uri)booleanisEmpty()Clients may want to check the selectable to skip its processing in case it is empty.java.lang.StringtoString()-
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:
filterByURIin classResourceDescriptionsBasedContainer
-
hasResourceDescription
public boolean hasResourceDescription(org.eclipse.emf.common.util.URI uri)
- Specified by:
hasResourceDescriptionin interfaceIContainer- Overrides:
hasResourceDescriptionin classResourceDescriptionsBasedContainer- Returns:
trueif the container can provide aresource description with the given uri.
-
getResourceDescriptionCount
public int getResourceDescriptionCount()
- Specified by:
getResourceDescriptionCountin interfaceIContainer- Overrides:
getResourceDescriptionCountin classResourceDescriptionsBasedContainer- Returns:
- the total number of resource descriptions returned by
IContainer.getResourceDescriptions()
-
isEmpty
public boolean isEmpty()
Description copied from interface:ISelectableClients 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 returnfalseif it is too expensive to compute the actual result.- Specified by:
isEmptyin interfaceISelectable- Overrides:
isEmptyin classAbstractCompoundSelectable- Returns:
trueif the selectable does not provide any descriptions.
-
getResourceDescription
public IResourceDescription getResourceDescription(org.eclipse.emf.common.util.URI uri)
- Specified by:
getResourceDescriptionin interfaceIContainer- Overrides:
getResourceDescriptionin classResourceDescriptionsBasedContainer- Returns:
- the
IResourceDescriptionfor 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:
getResourceDescriptionsin interfaceIContainer- Overrides:
getResourceDescriptionsin classResourceDescriptionsBasedContainer- Returns:
- the
IResourceDescriptioncontained 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:
doGetUriToDescriptionin classResourceDescriptionsBasedContainer
-
getExportedObjects
public java.lang.Iterable<IEObjectDescription> getExportedObjects()
- Specified by:
getExportedObjectsin interfaceISelectable- Overrides:
getExportedObjectsin classAbstractCompoundSelectable- Returns:
- all exported elements. May not be
null.
-
getExportedObjectsByType
public java.lang.Iterable<IEObjectDescription> getExportedObjectsByType(org.eclipse.emf.ecore.EClass type)
- Specified by:
getExportedObjectsByTypein interfaceISelectable- Overrides:
getExportedObjectsByTypein 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:
getExportedObjectsByObjectin interfaceISelectable- Overrides:
getExportedObjectsByObjectin 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:
getExportedObjectsin interfaceISelectable- Overrides:
getExportedObjectsin classResourceDescriptionsBasedContainer- Returns:
- all elements which match the given qualified name and type. May not be
null.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Since:
- 2.4
-
-