org.eclipse.xtext.builder.clustering
Class CurrentDescriptions

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.xtext.builder.clustering.CurrentDescriptions
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal, IResourceDescriptions, ISelectable

public class CurrentDescriptions
extends org.eclipse.emf.common.notify.impl.AdapterImpl
implements IResourceDescriptions

Author:
Sebastian Zarnekow - Initial contribution and API, Thomas Wolf - Performance optimization and JavaDoc

Nested Class Summary
static class CurrentDescriptions.ResourceSetAware
          Context-aware instance of our index.
 
Nested classes/interfaces inherited from interface org.eclipse.xtext.resource.IResourceDescriptions
IResourceDescriptions.IContextAware, IResourceDescriptions.NullImpl
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Constructor Summary
CurrentDescriptions(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, ResourceDescriptionsData newData)
          Create a new index based on an old one.
 
Method Summary
 java.lang.Iterable<IResourceDescription> getAllResourceDescriptions()
          Return the full contents of the index.
 java.lang.Iterable<IEObjectDescription> getExportedObjects()
           
 java.lang.Iterable<IEObjectDescription> getExportedObjects(org.eclipse.emf.ecore.EClass type, QualifiedName name, 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)
          Return the resource description for a URI.
 boolean isAdapterForType(java.lang.Object type)
           
 boolean isEmpty()
          Clients may want to check the selectable to skip its processing in case it is empty.
 void register(IResourceDescription.Delta delta)
          Put a new resource description into the index, or remove one if the delta has no new description.
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, notifyChanged, setTarget, unsetTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrentDescriptions

public CurrentDescriptions(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                           ResourceDescriptionsData newData)
Create a new index based on an old one.

Parameters:
resourceSet - The resource set
oldState - The old index
initiallyDeleted - URIs of resources physically deleted
Method Detail

register

public void register(IResourceDescription.Delta delta)
Put a new resource description into the index, or remove one if the delta has no new description. A delta for a particular URI may be registered more than once; overwriting any earlier registration.

Parameters:
delta - The resource change.

getAllResourceDescriptions

public java.lang.Iterable<IResourceDescription> getAllResourceDescriptions()
Return the full contents of the index.

Specified by:
getAllResourceDescriptions in interface IResourceDescriptions
Returns:
The index' contents.

getResourceDescription

public IResourceDescription getResourceDescription(org.eclipse.emf.common.util.URI uri)
Return the resource description for a URI.

Specified by:
getResourceDescription in interface IResourceDescriptions
Parameters:
uri - The URI
Returns:
The resource description, or null if there is none.

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
Returns:
true if the selectable does not provide any descriptions.

getExportedObjects

public java.lang.Iterable<IEObjectDescription> getExportedObjects()
Specified by:
getExportedObjects in interface ISelectable
Returns:
all exported elements. May not be null.

getExportedObjects

public java.lang.Iterable<IEObjectDescription> getExportedObjects(org.eclipse.emf.ecore.EClass type,
                                                                  QualifiedName name,
                                                                  boolean ignoreCase)
Specified by:
getExportedObjects in interface ISelectable
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 interface ISelectable
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
Returns:
all elements which match the given instance. May not be null.

isAdapterForType

public boolean isAdapterForType(java.lang.Object type)
Specified by:
isAdapterForType in interface org.eclipse.emf.common.notify.Adapter
Overrides:
isAdapterForType in class org.eclipse.emf.common.notify.impl.AdapterImpl
Returns:
true if the given type is class CurrentDescriptions.