public abstract class AbstractResourceVariantTree extends Object implements IResourceVariantTree
IResourceVariantTree
that provides the logic for
refreshing the tree and collecting the results so they can be cached locally.
This class does not perform the caching but relies on subclasses to do that by
overriding the setVariant
method. The subclass
ResourceVariantTree
does provide caching.IResourceVariantTree
,
ResourceVariantTree
Constructor and Description |
---|
AbstractResourceVariantTree() |
Modifier and Type | Method and Description |
---|---|
protected IResource[] |
collectChanges(IResource local,
IResourceVariant remote,
int depth,
IProgressMonitor monitor)
Collect the changes in the remote tree to the specified depth.
|
protected IResource[] |
collectedMembers(IResource local,
IResource[] members)
Method that is invoked during collection to let subclasses know which members
were collected for the given resource.
|
protected abstract IResourceVariant[] |
fetchMembers(IResourceVariant variant,
IProgressMonitor progress)
Fetch the members of the given resource variant handle.
|
protected abstract IResourceVariant |
fetchVariant(IResource resource,
int depth,
IProgressMonitor monitor)
Fetch the resource variant corresponding to the given resource.
|
IResource[] |
refresh(IResource[] resources,
int depth,
IProgressMonitor monitor)
Refreshes the resource variant tree for the specified resources and possibly their descendants,
depending on the depth.
|
protected IResource[] |
refresh(IResource resource,
int depth,
IProgressMonitor monitor)
Helper method invoked from
refresh(IResource[], int, IProgressMonitor monitor)
for each resource. |
protected abstract boolean |
setVariant(IResource local,
IResourceVariant remote)
Set the variant associated with the local resource to the newly fetched resource
variant.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flushVariants, getResourceVariant, hasResourceVariant, members, roots
public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException
refresh(IResource, int, IProgressMonitor)
for each resource.
Subclasses may override but should either invoke the above mentioned refresh or
collectChanges
in order to reconcile the resource variant tree.refresh
in interface IResourceVariantTree
resources
- the resources whose variants should be refresheddepth
- the depth of the refresh (one of IResource.DEPTH_ZERO
,
IResource.DEPTH_ONE
, or IResource.DEPTH_INFINITE
)monitor
- a progress monitorTeamException
protected IResource[] refresh(IResource resource, int depth, IProgressMonitor monitor) throws TeamException
refresh(IResource[], int, IProgressMonitor monitor)
for each resource. The default implementation performs the following steps:
getRemoteTree
.
collectChanges
resource
- the resource being refresheddepth
- the depth of the refresh (one of IResource.DEPTH_ZERO
,
IResource.DEPTH_ONE
, or IResource.DEPTH_INFINITE
)monitor
- a progress monitorTeamException
protected IResource[] collectChanges(IResource local, IResourceVariant remote, int depth, IProgressMonitor monitor) throws TeamException
local
- the local resource being refreshedremote
- the corresponding resource variantdepth
- the depth of the refresh (one of IResource.DEPTH_ZERO
,
IResource.DEPTH_ONE
, or IResource.DEPTH_INFINITE
)monitor
- a progress monitorTeamException
protected abstract IResourceVariant[] fetchMembers(IResourceVariant variant, IProgressMonitor progress) throws TeamException
fetchVariant
was called or
may fetch the children directly (i.e. this method may contact the server).variant
- the resource variantprogress
- a progress monitorTeamException
protected abstract IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException
fetchMembers(IResourceVariant, IProgressMonitor)
.resource
- the local resourcedepth
- the depth of the refresh (one of IResource.DEPTH_ZERO
,
IResource.DEPTH_ONE
, or IResource.DEPTH_INFINITE
)monitor
- a progress monitorTeamException
protected IResource[] collectedMembers(IResource local, IResource[] members) throws TeamException
local
- the local resourcemembers
- the collected membersTeamException
protected abstract boolean setVariant(IResource local, IResourceVariant remote) throws TeamException
local
- the local resourceremote
- the newly fetched resource varianttrue
if the resource variant changedTeamException
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.