org.eclipse.xtext.resource.impl
Class LiveShadowedResourceDescriptions

java.lang.Object
  extended by org.eclipse.xtext.resource.impl.AbstractCompoundSelectable
      extended by org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions
          extended by org.eclipse.xtext.resource.impl.LiveShadowedResourceDescriptions
All Implemented Interfaces:
IResourceDescriptions, IResourceDescriptions.IContextAware, ISelectable

public class LiveShadowedResourceDescriptions
extends ResourceSetBasedResourceDescriptions

Since:
2.1
Author:
Jan Koehnlein - Initial contribution and API, Sebastian Zarnekow - Applied implementation pattern from DirtyStateAwareResourceDescriptions, Knut Wannheden - Fixed performance issue caused by the inheritance from ResourceSetBasedResourceDescriptions

The implementation now manages local resources using an injected ResourceSetBasedResourceDescriptions field. The class only inherits from ResourceSetBasedResourceDescriptions to remain backwards compatible with the initial 2.1 release.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.xtext.resource.IResourceDescriptions
IResourceDescriptions.IContextAware, IResourceDescriptions.NullImpl
 
Constructor Summary
LiveShadowedResourceDescriptions()
           
 
Method Summary
 java.lang.Iterable<IResourceDescription> getAllResourceDescriptions()
           
 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)
          Returns the resource descriptions for the given URI.
 org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
           
protected  boolean hasDescription(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.
protected  boolean isExistingOrRenamedResourceURI(org.eclipse.emf.common.util.URI uri)
           
protected  java.lang.Iterable<IEObjectDescription> joinIterables(java.lang.Iterable<IEObjectDescription> liveDescriptions, java.lang.Iterable<IEObjectDescription> persistentDescriptions)
           
 void setContext(org.eclipse.emf.common.notify.Notifier ctx)
           
 
Methods inherited from class org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions
getSelectables, setRegistry, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LiveShadowedResourceDescriptions

public LiveShadowedResourceDescriptions()
Method Detail

setContext

public void setContext(org.eclipse.emf.common.notify.Notifier ctx)
Specified by:
setContext in interface IResourceDescriptions.IContextAware
Overrides:
setContext in class ResourceSetBasedResourceDescriptions

getResourceDescription

public IResourceDescription getResourceDescription(org.eclipse.emf.common.util.URI uri)
Description copied from interface: IResourceDescriptions
Returns the resource descriptions for the given URI. It's the client's responsibility to normalize the URI.

Specified by:
getResourceDescription in interface IResourceDescriptions
Overrides:
getResourceDescription in class ResourceSetBasedResourceDescriptions

getAllResourceDescriptions

public java.lang.Iterable<IResourceDescription> getAllResourceDescriptions()
Specified by:
getAllResourceDescriptions in interface IResourceDescriptions
Overrides:
getAllResourceDescriptions in class ResourceSetBasedResourceDescriptions

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

getResourceSet

public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
Overrides:
getResourceSet in class ResourceSetBasedResourceDescriptions

hasDescription

protected boolean hasDescription(org.eclipse.emf.common.util.URI uri)
Overrides:
hasDescription in class ResourceSetBasedResourceDescriptions

isExistingOrRenamedResourceURI

protected boolean isExistingOrRenamedResourceURI(org.eclipse.emf.common.util.URI uri)

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.

getExportedObjects

public java.lang.Iterable<IEObjectDescription> getExportedObjects(org.eclipse.emf.ecore.EClass type,
                                                                  QualifiedName name,
                                                                  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.

joinIterables

protected java.lang.Iterable<IEObjectDescription> joinIterables(java.lang.Iterable<IEObjectDescription> liveDescriptions,
                                                                java.lang.Iterable<IEObjectDescription> persistentDescriptions)

getExportedObjectsByType

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