org.eclipse.xtext.builder.clustering
Class ClusteringBuilderState

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

public class ClusteringBuilderState
extends AbstractBuilderState

Author:
Sebastian Zarnekow - Initial contribution and API, Thomas Wolf - Refactored the build phases and documentation, Lieven Lemiengre - Parallel resource loading

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.xtext.resource.IResourceDescriptions
IResourceDescriptions.IContextAware, IResourceDescriptions.NullImpl
 
Field Summary
static java.lang.String RESOURCELOADER_CROSS_LINKING
           
static java.lang.String RESOURCELOADER_GLOBAL_INDEX
           
 
Constructor Summary
ClusteringBuilderState()
           
 
Method Summary
protected  org.eclipse.emf.ecore.resource.Resource addResource(org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Adds a resource to the ResourceSet if the ResourceSet doesn't contain it yet.
protected  void clearResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Clears the content of the resource set without sending notifications.
protected  java.util.Collection<IResourceDescription.Delta> doUpdate(BuildData buildData, ResourceDescriptionsData newData, org.eclipse.core.runtime.IProgressMonitor monitor)
          Actually do the build.
protected  org.eclipse.core.resources.IProject getBuiltProject(BuildData buildData)
           
protected  IResourceDescription.Manager getResourceDescriptionManager(org.eclipse.emf.common.util.URI uri)
           
protected  void queueAffectedResources(java.util.Set<org.eclipse.emf.common.util.URI> allRemainingURIs, IResourceDescriptions oldState, CurrentDescriptions newState, java.util.Collection<IResourceDescription.Delta> deltas, BuildData buildData, org.eclipse.core.runtime.IProgressMonitor monitor)
          Put all resources that depend on some changes onto the queue of resources to be processed.
protected  void writeNewResourceDescriptions(BuildData buildData, IResourceDescriptions oldState, CurrentDescriptions newState, org.eclipse.core.runtime.IProgressMonitor monitor)
          Create new resource descriptions for a set of resources given by their URIs.
 
Methods inherited from class org.eclipse.xtext.builder.builderState.AbstractBuilderState
clean, doClean, ensureLoaded, ensureNotNull, getAllResourceDescriptions, getCopiedResourceDescriptionsData, getExportedObjects, getExportedObjects, getExportedObjectsByObject, getExportedObjectsByType, getResourceDescription, isEmpty, load, setPersister, setResourceDescriptionsData, update, updateMarkers
 
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
 

Field Detail

RESOURCELOADER_CROSS_LINKING

public static final java.lang.String RESOURCELOADER_CROSS_LINKING
See Also:
Constant Field Values

RESOURCELOADER_GLOBAL_INDEX

public static final java.lang.String RESOURCELOADER_GLOBAL_INDEX
See Also:
Constant Field Values
Constructor Detail

ClusteringBuilderState

public ClusteringBuilderState()
Method Detail

doUpdate

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

Specified by:
doUpdate in class AbstractBuilderState
Parameters:
buildData - the data that should be considered for the update
newData - the new resource descriptions as they are to be persisted (the new index after the build). Initially contains the old resource descriptions.
monitor - The progress monitor
Returns:
A list of deltas describing all changes made by the build.

writeNewResourceDescriptions

protected void writeNewResourceDescriptions(BuildData buildData,
                                            IResourceDescriptions oldState,
                                            CurrentDescriptions newState,
                                            org.eclipse.core.runtime.IProgressMonitor monitor)
Create new resource descriptions for a set of resources given by their URIs.

Parameters:
buildData - The underlying data for the write operation.
oldState - The old index
newState - The new index
monitor - The progress monitor used for user feedback

getBuiltProject

protected org.eclipse.core.resources.IProject getBuiltProject(BuildData buildData)

clearResourceSet

protected void clearResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Clears the content of the resource set without sending notifications. This avoids unnecessary, explicit unloads.


addResource

protected org.eclipse.emf.ecore.resource.Resource addResource(org.eclipse.emf.ecore.resource.Resource resource,
                                                              org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Adds a resource to the ResourceSet if the ResourceSet doesn't contain it yet.

Parameters:
resource - the resource
resourceSet - the resource set
Returns:
the resource

queueAffectedResources

protected void queueAffectedResources(java.util.Set<org.eclipse.emf.common.util.URI> allRemainingURIs,
                                      IResourceDescriptions oldState,
                                      CurrentDescriptions newState,
                                      java.util.Collection<IResourceDescription.Delta> deltas,
                                      BuildData buildData,
                                      org.eclipse.core.runtime.IProgressMonitor monitor)
Put all resources that depend on some changes onto the queue of resources to be processed. Updates notInDelta by removing all URIs put into the queue.

Parameters:
allRemainingURIs - URIs that were not considered by prior operations.
oldState - State before the build
newState - The current state
deltas - The changes
buildData - the underlying data for this build run.
monitor - The progress monitor used for user feedback

getResourceDescriptionManager

protected IResourceDescription.Manager getResourceDescriptionManager(org.eclipse.emf.common.util.URI uri)