org.eclipse.xtext.resource.containers
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.
A container state is used to decide about the actually
contained resource descriptions.
- Author:
- Sebastian Zarnekow - Initial contribution and API
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StateBasedContainer
public StateBasedContainer(IResourceDescriptions descriptions,
IContainerState state)
hasResourceDescription
public boolean hasResourceDescription(org.eclipse.emf.common.util.URI uri)
- Specified by:
hasResourceDescription in interface IContainer- Overrides:
hasResourceDescription in class ResourceDescriptionsBasedContainer
- Returns:
true if the container can provide a resource description with the given uri.
getResourceDescriptionCount
public int getResourceDescriptionCount()
- Specified by:
getResourceDescriptionCount in interface IContainer- Overrides:
getResourceDescriptionCount in class ResourceDescriptionsBasedContainer
- 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
return
false if it is too expensive to compute the actual result.
- Specified by:
isEmpty in interface ISelectable- Overrides:
isEmpty in class AbstractCompoundSelectable
- 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 interface IContainer- Overrides:
getResourceDescription in class ResourceDescriptionsBasedContainer
- Returns:
- the
IResourceDescription for the given URI, or null is this container does
not contain such an IResourceDescription.
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 interface IContainer- Overrides:
getResourceDescriptions in class ResourceDescriptionsBasedContainer
- Returns:
- the
IResourceDescription contained in this container. The result is never
null. 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 class ResourceDescriptionsBasedContainer
getExportedObjects
public java.lang.Iterable<IEObjectDescription> getExportedObjects()
- Specified by:
getExportedObjects in interface ISelectable- Overrides:
getExportedObjects in class AbstractCompoundSelectable
- 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 interface ISelectable- Overrides:
getExportedObjectsByType in class ResourceDescriptionsBasedContainer
- 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 interface ISelectable- Overrides:
getExportedObjectsByObject in class AbstractContainer
- 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 interface ISelectable- Overrides:
getExportedObjects in class ResourceDescriptionsBasedContainer
- Returns:
- all elements which match the given qualified name and type. May not be
null.