org.eclipse.xtext.resource.containers
Class DescriptionAddingContainer

java.lang.Object
  extended by org.eclipse.xtext.resource.impl.AbstractCompoundSelectable
      extended by org.eclipse.xtext.resource.impl.AbstractContainer
          extended by org.eclipse.xtext.resource.containers.DescriptionAddingContainer
All Implemented Interfaces:
IContainer, ISelectable

public class DescriptionAddingContainer
extends AbstractContainer

A container implementation that ensures that a given resource description is part of the container. Delegates any other requests to another container.

Author:
Sebastian Zarnekow - Initial contribution and API

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
DescriptionAddingContainer(IResourceDescription addMe, IContainer delegate)
           
 
Method Summary
 java.lang.Iterable<IEObjectDescription> getExportedObjects(org.eclipse.emf.ecore.EClass type, QualifiedName qualifiedName, boolean ignoreCase)
           
 IResourceDescription getResourceDescription(org.eclipse.emf.common.util.URI uri)
           
 int getResourceDescriptionCount()
           
 java.lang.Iterable<IResourceDescription> getResourceDescriptions()
           
 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.
 
Methods inherited from class org.eclipse.xtext.resource.impl.AbstractContainer
getExportedObjectsByObject, getSelectables
 
Methods inherited from class org.eclipse.xtext.resource.impl.AbstractCompoundSelectable
getExportedObjects, getExportedObjectsByType
 
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, getExportedObjectsByType
 

Constructor Detail

DescriptionAddingContainer

public DescriptionAddingContainer(IResourceDescription addMe,
                                  IContainer delegate)
Parameters:
addMe - the description to be merged into this container. May not be contained in the given delegate.
delegate - the backing container.
Method Detail

getResourceDescriptions

public java.lang.Iterable<IResourceDescription> getResourceDescriptions()
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.

getResourceDescriptionCount

public int getResourceDescriptionCount()
Specified by:
getResourceDescriptionCount in interface IContainer
Overrides:
getResourceDescriptionCount in class AbstractContainer
Returns:
the total number of resource descriptions returned by IContainer.getResourceDescriptions()

hasResourceDescription

public boolean hasResourceDescription(org.eclipse.emf.common.util.URI uri)
Specified by:
hasResourceDescription in interface IContainer
Overrides:
hasResourceDescription in class AbstractContainer
Returns:
true if the container can provide a resource description with the given uri.

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.

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 AbstractCompoundSelectable
Returns:
all elements which match the given qualified name and type. May not be null.

getResourceDescription

public IResourceDescription getResourceDescription(org.eclipse.emf.common.util.URI uri)
Specified by:
getResourceDescription in interface IContainer
Overrides:
getResourceDescription in class AbstractContainer
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.