Package org.eclipse.team.core.variants
Class ResourceVariantTree
java.lang.Object
org.eclipse.team.core.variants.AbstractResourceVariantTree
org.eclipse.team.core.variants.ResourceVariantTree
- All Implemented Interfaces:
IResourceVariantTree
- Direct Known Subclasses:
ThreeWayRemoteTree
Provides caching for a
AbstractResourceVariantTree using a
ResourceVariantByteStore.- Since:
- 3.0
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate a resource variant tree that uses the provided byte store to cache the resource variant bytes. -
Method Summary
Modifier and TypeMethodDescriptionprotected IResource[]collectChanges(IResource local, IResourceVariant remote, int depth, IProgressMonitor monitor) Collect the changes in the remote tree to the specified depth.voidflushVariants(IResource resource, int depth) Flush any variants in the tree for the given resource to the depth specified.protected byte[]getBytes(IResource local, IResourceVariant remote) Get the bytes to be stored in theResourceVariantByteStorefrom the given resource variant.protected ResourceVariantByteStoreGet the byte store that is used to cache the serialization bytes for the resource variants of this tree.booleanhasResourceVariant(IResource resource) Return whether the local resource has a variant in this tree.Returns the members of the local resource that have resource variants in this tree.protected booleansetVariant(IResource local, IResourceVariant remote) Set the variant associated with the local resource to the newly fetched resource variant.Methods inherited from class org.eclipse.team.core.variants.AbstractResourceVariantTree
collectedMembers, fetchMembers, fetchVariant, refresh, refreshMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.team.core.variants.IResourceVariantTree
getResourceVariant, roots
-
Constructor Details
-
ResourceVariantTree
Create a resource variant tree that uses the provided byte store to cache the resource variant bytes.- Parameters:
store- the resource variant byte store used to cache resource variants
-
-
Method Details
-
members
Description copied from interface:IResourceVariantTreeReturns the members of the local resource that have resource variants in this tree. The members may or may not exist locally. The resource variants corresponding to the members can be retrieved usinggetResourceVariant(IResource).- Parameters:
resource- the local resource- Returns:
- the members of the local resource for which this tree contains resource variants
- Throws:
TeamException- if an error occurs
-
hasResourceVariant
Description copied from interface:IResourceVariantTreeReturn whether the local resource has a variant in this tree.- Parameters:
resource- the local resource- Returns:
trueif the tree contains a variant for the resource- Throws:
TeamException- if an error occurs
-
flushVariants
Description copied from interface:IResourceVariantTreeFlush any variants in the tree for the given resource to the depth specified.- Parameters:
resource- the resourcedepth- the flush depth (one ofIResource.DEPTH_ZERO,IResource.DEPTH_ONE, orIResource.DEPTH_INFINITE)- Throws:
TeamException- if an error occurs
-
setVariant
Description copied from class:AbstractResourceVariantTreeSet 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- Specified by:
setVariantin classAbstractResourceVariantTree- Parameters:
local- the local resourceremote- the newly fetched resource variant- Returns:
trueif the resource variant changed- Throws:
TeamException- if an error occurs
-
getByteStore
Get the byte store that is used to cache the serialization bytes for the resource variants of this tree. A byte store is used to reduce the memory footprint of the tree.This method is not intended to be overridden by subclasses.
- Returns:
- the resource variant tree that is being refreshed.
-
getBytes
Get the bytes to be stored in theResourceVariantByteStorefrom the given resource variant. By default, theIResourceVariant#asBytes()method is used to get the bytes.- Parameters:
local- the local resourceremote- the corresponding resource variant handle- Returns:
- the bytes for the resource variant.
- Throws:
TeamException
-
collectChanges
protected IResource[] collectChanges(IResource local, IResourceVariant remote, int depth, IProgressMonitor monitor) throws TeamException Description copied from class:AbstractResourceVariantTreeCollect the changes in the remote tree to the specified depth.- Overrides:
collectChangesin classAbstractResourceVariantTree- Parameters:
local- the local resource being refreshedremote- the corresponding resource variantdepth- the depth of the refresh (one ofIResource.DEPTH_ZERO,IResource.DEPTH_ONE, orIResource.DEPTH_INFINITE)monitor- a progress monitor- Returns:
- the resource's whose variants have changed
- Throws:
TeamException- if an error occurs
-