Class ResourceVariantTreeSubscriber
- java.lang.Object
-
- org.eclipse.team.core.subscribers.Subscriber
-
- org.eclipse.team.core.variants.ResourceVariantTreeSubscriber
-
- Direct Known Subclasses:
ThreeWaySubscriber
public abstract class ResourceVariantTreeSubscriber extends Subscriber
A specialization of Subscriber that usesIResourceVariantTree
objects to manage the base (for three-way) and remote trees. Refreshing and obtaining the subscriber members and resource variants is delegated to the resource variant trees.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description ResourceVariantTreeSubscriber()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract IResourceVariantTree
getBaseTree()
Return the base resource variant tree.protected abstract IResourceVariantTree
getRemoteTree()
Return the remote resource variant tree.SyncInfo
getSyncInfo(IResource resource)
Returns synchronization info for the given resource, ornull
if there is no synchronization info because the subscriber does not apply to this resource.protected SyncInfo
getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote)
Method that creates an instance of SyncInfo for the provided local, base and remote resource variants.IResource[]
members(IResource resource)
Returns all non-transient member resources of the given resource.void
refresh(IResource[] resources, int depth, IProgressMonitor monitor)
Refreshes the resource hierarchy from the given resources and their children (to the specified depth) from the corresponding resources in the remote location.-
Methods inherited from class org.eclipse.team.core.subscribers.Subscriber
accept, accept, addListener, collectOutOfSync, fireTeamResourceChange, getDiff, getName, getResourceComparator, getState, isSupervised, refresh, removeListener, roots
-
-
-
-
Method Detail
-
getSyncInfo
public SyncInfo getSyncInfo(IResource resource) throws TeamException
Description copied from class:Subscriber
Returns synchronization info for the given resource, ornull
if there is no synchronization info because the subscriber does not apply to this resource.Note that sync info may be returned for non-existing or for resources which have no corresponding remote resource.
This method will be quick. If synchronization calculation requires content from the server it must be cached when the subscriber is refreshed. A client should call refresh before calling this method to ensure that the latest information is available for computing the sync state.
The sync-info node returned by this method does not fully describe all types of changes. A more descriptive change can be obtained from the
Subscriber.getDiff(IResource)
method.- Specified by:
getSyncInfo
in classSubscriber
- Parameters:
resource
- the resource of interest- Returns:
- sync info
- Throws:
TeamException
- See Also:
Subscriber.getDiff(IResource)
-
getSyncInfo
protected SyncInfo getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote) throws TeamException
Method that creates an instance of SyncInfo for the provided local, base and remote resource variants. Can be overridden by subclasses.- Parameters:
local
- the local resourcebase
- the base resource variant ornull
remote
- the remote resource variant ornull
- Returns:
- the
SyncInfo
containing the provided resources - Throws:
TeamException
-
members
public IResource[] members(IResource resource) throws TeamException
Description copied from class:Subscriber
Returns all non-transient member resources of the given resource. The result will include entries for resources that exist either in the workspace or are implicated in an incoming change. Returns an empty list if the given resource exists neither in the workspace nor in the corresponding subscriber location, or if the given resource is transient.This is a fast operation; the repository is not contacted.
- Specified by:
members
in classSubscriber
- Parameters:
resource
- the resource- Returns:
- a list of member resources
- Throws:
TeamException
-
refresh
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException
Description copied from class:Subscriber
Refreshes the resource hierarchy from the given resources and their children (to the specified depth) from the corresponding resources in the remote location. Resources are ignored in the following cases:- if they do not exist either in the workspace or in the corresponding remote location
- if the given resource is not supervised by this subscriber
- if the given resource is a closed project (they are ineligible for synchronization)
Typical synchronization operations use the statuses computed by this method as the basis for determining what to do. It is possible for the actual sync status of the resource to have changed since the current local sync status was refreshed. Operations typically skip resources with stale sync information. The chances of stale information being used can be reduced by running this method (where feasible) before doing other operations. Note that this will of course affect performance.
The depth parameter controls whether refreshing is performed on just the given resource (depth=
DEPTH_ZERO
), the resource and its children (depth=DEPTH_ONE
), or recursively to the resource and all its descendents (depth=DEPTH_INFINITE
). Use depthDEPTH_ONE
, rather than depthDEPTH_ZERO
, to ensure that new members of a project or folder are detected.This method might change resources; any changes will be reported in a subsequent subscriber resource change event indicating changes to server sync status.
This method contacts the server and is therefore long-running; progress and cancellation are provided by the given progress monitor.
- Specified by:
refresh
in classSubscriber
- Parameters:
resources
- the resourcesdepth
- valid values areDEPTH_ZERO
,DEPTH_ONE
, orDEPTH_INFINITE
monitor
- progress monitor, ornull
if progress reporting and cancellation are not desired- Throws:
TeamException
- if this method fails. Reasons include:- The server could not be contacted.
-
getBaseTree
protected abstract IResourceVariantTree getBaseTree()
Return the base resource variant tree.
-
getRemoteTree
protected abstract IResourceVariantTree getRemoteTree()
Return the remote resource variant tree.
-
-