org.eclipse.xtext.resource.impl
Class DefaultResourceDescriptionManager

java.lang.Object
  extended by org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager
All Implemented Interfaces:
IResourceDescription.Manager
Direct Known Subclasses:
DerivedStateAwareResourceDescriptionManager

public class DefaultResourceDescriptionManager
extends java.lang.Object
implements IResourceDescription.Manager

Default implementation of the IResourceDescription.Manager. Customize by binding another IDefaultResourceDescriptionStrategy.

Author:
Sebastian Zarnekow - Initial contribution and API, Sven Efftinge, Jan Koehnlein

Constructor Summary
DefaultResourceDescriptionManager()
           
 
Method Summary
protected  void addExportedNames(java.util.Set<QualifiedName> names, IResourceDescription resourceDescriptor)
           
 IResourceDescription.Delta createDelta(IResourceDescription oldDescription, IResourceDescription newDescription)
           
 IResourceScopeCache getCache()
           
 IContainer.Manager getContainerManager()
           
 DescriptionUtils getDescriptionUtils()
           
protected  java.util.Collection<QualifiedName> getImportedNames(IResourceDescription candidate)
           
 IResourceDescription getResourceDescription(org.eclipse.emf.ecore.resource.Resource resource)
           
protected  IResourceDescription internalGetResourceDescription(org.eclipse.emf.ecore.resource.Resource resource, IDefaultResourceDescriptionStrategy strategy)
           
 boolean isAffected(java.util.Collection<IResourceDescription.Delta> deltas, IResourceDescription candidate, IResourceDescriptions context)
          Batch operation to check whether a description is affected by any given delta in the given context.
protected  boolean isAffected(java.util.Collection<QualifiedName> importedNames, IResourceDescription description)
           
 boolean isAffected(IResourceDescription.Delta delta, IResourceDescription candidate)
           
 void setCache(IResourceScopeCache cache)
           
 void setContainerManager(IContainer.Manager containerManager)
           
 void setDescriptionUtils(DescriptionUtils descriptionUtils)
           
 void setStrategy(IDefaultResourceDescriptionStrategy strategy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResourceDescriptionManager

public DefaultResourceDescriptionManager()
Method Detail

getResourceDescription

public IResourceDescription getResourceDescription(org.eclipse.emf.ecore.resource.Resource resource)
Specified by:
getResourceDescription in interface IResourceDescription.Manager
Returns:
a resource description for the given resource. The result represents the current state of the given resource.

createDelta

public IResourceDescription.Delta createDelta(IResourceDescription oldDescription,
                                              IResourceDescription newDescription)
Specified by:
createDelta in interface IResourceDescription.Manager
Returns:
a delta for both given descriptions.

internalGetResourceDescription

protected IResourceDescription internalGetResourceDescription(org.eclipse.emf.ecore.resource.Resource resource,
                                                              IDefaultResourceDescriptionStrategy strategy)

getContainerManager

public IContainer.Manager getContainerManager()

setContainerManager

public void setContainerManager(IContainer.Manager containerManager)

setCache

public void setCache(IResourceScopeCache cache)

getCache

public IResourceScopeCache getCache()

isAffected

public boolean isAffected(IResourceDescription.Delta delta,
                          IResourceDescription candidate)
                   throws java.lang.IllegalArgumentException
Specified by:
isAffected in interface IResourceDescription.Manager
Returns:
whether the candidate is affected by the change in the delta.
Throws:
java.lang.IllegalArgumentException - if this manager is not responsible for the given candidate.

getImportedNames

protected java.util.Collection<QualifiedName> getImportedNames(IResourceDescription candidate)

addExportedNames

protected void addExportedNames(java.util.Set<QualifiedName> names,
                                IResourceDescription resourceDescriptor)

isAffected

public boolean isAffected(java.util.Collection<IResourceDescription.Delta> deltas,
                          IResourceDescription candidate,
                          IResourceDescriptions context)
Description copied from interface: IResourceDescription.Manager
Batch operation to check whether a description is affected by any given delta in the given context. Implementations may perform any optimizations to return false whenever possible, e.g. check the deltas against the visible containers.

Specified by:
isAffected in interface IResourceDescription.Manager
Parameters:
deltas - List of deltas to check. May not be null.
candidate - The description to check. May not be null.
context - The current context of the batch operation. May not be null.
Returns:
whether the condidate is affected by any of the given changes.

isAffected

protected boolean isAffected(java.util.Collection<QualifiedName> importedNames,
                             IResourceDescription description)

getDescriptionUtils

public DescriptionUtils getDescriptionUtils()

setDescriptionUtils

public void setDescriptionUtils(DescriptionUtils descriptionUtils)

setStrategy

public void setStrategy(IDefaultResourceDescriptionStrategy strategy)