Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.team.core.mapping.provider
Class SynchronizationScopeManager


java.lang.Object
  extended by 

org.eclipse.core.runtime.PlatformObject
      extended by 
org.eclipse.team.core.mapping.provider.SynchronizationScopeManager
All Implemented Interfaces:
IAdaptable, ISynchronizationScopeManager
Direct Known Subclasses:
SubscriberScopeManager

public class SynchronizationScopeManager
extends PlatformObject
implements ISynchronizationScopeManager

Class for translating a set of 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:

  1. Obtain selected mappings
  2. Project mappings onto resources using the appropriate context(s) in order to obtain a set of ResourceTraverals
  3. Determine what model providers are interested in the targeted resources
  4. From those model providers, obtain the set of affected resource mappings
  5. If the original set is the same as the new set, we are done.
  6. if the set differs from the original selection, rerun the mapping process for any new mappings
    • Only need to query model providers for mappings for new resources
    • keep repeating until no new mappings or resources are added

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.

Since:
3.2
See Also:
ResourceMapping, SubscriberScopeManager

Constructor Summary
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.
 
Method Summary
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.
 
Methods inherited from class org.eclipse.core.runtime. PlatformObject
getAdapter
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizationScopeManager

public 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. If consultModels is true then the model providers will be queried in order to determine if additional mappings should be included in the scope

Parameters:
name - the name of the scope
inputMappings - the input mappings
resourceMappingContext - a resource mapping context
consultModels - whether model providers should be consulted
Method Detail

getMappingsFromProviders

public static 
ResourceMapping[] getMappingsFromProviders(
ResourceTraversal[] traversals,
                                                         
ResourceMappingContext context,
                                                         
IProgressMonitor monitor)
                                                  throws 
CoreException
Convenience method for obtaining the set of resource mappings from all model providers that overlap with the given resources.

Parameters:
traversals - the resource traversals
context - the resource mapping context
monitor - a progress monitor
Returns:
the resource mappings
Throws:
CoreException

isInitialized

public boolean isInitialized()
Description copied from interface: ISynchronizationScopeManager
Return whether the scope has been initialized.

Specified by:
isInitialized in interface ISynchronizationScopeManager
Returns:
whether the scope has been initialized.

getSchedulingRule

public 
ISchedulingRule getSchedulingRule()
Return the scheduling rule that is used when initializing and refreshing the scope. By default, a rule that covers all projects for the input mappings of the scope is returned. Subclasses may override.

Returns:
the scheduling rule that is used when initializing and refreshing the scope

initialize

public void initialize(
IProgressMonitor monitor)
                throws 
CoreException
Description copied from interface: ISynchronizationScopeManager
Build the scope that is used to determine the complete set of resource mappings, and hence resources, that an operation should be performed on.

This method obtains a lock on the workspace root to avoid workspace changes while calculating the scope.

Specified by:
initialize in interface ISynchronizationScopeManager
Parameters:
monitor - a progress monitor when building the scope
Throws:
CoreException

refresh

public 
ResourceTraversal[] refresh(
ResourceMapping[] mappings,
                                   
IProgressMonitor monitor)
                            throws 
CoreException
Description copied from interface: ISynchronizationScopeManager
Refresh the scope of this manager for the given mappings. Changes in the scope will be reported as a property change event fired from the scope. Clients should call this method when a change in the workspace or a change issued from this manager have resulted in a change in the resources that should be included in the scope.

Specified by:
refresh in interface ISynchronizationScopeManager
Parameters:
mappings - the mappings to be refreshed
monitor - a progress monitor
Returns:
a set of traversals that cover the given mappings
Throws:
CoreException

setHasAdditionalMappings

protected final void setHasAdditionalMappings(
ISynchronizationScope scope,
                                              boolean hasAdditionalMappings)
set whether the scope has additional mappings. This method is not intended to be overridden.

Parameters:
hasAdditionalMappings - a boolean indicating if the scope has additional mappings

setHasAdditionalResources

protected final void setHasAdditionalResources(boolean hasAdditionalResources)
set whether the scope has additional resources. This method is not intended to be overridden.

Parameters:
hasAdditionalResources - a boolean indicating if the scope has additional resources

createScope

protected final 
ISynchronizationScope createScope(
ResourceMapping[] inputMappings)
Create the scope that will be populated and returned by the builder. This method is not intended to be overridden by clients.

Parameters:
inputMappings - the input mappings
Returns:
a newly created scope that will be populated and returned by the builder

adjustInputTraversals

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. By default the original set is returned but subclasses may override. Overriding methods should return a set of resources that include the original resource either explicitly or implicitly as a child of a returned resource.

Subclasses may override this method to include additional resources

Parameters:
traversals - the input resource traversals
Returns:
the input resource traversals adjusted to include any additional resources required for the current operation

addMappingToScope

protected final 
ResourceTraversal[] addMappingToScope(
ResourceMapping mapping,
                                                      
ResourceTraversal[] traversals)
Add the mapping and its calculated traversals to the scope. Return the resources that were not previously covered by the scope. This method is not intended to be subclassed by clients.

Parameters:
mapping - the resource mapping
traversals - the resource mapping's traversals
Returns:
the resource traversals that were not previously covered by the scope

getContext

public 
ResourceMappingContext getContext()

getScope

public 
ISynchronizationScope getScope()
Description copied from interface: ISynchronizationScopeManager
Return the scope that is managed by this manager.

Specified by:
getScope in interface ISynchronizationScopeManager
Returns:
the scope that is managed by this manager

dispose

public void dispose()
Description copied from interface: ISynchronizationScopeManager
Method to be invoked when the scope of this manager is no longer needed. It is typically the responsibility of the client that creates a scope manager to dispose of it.

Specified by:
dispose in interface ISynchronizationScopeManager

refresh

public void refresh(
ResourceMapping[] mappings)
Refresh the given mappings by recalculating the traversals for the mappings and adjusting the scope accordingly.

Parameters:
mappings - the mappings to be refreshed

getName

public 
String getName()
Returns the human readable name of this manager. The name is never null.

Returns:
the name associated with this scope manager

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire