Package org.eclipse.team.core.diff
Interface IDiffTree
- All Known Subinterfaces:
IResourceDiffTree
- All Known Implementing Classes:
DiffTree
,ResourceDiffTree
public interface IDiffTree
A diff tree provides access to a tree of
IDiff
instances. For
efficiency reasons, the tree only provides diffs for paths that represent a
change. Paths that do not contain a diff represent but are returned from the
tree will contain child paths in the set.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Property constant used to indicate that a particular path may be involved in an operation.static final int
Property constant used to indicate that a particular path has descendants that are conflicts. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(IPath path, IDiffVisitor visitor, int depth) Accepts the given visitor.void
addDiffChangeListener
(IDiffChangeListener listener) Add a listener to the tree.void
clearBusy
(IProgressMonitor monitor) Clear all busy properties in this tree.long
countFor
(int state, int mask) Return the number of out-of-sync elements in the given set whose synchronization state matches the given mask.IPath[]
getChildren
(IPath parent) Returns the child paths of the given path that either point to a sync delta or have a descendant path that points to a sync delta.Returns the delta identified by the given path, ornull
if there is no delta at that path.boolean
getProperty
(IPath path, int property) Return the value of the property for the given path.boolean
hasMatchingDiffs
(IPath path, FastDiffFilter filter) Return whether the this diff tree contains any diffs that match the given filter at of below the given path.boolean
isEmpty()
Return whether the set is empty.void
removeDiffChangeListener
(IDiffChangeListener listener) Remove the listener from the tree.void
setBusy
(IDiff[] diffs, IProgressMonitor monitor) Set the given diff nodes and all their parents to busyint
size()
Return the number of diffs contained in the tree.
-
Field Details
-
P_BUSY_HINT
static final int P_BUSY_HINTProperty constant used to indicate that a particular path may be involved in an operation.- See Also:
-
P_HAS_DESCENDANT_CONFLICTS
static final int P_HAS_DESCENDANT_CONFLICTSProperty constant used to indicate that a particular path has descendants that are conflicts.- See Also:
-
-
Method Details
-
addDiffChangeListener
Add a listener to the tree. The listener will be informed of any changes in the tree. Registering a listener that is already registered will have no effects.- Parameters:
listener
- the listener to be added
-
removeDiffChangeListener
Remove the listener from the tree. Removing a listener that is not registered has no effect.- Parameters:
listener
- the listener to be removed
-
accept
Accepts the given visitor. The only kinds of deltas visited areADDED
,REMOVED
, andCHANGED
. The visitor'svisit
method is called with the given delta if applicable. If the visitor returnstrue
, any of the delta's children in this tree are also visited.- Parameters:
path
- the path to start the visit in the treevisitor
- the visitordepth
- the depth to visit- See Also:
-
getDiff
Returns the delta identified by the given path, ornull
if there is no delta at that path. The supplied path may be absolute or relative; in either case, it is interpreted as relative to the workspace. Trailing separators are ignored.This method only returns a delta if there is a change at the given path. To know if there are deltas in descendent paths, clients should class
getChildren(IPath)
.- Parameters:
path
- the path of the desired delta- Returns:
- the delta, or
null
if no such delta exists
-
getChildren
Returns the child paths of the given path that either point to a sync delta or have a descendant path that points to a sync delta. Returns an empty array if there are no sync deltas that are descendents of the given path.- Returns:
- the child paths of the given path that either point to a sync delta or have a descendant path that points to a sync delta
-
size
int size()Return the number of diffs contained in the tree.- Returns:
- the number of diffs contained in the tree
-
isEmpty
boolean isEmpty()Return whether the set is empty.- Returns:
- whether the set is empty
-
countFor
long countFor(int state, int mask) Return the number of out-of-sync elements in the given set whose synchronization state matches the given mask. A state of 0 assumes a count of all changes. A mask of 0 assumes a direct match of the given state.For example, this will return the number of outgoing changes in the set:
long outgoing = countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
- Parameters:
state
- the sync statemask
- the sync state mask- Returns:
- the number of matching resources in the set.
-
setBusy
Set the given diff nodes and all their parents to busy- Parameters:
diffs
- the busy diffsmonitor
- a progress monitor ornull
if progress indication is not required
-
getProperty
Return the value of the property for the given path.- Parameters:
path
- the pathproperty
- the property- Returns:
- the value of the property
-
clearBusy
Clear all busy properties in this tree.- Parameters:
monitor
- a progress monitor ornull
if progress indication is not required
-
hasMatchingDiffs
Return whether the this diff tree contains any diffs that match the given filter at of below the given path.- Parameters:
path
- the pathfilter
- the diff node filter- Returns:
- whether the given diff tree contains any deltas that match the given filter
-