Class LightClusteringBuilderState

  • All Implemented Interfaces:
    IBuilderStateResourceManagement, org.eclipse.xtext.builder.builderState.IBuilderState, org.eclipse.xtext.resource.IResourceDescription.Event.Source, org.eclipse.xtext.resource.IResourceDescriptions, org.eclipse.xtext.resource.ISelectable

    public class LightClusteringBuilderState
    extends org.eclipse.xtext.builder.clustering.ClusteringBuilderState
    implements IBuilderStateResourceManagement
    Lightweight implementation of the ClusteringBuilderState class.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LightClusteringBuilderState.BuilderForkJoinWorkerThread
      Special threads for building EDT files
      • Nested classes/interfaces inherited from interface org.eclipse.xtext.resource.IResourceDescriptions

        org.eclipse.xtext.resource.IResourceDescriptions.IContextAware, org.eclipse.xtext.resource.IResourceDescriptions.IResourceSetAware, org.eclipse.xtext.resource.IResourceDescriptions.NullImpl
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String BUILDING_OPERATION_OPTION
      Special load option key for ResourceSet (see ResourceSet.getLoadOptions()) mark ResourceSet as created in building operation
      • Fields inherited from class org.eclipse.xtext.builder.clustering.ClusteringBuilderState

        RESOURCELOADER_CROSS_LINKING, RESOURCELOADER_GLOBAL_INDEX
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.eclipse.emf.ecore.resource.Resource addResource​(org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.emf.ecore.resource.ResourceSet resourceSet)  
      protected void collectRoughBuildScope​(org.eclipse.core.resources.IProject project, org.eclipse.xtext.resource.impl.ResourceDescriptionsData newData, Set<org.eclipse.emf.common.util.URI> result)
      Collects rough build scope.
      protected Collection<org.eclipse.xtext.resource.IResourceDescription.Delta> doUpdate​(org.eclipse.xtext.builder.impl.BuildData buildData, org.eclipse.xtext.resource.impl.ResourceDescriptionsData newData, org.eclipse.core.runtime.IProgressMonitor monitor)
      We should override this method for adding logic for clearing resources data
      protected void ensureLoaded()  
      void fillResourceSetOptions​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
      Fill ResourceSet load options with BUILDING_OPERATION_OPTION
      ExecutorService getExecutorService​(int processors)
      Gets ExecutorService for paralleling operation.
      int getPermittedThreads()
      Gets number of permitted threads for build
      protected void installSourceLevelURIs​(org.eclipse.xtext.builder.impl.BuildData buildData)  
      void load()  
      void setPermittedThreads​(int permittedThreads)
      Sets number of permitted threads for build
      protected Queue<org.eclipse.xtext.resource.IResourceDescription.Delta> updateNewResourceDescriptions​(Queue<org.eclipse.emf.common.util.URI> allUris, int queueFullSize, org.eclipse.core.resources.IProject currentProject, org.eclipse.emf.ecore.resource.ResourceSet resourceSet, Set<org.eclipse.emf.common.util.URI> toBeDeleted, boolean isIndexingOnly, AtomicInteger[] indexes, org.eclipse.xtext.builder.clustering.CurrentDescriptions newState, org.eclipse.core.runtime.SubMonitor subProgress)
      Updates IResourceDescription for concrete Queue of URIs.
      protected Queue<org.eclipse.xtext.resource.IResourceDescription.Delta> updateNewResourceDescriptionsForQueue​(Queue<org.eclipse.emf.common.util.URI> queue, int fullQueueSize, org.eclipse.core.resources.IProject currentProject, org.eclipse.emf.ecore.resource.ResourceSet resourceSet, Set<org.eclipse.emf.common.util.URI> toBeDeleted, boolean isIndexingOnly, AtomicInteger[] indexes, org.eclipse.xtext.builder.clustering.CurrentDescriptions newState, org.eclipse.core.runtime.SubMonitor subProgress)
      Updates IResourceDescription for concrete Queue of URIs.
      protected void writeNewResourceDescriptions​(org.eclipse.xtext.builder.impl.BuildData buildData, org.eclipse.xtext.resource.IResourceDescriptions oldState, org.eclipse.xtext.builder.clustering.CurrentDescriptions newState, org.eclipse.core.runtime.IProgressMonitor monitor)
      We should override this method for additional processing of the resources.
      • Methods inherited from class org.eclipse.xtext.builder.clustering.ClusteringBuilderState

        clearResourceSet, getBuiltProject, getResourceDescriptionManager, queueAffectedResources
      • Methods inherited from class org.eclipse.xtext.builder.builderState.AbstractBuilderState

        clean, doClean, ensureNotNull, getAllResourceDescriptions, getCopiedResourceDescriptionsData, getExportedObjects, getExportedObjects, getExportedObjectsByObject, getExportedObjectsByType, getResourceDescription, isEmpty, setPersister, setResourceDescriptionsData, update, updateMarkers
      • Methods inherited from class org.eclipse.xtext.resource.impl.AbstractResourceDescriptionChangeEventSource

        addListener, addListeners, notifyListeners, removeListener, removeListeners
      • Methods inherited from interface org.eclipse.xtext.resource.IResourceDescription.Event.Source

        addListener, notifyListeners, removeListener
    • Field Detail

      • BUILDING_OPERATION_OPTION

        public static final String BUILDING_OPERATION_OPTION
        Special load option key for ResourceSet (see ResourceSet.getLoadOptions()) mark ResourceSet as created in building operation
        See Also:
        Constant Field Values
    • Constructor Detail

      • LightClusteringBuilderState

        public LightClusteringBuilderState()
        Constructor
    • Method Detail

      • load

        public void load()
        Overrides:
        load in class org.eclipse.xtext.builder.builderState.AbstractBuilderState
      • fillResourceSetOptions

        public void fillResourceSetOptions​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
        Fill ResourceSet load options with BUILDING_OPERATION_OPTION
        Parameters:
        resourceSet - filling ResourceSet,cannot be null
      • getExecutorService

        public ExecutorService getExecutorService​(int processors)
        Gets ExecutorService for paralleling operation. Creating Thread will have name "LCBuilderState" with index adding
        Parameters:
        processors - number of allowed independent Threads
        Returns:
        ExecutorService for paralleling operation, cannot be null
      • ensureLoaded

        protected void ensureLoaded()
        Overrides:
        ensureLoaded in class org.eclipse.xtext.builder.builderState.AbstractBuilderState
      • installSourceLevelURIs

        protected void installSourceLevelURIs​(org.eclipse.xtext.builder.impl.BuildData buildData)
        Overrides:
        installSourceLevelURIs in class org.eclipse.xtext.builder.clustering.ClusteringBuilderState
      • addResource

        protected org.eclipse.emf.ecore.resource.Resource addResource​(org.eclipse.emf.ecore.resource.Resource resource,
                                                                      org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
        Overrides:
        addResource in class org.eclipse.xtext.builder.clustering.ClusteringBuilderState
      • doUpdate

        protected Collection<org.eclipse.xtext.resource.IResourceDescription.Delta> doUpdate​(org.eclipse.xtext.builder.impl.BuildData buildData,
                                                                                             org.eclipse.xtext.resource.impl.ResourceDescriptionsData newData,
                                                                                             org.eclipse.core.runtime.IProgressMonitor monitor)
        We should override this method for adding logic for clearing resources data
        Overrides:
        doUpdate in class org.eclipse.xtext.builder.clustering.ClusteringBuilderState
      • collectRoughBuildScope

        protected void collectRoughBuildScope​(org.eclipse.core.resources.IProject project,
                                              org.eclipse.xtext.resource.impl.ResourceDescriptionsData newData,
                                              Set<org.eclipse.emf.common.util.URI> result)
        Collects rough build scope. Rough means that it may contain URIs of the resources that do not require building.
        Parameters:
        project - The project that is being built. May be null.
        newData - The new resource descriptions. May not be null.
        result - The result set the URIs will be added to. May not be null.
      • updateNewResourceDescriptions

        protected Queue<org.eclipse.xtext.resource.IResourceDescription.Delta> updateNewResourceDescriptions​(Queue<org.eclipse.emf.common.util.URI> allUris,
                                                                                                             int queueFullSize,
                                                                                                             org.eclipse.core.resources.IProject currentProject,
                                                                                                             org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                                                                                             Set<org.eclipse.emf.common.util.URI> toBeDeleted,
                                                                                                             boolean isIndexingOnly,
                                                                                                             AtomicInteger[] indexes,
                                                                                                             org.eclipse.xtext.builder.clustering.CurrentDescriptions newState,
                                                                                                             org.eclipse.core.runtime.SubMonitor subProgress)
        Updates IResourceDescription for concrete Queue of URIs. Creates IResourceDescription.Delta with information of IResourceDescription updating. This method contains logic for paralleling updating operation for getPermittedThreads() threads
        Parameters:
        allUris - all URIs for update IResourceDescription, cannot be null
        queueFullSize - initial size of the Queue of URIs for updating, need for right update of SubMonitor
        currentProject - actual project for updating IResourceDescription, cannot be null
        resourceSet - actual ResourceSet for creating Resources, cannot be null
        toBeDeleted - set of the URIs which were deleted from project, cannot be null
        isIndexingOnly - true if creating Resources should be create for only index operation
        indexes - special indexes distributed from all threads of updating IResourceDescription.
        • indexes[0] number of IResourceDescription updating in this build
        • indexes[1] number of IResourceDescription updating in this step
        • indexes[2] number of threads updating IResourceDescription
          newState - CurrentDescriptions for getting IResourceDescription by URI, cannot be null
          subProgress - SubMonitor for show progress of operation, cannot be null
          Returns:
          IResourceDescription.Delta with information of IResourceDescription updating, never null
        • updateNewResourceDescriptionsForQueue

          protected Queue<org.eclipse.xtext.resource.IResourceDescription.Delta> updateNewResourceDescriptionsForQueue​(Queue<org.eclipse.emf.common.util.URI> queue,
                                                                                                                       int fullQueueSize,
                                                                                                                       org.eclipse.core.resources.IProject currentProject,
                                                                                                                       org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                                                                                                       Set<org.eclipse.emf.common.util.URI> toBeDeleted,
                                                                                                                       boolean isIndexingOnly,
                                                                                                                       AtomicInteger[] indexes,
                                                                                                                       org.eclipse.xtext.builder.clustering.CurrentDescriptions newState,
                                                                                                                       org.eclipse.core.runtime.SubMonitor subProgress)
          Updates IResourceDescription for concrete Queue of URIs. Creates IResourceDescription.Delta with information of IResourceDescription updating.
          Parameters:
          queue - all URIs for update IResourceDescription, cannot be null
          fullQueueSize - initial size of the Queue of URIs for updating, need for right update of SubMonitor
          currentProject - actual project for updating IResourceDescription, cannot be null
          resourceSet - actual ResourceSet for creating Resources, cannot be null
          toBeDeleted - set of the URIs which were deleted from project, cannot be null
          isIndexingOnly - true if creating Resources should be create for only index operation
          indexes - special indexes distributed from all threads of updating IResourceDescription.
          • indexes[0] number of IResourceDescription updating in this build
          • indexes[1] number of IResourceDescription updating in this step
          • indexes[2] number of threads updating IResourceDescription
            newState - CurrentDescriptions for getting IResourceDescription by URI, cannot be null
            subProgress - SubMonitor for show progress of operation, cannot be null
            Returns:
            IResourceDescription.Delta with information of IResourceDescription updating, never null
          • writeNewResourceDescriptions

            protected void writeNewResourceDescriptions​(org.eclipse.xtext.builder.impl.BuildData buildData,
                                                        org.eclipse.xtext.resource.IResourceDescriptions oldState,
                                                        org.eclipse.xtext.builder.clustering.CurrentDescriptions newState,
                                                        org.eclipse.core.runtime.IProgressMonitor monitor)
            We should override this method for additional processing of the resources. See ILightClusteringBuilderStateCallbackService
            Overrides:
            writeNewResourceDescriptions in class org.eclipse.xtext.builder.clustering.ClusteringBuilderState