Class SynchronizationContext
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.team.core.mapping.provider.SynchronizationContext
- All Implemented Interfaces:
IAdaptable,ISynchronizationContext
- Direct Known Subclasses:
MergeContext
public abstract class SynchronizationContext
extends PlatformObject
implements ISynchronizationContext
Abstract implementation of the
ISynchronizationContext interface.
This class can be subclassed by clients.- Since:
- 3.2
- See Also:
-
Field Summary
Fields inherited from interface org.eclipse.team.core.mapping.ISynchronizationContext
THREE_WAY, TWO_WAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSynchronizationContext(ISynchronizationScopeManager manager, int type, IResourceDiffTree diffTree) Create a synchronization context. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Dispose of the synchronization context and the cache of the context.getCache()Return the cache associated with this synchronization context.Return a tree that containsIDiffentries for resources that are out-of-sync.getScope()Return the input that defined the scope of this synchronization context.Return the scope manager for the scope of this context.intgetType()Return the synchronization type.voidrefresh(ResourceMapping[] mappings, IProgressMonitor monitor) Refresh the portion of the context related to the given resource mappings.Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.team.core.mapping.ISynchronizationContext
refresh
-
Constructor Details
-
SynchronizationContext
protected SynchronizationContext(ISynchronizationScopeManager manager, int type, IResourceDiffTree diffTree) Create a synchronization context.- Parameters:
manager- the manager that defines the scope of the synchronizationtype- the type of synchronization (ONE_WAY or TWO_WAY)diffTree- the sync info tree that contains all out-of-sync resources
-
-
Method Details
-
getScope
Description copied from interface:ISynchronizationContextReturn 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:
getScopein interfaceISynchronizationContext- Returns:
- the input that defined the scope of this synchronization context.
-
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:ISynchronizationContextReturn the synchronization type. A type ofTWO_WAYindicates that the synchronization information associated with the context will also be two-wayIDiffinstances (i.e. there is only a remote but no base involved in the comparison used to determine the synchronization state of resources. A type ofTHREE_WAYindicates that the synchronization information will be three-wayIThreeWayDiffinstances.- Specified by:
getTypein interfaceISynchronizationContext- Returns:
- the type of synchronization information available in the context
- See Also:
-
dispose
public void dispose()Description copied from interface:ISynchronizationContextDispose 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:
disposein interfaceISynchronizationContext
-
getCache
Description copied from interface:ISynchronizationContextReturn 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:
getCachein interfaceISynchronizationContext- Returns:
- the cache associated with this synchronization context
-
getDiffTree
Description copied from interface:ISynchronizationContextReturn a tree that containsIDiffentries 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 methodISynchronizationScope.contains(IResource).The returned
IResourceDiffTreewill be homogeneous and contain eitherIResourceDifforIThreeWayDiffinstances. AnyIThreeWayDiffcontained in the returned tree will containIResourceDiffinstances as the local and remote changes. This interface also has several helper methods for handling entries contained in the returned diff tree.- Specified by:
getDiffTreein interfaceISynchronizationContext- Returns:
- a tree that contains an entry for any resources that are out-of-sync.
- See Also:
-
refresh
Description copied from interface:ISynchronizationContextRefresh 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:
refreshin interfaceISynchronizationContext- Parameters:
mappings- the mappings to be refreshedmonitor- a progress monitor- Throws:
CoreException- if errors occur
-