Class SynchronizationContext

    • Constructor Detail

      • SynchronizationContext

        protected SynchronizationContext​(ISynchronizationScopeManager manager,
                                         int type,
                                         IResourceDiffTree diffTree)
        Create a synchronization context.
        Parameters:
        manager - the manager that defines the scope of the synchronization
        type - the type of synchronization (ONE_WAY or TWO_WAY)
        diffTree - the sync info tree that contains all out-of-sync resources
    • Method Detail

      • getScope

        public ISynchronizationScope getScope()
        Description copied from interface: ISynchronizationContext
        Return the input that defined the scope of this synchronization context. The input determines the set of resources to which the context applies. Changes in the input may result in changes to the sync-info available in the tree of this context.
        Specified by:
        getScope in interface ISynchronizationContext
        Returns:
        the input that defined the scope of this synchronization context.
      • getScopeManager

        public ISynchronizationScopeManager getScopeManager()
        Return the scope manager for the scope of this context.
        Returns:
        the scope manager for the scope of this context
      • getType

        public int getType()
        Description copied from interface: ISynchronizationContext
        Return the synchronization type. A type of TWO_WAY indicates that the synchronization information associated with the context will also be two-way IDiff instances (i.e. there is only a remote but no base involved in the comparison used to determine the synchronization state of resources. A type of THREE_WAY indicates that the synchronization information will be three-way IThreeWayDiff instances.
        Specified by:
        getType in interface ISynchronizationContext
        Returns:
        the type of synchronization information available in the context
        See Also:
        IDiff, IThreeWayDiff
      • dispose

        public void dispose()
        Description copied from interface: ISynchronizationContext
        Dispose of the synchronization context and the cache of the context. This method should be invoked by clients when the context is no longer needed.
        Specified by:
        dispose in interface ISynchronizationContext
      • getCache

        public ICache getCache()
        Description copied from interface: ISynchronizationContext
        Return the cache associated with this synchronization context. The cache is maintained for the lifetime of this context and is disposed when the the context is disposed. It can be used by clients to cache model state related to the context so that it can be maintained for the life of the operation to which the context applies.
        Specified by:
        getCache in interface ISynchronizationContext
        Returns:
        the cache associated with this synchronization context
      • refresh

        public void refresh​(ResourceMapping[] mappings,
                            IProgressMonitor monitor)
                     throws CoreException
        Description copied from interface: ISynchronizationContext
        Refresh the portion of the context related to the given resource mappings. The provided mappings must be within the scope of this context. Refreshing mappings may result in additional resources being added to the scope of this context. If new resources are included in the scope, a property change event will be fired from the scope. If the synchronization state of any of the resources covered by the mapping change, a change event will be fired from the diff tree of this context.

        Changes to the diff tree may be triggered by a call to this method or by a refresh triggered by some other source. Hence, the callback from the diff tree to report changes may occur in the same thread as the refresh or asynchronously in a separate thread, regardless of who triggered the refresh.

        Specified by:
        refresh in interface ISynchronizationContext
        Parameters:
        mappings - the mappings to be refreshed
        monitor - a progress monitor
        Throws:
        CoreException - if errors occur