Package org.eclipse.xtext.resource.impl
Class ResourceDescriptionsBasedContainer
- java.lang.Object
-
- org.eclipse.xtext.resource.impl.AbstractCompoundSelectable
-
- org.eclipse.xtext.resource.impl.AbstractContainer
-
- org.eclipse.xtext.resource.impl.ResourceDescriptionsBasedContainer
-
- All Implemented Interfaces:
IContainer
,IResourceDescription.Event.Listener
,ISelectable
- Direct Known Subclasses:
StateBasedContainer
public class ResourceDescriptionsBasedContainer extends AbstractContainer implements IResourceDescription.Event.Listener
A defaultResourceDescriptionsBasedContainer
will expose the complete set of resource descriptions of a backingIResourceDescriptions
. Clients may override and filter the uris based on arbitrary criteria by means ofcontains(IResourceDescription)
andhasResourceDescription(URI)
. The implementation has to be symmetric. The default implementation ofcontains
delegates tohasResourceDescription
. The default implementation is not synchronized as clients will usually create short living containers.
-
-
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 ResourceDescriptionsBasedContainer(IResourceDescriptions descriptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
contains(IResourceDescription input)
void
descriptionsChanged(IResourceDescription.Event event)
The source will invoke this method to announce changed resources.protected java.util.Map<org.eclipse.emf.common.util.URI,IResourceDescription>
doGetUriToDescription()
protected java.lang.Iterable<IEObjectDescription>
filterByURI(java.lang.Iterable<IEObjectDescription> unfiltered)
protected IResourceDescriptions
getDescriptions()
java.lang.Iterable<IEObjectDescription>
getExportedObjects(org.eclipse.emf.ecore.EClass type, QualifiedName qualifiedName, boolean ignoreCase)
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 java.util.Map<org.eclipse.emf.common.util.URI,IResourceDescription>
getUriToDescription()
boolean
hasResourceDescription(org.eclipse.emf.common.util.URI uri)
boolean
isUriToDescriptionCacheEnabled()
void
setUriToDescriptionCacheEnabled(boolean enabled)
-
Methods inherited from class org.eclipse.xtext.resource.impl.AbstractContainer
getExportedObjectsByObject, getSelectables
-
Methods inherited from class org.eclipse.xtext.resource.impl.AbstractCompoundSelectable
getExportedObjects, isEmpty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.xtext.resource.ISelectable
getExportedObjects, isEmpty
-
-
-
-
Constructor Detail
-
ResourceDescriptionsBasedContainer
public ResourceDescriptionsBasedContainer(IResourceDescriptions descriptions)
-
-
Method Detail
-
getResourceDescription
public IResourceDescription getResourceDescription(org.eclipse.emf.common.util.URI uri)
- Specified by:
getResourceDescription
in interfaceIContainer
- Overrides:
getResourceDescription
in classAbstractContainer
- 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
- 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.
-
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 classAbstractCompoundSelectable
- Returns:
- all elements which match the given qualified name and type. 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 classAbstractCompoundSelectable
- Returns:
- all elements which match the given type. May not be
null
.
-
filterByURI
protected java.lang.Iterable<IEObjectDescription> filterByURI(java.lang.Iterable<IEObjectDescription> unfiltered)
-
getResourceDescriptionCount
public int getResourceDescriptionCount()
- Specified by:
getResourceDescriptionCount
in interfaceIContainer
- Overrides:
getResourceDescriptionCount
in classAbstractContainer
- Returns:
- the total number of resource descriptions returned by
IContainer.getResourceDescriptions()
-
setUriToDescriptionCacheEnabled
public void setUriToDescriptionCacheEnabled(boolean enabled)
- Since:
- 2.3
-
isUriToDescriptionCacheEnabled
public boolean isUriToDescriptionCacheEnabled()
- Since:
- 2.3
-
getUriToDescription
protected java.util.Map<org.eclipse.emf.common.util.URI,IResourceDescription> getUriToDescription()
-
doGetUriToDescription
protected java.util.Map<org.eclipse.emf.common.util.URI,IResourceDescription> doGetUriToDescription()
-
contains
protected boolean contains(IResourceDescription input)
-
hasResourceDescription
public boolean hasResourceDescription(org.eclipse.emf.common.util.URI uri)
- Specified by:
hasResourceDescription
in interfaceIContainer
- Overrides:
hasResourceDescription
in classAbstractContainer
- Returns:
true
if the container can provide aresource description with the given uri
.
-
getDescriptions
protected IResourceDescriptions getDescriptions()
-
descriptionsChanged
public void descriptionsChanged(IResourceDescription.Event event)
Description copied from interface:IResourceDescription.Event.Listener
The source will invoke this method to announce changed resources. The event will never be
null
. However, it may contain an empty list of deltas.Listeners are free to remove themselves from the sender of the event or add other listeners. However added listeners will not be informed about the current change.
This event may be fired asynchronously. It is ensured that the changed resources will provide the content as it was when the change has been announced to the sender of the event.
- Specified by:
descriptionsChanged
in interfaceIResourceDescription.Event.Listener
- Parameters:
event
- the fired event. Will never benull
.
-
-