Interface ISynchronizationScope


  • public interface ISynchronizationScope
    Interface which defines the protocol for translating a set of ResourceMapping objects representing a view selection into the complete set of resources to be operated on.
    Since:
    3.2
    See Also:
    ResourceMapping, ISynchronizationScopeManager
    Restriction:
    This interface is not intended to be implemented by clients. Instead, clients should use a ISynchronizationScopeManager to generate a resource mapping scope from a set of input resource mappings.
    • Method Detail

      • getProjects

        IProject[] getProjects()
        Return the projects that bound this scope. The projects returned will depend on the type of context used to generate this scope. If the context is a local context, all workspace projects are returned. If it is a remote context, the projects are the same as those returned from RemoteResourceMappingContext.getProjects()
        Returns:
        the projects that bound this scope
      • getInputMappings

        ResourceMapping[] getInputMappings()
        Return the array of mappings that acted as the input to the scope builder that was used to build this scope. This set usually come from a view selection but could come from another source. In most cases, clients will want to call the getMappings() method instead of this one as it returns the complete set of mappings to be operated on.
        Returns:
        the set of mappings that acted as the input to the scope builder that was used to build this scope
      • asInputScope

        ISynchronizationScope asInputScope()
        Return a scope that only contains the input mappings of this scope.
        Returns:
        a scope that only contains the input mappings of this scope
      • getMappings

        ResourceMapping[] getMappings()
        Return an array of all of the mappings to be operated on. The returned mappings were included in the operation during the scope building process. The returned mappings may be the same as the input mappings but may also be a super set. Clients can call the hasAdditionalMappings() method to determine if the two sets are the same or not.
        Returns:
        an array of all of the mappings to be operated on.
      • getTraversals

        ResourceTraversal[] getTraversals()
        Return an array of traversals that cover the resource mappings to be operated on as returned by the getMappings() method. The traversals were calculated during the scope building process and cached with the scope.
        Returns:
        the complete set of mappings to be operated on
      • getRoots

        IResource[] getRoots()
        Return the resources that are the roots of this scope. The roots are determined by collecting the roots of the traversals that define this scope.
        Returns:
        the resources that are the roots of this scope
      • contains

        boolean contains​(IResource resource)
        Return whether the given resource is contained in this scope. A resource is contained by the scope if it is contained in at least one of the traversals that define this scope.
        Parameters:
        resource - the resource to be tested
        Returns:
        whether the given resource is contained in this scope
      • addScopeChangeListener

        void addScopeChangeListener​(ISynchronizationScopeChangeListener listener)
        Add a scope change listener that will get invoked when a property of the receiver changes. Adding a listener that is already added has no effect.
        Parameters:
        listener - the listener to be added
      • removeScopeChangeListener

        void removeScopeChangeListener​(ISynchronizationScopeChangeListener listener)
        Remove a scope change listener. Removing an unregistered listener has no effect.
        Parameters:
        listener - the listener to be removed
      • getTraversals

        ResourceTraversal[] getTraversals​(ResourceMapping mapping)
        Return an array of traversals that cover the given resource mapping to be operated on. The traversals were calculated during the scope building process and cached with the scope.
        Parameters:
        mapping - a resource mapping being operated on
        Returns:
        the traversals that cover the given resource mapping (or null if the mapping is not contained in the input)
      • hasAdditionalMappings

        boolean hasAdditionalMappings()
        Return whether the scope has additional mappings added to the input mappings during the scope building process.
        Returns:
        whether the input has additional mappings added to the seed mappings
      • hasAdditonalResources

        boolean hasAdditonalResources()
        Return whether the scope has additional resources added due to additional resource mappings.
        Returns:
        whether the input has additional resources added due to additional resource mappings
      • getModelProviders

        ModelProvider[] getModelProviders()
        Return all the model providers that have mappings in this scope.
        Returns:
        all the model providers that have mappings in this scope
      • getMappings

        ResourceMapping[] getMappings​(String modelProviderId)
        Return all the mappings to be operated on for the given model provider id.
        Parameters:
        modelProviderId - the id of the model provider
        Returns:
        all the mappings for the given model provider id
      • getTraversals

        ResourceTraversal[] getTraversals​(String modelProviderId)
        Return the set of traversals that cover the mappings for the given model provider.
        Parameters:
        modelProviderId - the model provider id
        Returns:
        the set of traversals that cover the mappings for the given model provider
      • getMapping

        ResourceMapping getMapping​(Object modelObject)
        Return the resource mapping in the scope associated with the given model object or null if there isn't one. This method has no knowledge of hierarchical models so it only matches directly against the mappings that are contained in the scope.
        Parameters:
        modelObject - the model object
        Returns:
        the mapping for the model object that is contained in this scope
      • refresh

        void refresh​(ResourceMapping[] mappings)
        Refresh the given mapping asynchronously. This method is called by ISynchronizationScopeParticipant instances when they detect changes that require the scope to be adjusted.
        Parameters:
        mappings - the mappings to be refreshed.