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
ModifierConstructorDescriptionprotected
Create 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.void
flushVariants
(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 theResourceVariantByteStore
from the given resource variant.protected ResourceVariantByteStore
Get the byte store that is used to cache the serialization bytes for the resource variants of this tree.boolean
hasResourceVariant
(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 boolean
setVariant
(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, refresh
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
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:IResourceVariantTree
Returns 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:IResourceVariantTree
Return whether the local resource has a variant in this tree.- Parameters:
resource
- the local resource- Returns:
true
if the tree contains a variant for the resource- Throws:
TeamException
- if an error occurs
-
flushVariants
Description copied from interface:IResourceVariantTree
Flush 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:AbstractResourceVariantTree
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- Specified by:
setVariant
in classAbstractResourceVariantTree
- Parameters:
local
- the local resourceremote
- the newly fetched resource variant- Returns:
true
if 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 theResourceVariantByteStore
from 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:AbstractResourceVariantTree
Collect the changes in the remote tree to the specified depth.- Overrides:
collectChanges
in 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
-