Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.team.core.variants
Class AbstractResourceVariantTree

    java.lang.Object
      org.eclipse.team.core.variants.AbstractResourceVariantTree

All Implemented Interfaces:
  IResourceVariantTree

Direct Known Subclasses:
  ResourceVariantTree

public abstract class AbstractResourceVariantTree
extends Object
implements IResourceVariantTree

An implemenation of `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.

Since:
  3.0
See Also:
  `IResourceVariantTree`, `ResourceVariantTree`

Constructor Summary
`AbstractResourceVariantTree()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.team.core.variants.IResourceVariantTree
`flushVariants, getResourceVariant, hasResourceVariant, members, roots`

Constructor Detail

### AbstractResourceVariantTree

    public AbstractResourceVariantTree()

Method Detail

### refresh

    public IResource[] refresh(IResource[] resources,
                               int depth,
                               IProgressMonitor monitor)
                        throws TeamException

  Refreshes the resource variant tree for the specified resources and possibly their descendants, depending on the depth. The default implementation of this method invokes `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.

  Specified by:
    `refresh` in interface `IResourceVariantTree`
  Parameters:
    `resources` - the resources whose variants should be refreshed
    `depth` - the depth of the refresh (one of `IResource.DEPTH_ZERO`, `IResource.DEPTH_ONE`, or `IResource.DEPTH_INFINITE`)
    `monitor` - a progress monitor
  Returns:
    the array of resources whose corresponding varianst have changed
  Throws:
    `TeamException`

### refresh

    protected IResource[] refresh(IResource resource,
                                  int depth,
                                  IProgressMonitor monitor)
                           throws TeamException

  Helper method invoked from `refresh(IResource[], int, IProgressMonitor monitor)` for each resource. The default implementation performs the following steps:
  1. get the resource variant handle corresponding to the local resource by calling `getRemoteTree`.
  2. pass the local resource and the resource variant handle to `collectChanges`
  Subclasses may override but should perform roughly the same steps.

  Parameters:
    `resource` - the resoure being refreshed
    `depth` - the depth of the refresh (one of `IResource.DEPTH_ZERO`, `IResource.DEPTH_ONE`, or `IResource.DEPTH_INFINITE`)
    `monitor` - a progress monitor
  Returns:
    the resource's whose variants have changed
  Throws:
    `TeamException`

### collectChanges

    protected IResource[] collectChanges(IResource local,
                                         IResourceVariant remote,
                                         int depth,
                                         IProgressMonitor monitor)
                                  throws TeamException

  Collect the changes in the remote tree to the specified depth.

  Parameters:
    `local` - the local resource being refreshed
    `remote` - the corresponding resource variant
    `depth` - the depth of the refresh (one of `IResource.DEPTH_ZERO`, `IResource.DEPTH_ONE`, or `IResource.DEPTH_INFINITE`)
    `monitor` - a progress monitor
  Returns:
    the resource's whose variants have changed
  Throws:
    `TeamException`

### fetchMembers

    protected abstract IResourceVariant[] fetchMembers(IResourceVariant variant,
                                                       IProgressMonitor progress)
                                                throws TeamException

  Fetch the members of the given resource variant handle. This method may return members that were fetched when `fetchVariant` was called or may fetch the children directly (i.e. this method may contact the server).

  Parameters:
    `variant` - the resource variant
    `progress` - a progress monitor
  Returns:
    the members of the resource variant.
  Throws:
    `TeamException`

### fetchVariant

    protected abstract IResourceVariant fetchVariant(IResource resource,
                                                     int depth,
                                                     IProgressMonitor monitor)
                                              throws TeamException

  Fetch the resource variant corresponding to the given resource. The depth parameter indicates the depth of the refresh operation and also indicates the depth to which the resource variant's desendants will be traversed. This method may prefetch the descendants to the provided depth or may just return the variant handle corresponding to the given local resource, in which case the descendant variants will be fetched by `fetchMembers(IResourceVariant, IProgressMonitor)`.

  Parameters:
    `resource` - the local resource
    `depth` - the depth of the refresh (one of `IResource.DEPTH_ZERO`, `IResource.DEPTH_ONE`, or `IResource.DEPTH_INFINITE`)
    `monitor` - a progress monitor
  Returns:
    the resource variant corresponding to the given local resource
  Throws:
    `TeamException`

### collectedMembers

    protected IResource[] collectedMembers(IResource local,
                                           IResource[] members)
                                    throws TeamException

  Method that is invoked during collection to let subclasses know which members were collected for the given resource. Implementors should purge any cached state for children of the local resource that are no longer members. Any such resources should be returned to allow clients to clear any state they maintain for those resources.

  Parameters:
    `local` - the local resource
    `members` - the collected members
  Returns:
    any resources that were previously collected whose state has been flushed
  Throws:
    `TeamException`

### setVariant

    protected abstract boolean setVariant(IResource local,
                                          IResourceVariant remote)
                                   throws TeamException

  Set the variant associated with the local resource to the newly fetched resource variant. This method is invoked during change collection and should return whether the variant associated with the local resource has changed

  Parameters:
    `local` - the local resource
    `remote` - the newly fetched resoure variant
  Returns:
    `true` if the resource variant changed
  Throws:
    `TeamException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.