public class SynchronizationScopeManager extends PlatformObject implements ISynchronizationScopeManager
ResourceMapping
objects
representing a view selection into the complete set of resources to be
operated on.
Here's a summary of the scope generation algorithm:
This implementation does not involve participants in the scope management
process. It is up to subclasses that wish to support a longer life cycle for
scopes to provide for participation. For example, the
SubscriberScopeManager
class includes participates in the scope
management process.
ResourceMapping
,
SubscriberScopeManager
Constructor and Description |
---|
SynchronizationScopeManager(String name,
ResourceMapping[] inputMappings,
ResourceMappingContext resourceMappingContext,
boolean consultModels)
Create a scope manager that uses the given context to
determine what resources should be included in the scope.
|
Modifier and Type | Method and Description |
---|---|
protected ResourceTraversal[] |
addMappingToScope(ResourceMapping mapping,
ResourceTraversal[] traversals)
Add the mapping and its calculated traversals to the scope.
|
protected ResourceTraversal[] |
adjustInputTraversals(ResourceTraversal[] traversals)
Adjust the given set of input resources to include any additional
resources required by a particular repository provider for the current
operation.
|
protected ISynchronizationScope |
createScope(ResourceMapping[] inputMappings)
Create the scope that will be populated and returned by the builder.
|
void |
dispose()
Method to be invoked when the scope of this
manager is no longer needed.
|
ResourceMappingContext |
getContext() |
static ResourceMapping[] |
getMappingsFromProviders(ResourceTraversal[] traversals,
ResourceMappingContext context,
IProgressMonitor monitor)
Convenience method for obtaining the set of resource
mappings from all model providers that overlap
with the given resources.
|
String |
getName()
Returns the human readable name of this manager.
|
ISchedulingRule |
getSchedulingRule()
Return the scheduling rule that is used when initializing and refreshing
the scope.
|
ISynchronizationScope |
getScope()
Return the scope that is managed by this manager.
|
void |
initialize(IProgressMonitor monitor)
Build the scope that is used to determine the complete set of resource
mappings, and hence resources, that an operation should be performed on.
|
boolean |
isInitialized()
Return whether the scope has been initialized.
|
void |
refresh(ResourceMapping[] mappings)
Refresh the given mappings by recalculating the traversals for the
mappings and adjusting the scope accordingly.
|
ResourceTraversal[] |
refresh(ResourceMapping[] mappings,
IProgressMonitor monitor)
Refresh the scope of this manager for the given mappings.
|
protected void |
setHasAdditionalMappings(ISynchronizationScope scope,
boolean hasAdditionalMappings)
Set whether the scope has additional mappings.
|
protected void |
setHasAdditionalResources(boolean hasAdditionalResources)
Set whether the scope has additional resources.
|
getAdapter
public SynchronizationScopeManager(String name, ResourceMapping[] inputMappings, ResourceMappingContext resourceMappingContext, boolean consultModels)
consultModels
is true
then
the model providers will be queried in order to determine if
additional mappings should be included in the scopename
- the name of the scopeinputMappings
- the input mappingsresourceMappingContext
- a resource mapping contextconsultModels
- whether model providers should be consultedpublic static ResourceMapping[] getMappingsFromProviders(ResourceTraversal[] traversals, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException
traversals
- the resource traversalscontext
- the resource mapping contextmonitor
- a progress monitorCoreException
public boolean isInitialized()
ISynchronizationScopeManager
isInitialized
in interface ISynchronizationScopeManager
public ISchedulingRule getSchedulingRule()
public void initialize(IProgressMonitor monitor) throws CoreException
ISynchronizationScopeManager
This method obtains a lock on the workspace root to avoid workspace changes while calculating the scope.
initialize
in interface ISynchronizationScopeManager
monitor
- a progress monitor
when building the scopeCoreException
public ResourceTraversal[] refresh(ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException
ISynchronizationScopeManager
refresh
in interface ISynchronizationScopeManager
mappings
- the mappings to be refreshedmonitor
- a progress monitorCoreException
protected final void setHasAdditionalMappings(ISynchronizationScope scope, boolean hasAdditionalMappings)
hasAdditionalMappings
- a boolean indicating if the scope has
additional mappingsprotected final void setHasAdditionalResources(boolean hasAdditionalResources)
hasAdditionalResources
- a boolean indicating if the scope has
additional resourcesprotected final ISynchronizationScope createScope(ResourceMapping[] inputMappings)
inputMappings
- the input mappingsprotected ResourceTraversal[] adjustInputTraversals(ResourceTraversal[] traversals)
Subclasses may override this method to include additional resources.
traversals
- the input resource traversalsprotected final ResourceTraversal[] addMappingToScope(ResourceMapping mapping, ResourceTraversal[] traversals)
mapping
- the resource mappingtraversals
- the resource mapping's traversalspublic ResourceMappingContext getContext()
public ISynchronizationScope getScope()
ISynchronizationScopeManager
getScope
in interface ISynchronizationScopeManager
public void dispose()
ISynchronizationScopeManager
dispose
in interface ISynchronizationScopeManager
public void refresh(ResourceMapping[] mappings)
mappings
- the mappings to be refreshedpublic String getName()
null
.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.