public interface ISynchronizationContext
The scope of the context is defined when the context is created. The creator of the scope may affect changes on the scope which will result in property change events from the scope and may result in change events from the diff tree. Clients should note that it is possible that a change in the scope will result in new resources with differences being covered by the scope but not result in a change event from the diff tree. This can occur because the set may already have contained a diff for the resource with the understanding that the client would have ignored it. Consequently, clients should listen to both sources in order to guarantee that they update any dependent state appropriately.
The diff tree associated with this context may be updated
asynchronously in response to calls to any method of this context (e.g.
refresh methods) that may result in changes in the synchronization state of
resources. It may also get updated as a result of changes triggered from
other sources. Hence, the callback from the diff tree to report changes may
occur in the same thread as the method call or asynchronously in a separate
thread, regardless of who triggered the refresh. Clients of this method (and
any other asynchronous method on this context) may determine if all changes
have been collected using IJobManager.find(Object)
using this context
as the family
argument in order to determine if there are any
jobs running that are populating the diff tree. Clients may also call
IJobManager.join(Object, IProgressMonitor)
if they wish to wait until
all background handlers related to this context are finished.
SynchronizationContext
,
MergeContext
SynchronizationContext
or one of
its subclasses instead.Modifier and Type | Field and Description |
---|---|
static int |
THREE_WAY
Synchronization type constant that indicates that
context is a three-way synchronization.
|
static int |
TWO_WAY
Synchronization type constant that indicates that
context is a two-way synchronization.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Dispose of the synchronization context and the cache of the context.
|
ICache |
getCache()
Return the cache associated with this synchronization context.
|
IResourceDiffTree |
getDiffTree()
Return a tree that contains
IDiff entries for resources that
are out-of-sync. |
ISynchronizationScope |
getScope()
Return the input that defined the scope of this synchronization context.
|
int |
getType()
Return the synchronization type.
|
void |
refresh(ResourceMapping[] mappings,
IProgressMonitor monitor)
Refresh the portion of the context related to the given resource
mappings.
|
void |
refresh(ResourceTraversal[] traversals,
int flags,
IProgressMonitor monitor)
Refresh the context in order to update the diff tree returned by
getDiffTree() to include the latest synchronization state for
the resources. |
static final int TWO_WAY
static final int THREE_WAY
ISynchronizationScope getScope()
IResourceDiffTree getDiffTree()
IDiff
entries for resources that
are out-of-sync. The tree will contain entries for any out-of-sync
resources that are within the scope of this context. The tree may include
entries for additional resources, which should be ignored by the client.
Clients can test for inclusion using the method
ISynchronizationScope.contains(IResource)
.
The returned IResourceDiffTree
will be homogeneous and contain either
IResourceDiff
or IThreeWayDiff
instances. Any
IThreeWayDiff
contained in the returned tree will contain
IResourceDiff
instances as the local and remote changes. This
interface also has several helper methods for handling entries contained in
the returned diff tree.
IResourceDiffTree.getDiffs(ResourceTraversal[])
,
IResourceDiffTree.getResource(IDiff)
int getType()
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.IDiff
,
IThreeWayDiff
ICache getCache()
void dispose()
void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException
getDiffTree()
to include the latest synchronization state for
the resources. Any changes will be reported through the change listeners
registered with 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.
traversals
- the resource traversals which indicate which resources are to
be refreshedflags
- additional refresh behavior. For instance, if
RemoteResourceMappingContext.FILE_CONTENTS_REQUIRED
is one of the flags, this indicates that the client will be
accessing the contents of the files covered by the traversals.
NONE
should be used when no additional behavior
is requiredmonitor
- a progress monitor, or null
if progress
reporting is not desiredCoreException
- if the refresh fails. Reasons include:
getDiffTree()
,
IDiffTree.addDiffChangeListener(IDiffChangeListener)
void refresh(ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException
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.
mappings
- the mappings to be refreshedmonitor
- a progress monitorCoreException
- if errors occur
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.