org.eclipse.xtext.builder.builderState
Class AbstractBuilderState

java.lang.Object
  extended by org.eclipse.xtext.resource.impl.AbstractResourceDescriptionChangeEventSource
      extended by org.eclipse.xtext.builder.builderState.AbstractBuilderState
All Implemented Interfaces:
IBuilderState, IResourceDescription.Event.Source, IResourceDescriptions, ISelectable
Direct Known Subclasses:
ClusteringBuilderState

public abstract class AbstractBuilderState
extends AbstractResourceDescriptionChangeEventSource
implements IBuilderState

Author:
Sebastian Zarnekow - Initial contribution and API, Knut Wannheden

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.xtext.resource.IResourceDescriptions
IResourceDescriptions.IContextAware, IResourceDescriptions.NullImpl
 
Constructor Summary
AbstractBuilderState()
           
 
Method Summary
 com.google.common.collect.ImmutableList<IResourceDescription.Delta> clean(java.util.Set<org.eclipse.emf.common.util.URI> toBeRemoved, org.eclipse.core.runtime.IProgressMonitor monitor)
          Remove the descriptions for the given resource-uris from the IResourceDescriptions.
protected  java.util.Collection<IResourceDescription.Delta> doClean(java.util.Set<org.eclipse.emf.common.util.URI> toBeRemoved, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected abstract  java.util.Collection<IResourceDescription.Delta> doUpdate(BuildData buildData, ResourceDescriptionsData newData, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  void ensureLoaded()
           
protected  java.util.Set<org.eclipse.emf.common.util.URI> ensureNotNull(java.util.Set<org.eclipse.emf.common.util.URI> uris)
           
 java.lang.Iterable<IResourceDescription> getAllResourceDescriptions()
           
protected  ResourceDescriptionsData getCopiedResourceDescriptionsData()
           
 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.
 boolean isEmpty()
          Clients may want to check the selectable to skip its processing in case it is empty.
 void load()
           
 void setPersister(PersistedStateProvider persister)
           
protected  void setResourceDescriptionsData(ResourceDescriptionsData newData)
           
 com.google.common.collect.ImmutableList<IResourceDescription.Delta> update(BuildData buildData, org.eclipse.core.runtime.IProgressMonitor monitor)
          Updated the underlying IResourceDescriptions according to the passed URIs.
protected  void updateMarkers(IResourceDescription.Delta delta, org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.core.runtime.IProgressMonitor monitor)
           
 
Methods inherited from class org.eclipse.xtext.resource.impl.AbstractResourceDescriptionChangeEventSource
addListener, addListeners, notifyListeners, removeListener, removeListeners
 
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.IResourceDescription.Event.Source
addListener, removeListener
 

Constructor Detail

AbstractBuilderState

public AbstractBuilderState()
Method Detail

load

public void load()

ensureLoaded

protected void ensureLoaded()

ensureNotNull

protected java.util.Set<org.eclipse.emf.common.util.URI> ensureNotNull(java.util.Set<org.eclipse.emf.common.util.URI> uris)

setResourceDescriptionsData

protected void setResourceDescriptionsData(ResourceDescriptionsData newData)

updateMarkers

protected void updateMarkers(IResourceDescription.Delta delta,
                             org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                             org.eclipse.core.runtime.IProgressMonitor monitor)

getCopiedResourceDescriptionsData

protected ResourceDescriptionsData getCopiedResourceDescriptionsData()

getAllResourceDescriptions

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

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

setPersister

public void setPersister(PersistedStateProvider persister)

update

public com.google.common.collect.ImmutableList<IResourceDescription.Delta> update(BuildData buildData,
                                                                                  org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface: IBuilderState
Updated the underlying IResourceDescriptions according to the passed URIs. It updates transitively affected IResourceDescription as well. The change to the underlying IResourceDescriptions is guaranteed to be atomic.

Specified by:
update in interface IBuilderState
Parameters:
buildData - the underlying data for the update.
monitor - the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done() on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot be canceled.
Returns:
a list of changes in the form of deltas.

doUpdate

protected abstract java.util.Collection<IResourceDescription.Delta> doUpdate(BuildData buildData,
                                                                             ResourceDescriptionsData newData,
                                                                             org.eclipse.core.runtime.IProgressMonitor monitor)

clean

public com.google.common.collect.ImmutableList<IResourceDescription.Delta> clean(java.util.Set<org.eclipse.emf.common.util.URI> toBeRemoved,
                                                                                 org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface: IBuilderState
Remove the descriptions for the given resource-uris from the IResourceDescriptions. The clean-operation is not transitive. The change to the underlying IResourceDescriptions is guaranteed to be atomic.

Specified by:
clean in interface IBuilderState
Parameters:
toBeRemoved - the uris or the cleaned resources.
monitor - the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done() on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot be canceled.
Returns:
a list of changes in the form of deltas.

doClean

protected java.util.Collection<IResourceDescription.Delta> doClean(java.util.Set<org.eclipse.emf.common.util.URI> toBeRemoved,
                                                                   org.eclipse.core.runtime.IProgressMonitor monitor)

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.

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.