Modifier and Type | Field and Description |
---|---|
static int |
START_CLIENT_PROPERTY_RANGE
Constant that indicates the start of the property value
range that clients can use when storing properties in this tree.
|
P_BUSY_HINT, P_HAS_DESCENDANT_CONFLICTS
Constructor and Description |
---|
DiffTree()
Create an empty diff tree.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(IPath path,
IDiffVisitor visitor,
int depth)
Accepts the given visitor.
|
void |
add(IDiff delta)
Add the given
IDiff to the tree. |
void |
addDiffChangeListener(IDiffChangeListener listener)
Add a listener to the tree.
|
void |
beginInput()
This method is used to obtain a lock on the set which ensures thread safety
and batches change notification.
|
void |
clear()
Clear the contents of the set
|
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.
|
void |
endInput(IProgressMonitor monitor)
This method is used to release the lock on this set.
|
IPath[] |
getChildren(IPath 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.
|
IDiff |
getDiff(IPath path)
Returns the delta identified by the given path,
or
null if there is no delta at that path. |
IDiff[] |
getDiffs()
Return all the diffs contained in this diff tree.
|
IPath[] |
getPaths()
Return the paths in this tree that contain diffs.
|
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 |
remove(IPath path)
Remove the given local resource from the set.
|
void |
removeDiffChangeListener(IDiffChangeListener listener)
Remove the listener from the tree.
|
void |
reportError(IStatus status)
Report to any listeners that an error has occurred while populating the
set.
|
void |
setBusy(IDiff[] diffs,
IProgressMonitor monitor)
Set the given diff nodes and all their parents to busy
|
void |
setPropertyToRoot(IDiff node,
int property,
boolean value) |
int |
size()
Return the number of diffs contained in the tree.
|
public static final int START_CLIENT_PROPERTY_RANGE
public void addDiffChangeListener(IDiffChangeListener listener)
IDiffTree
addDiffChangeListener
in interface IDiffTree
listener
- the listener to be addedpublic void removeDiffChangeListener(IDiffChangeListener listener)
IDiffTree
removeDiffChangeListener
in interface IDiffTree
listener
- the listener to be removedpublic void accept(IPath path, IDiffVisitor visitor, int depth)
IDiffTree
ADDED
, REMOVED
, and CHANGED
.
The visitor's visit
method is called with the given delta
if applicable. If the visitor returns true
, any of the
delta's children in this tree are also visited.accept
in interface IDiffTree
path
- the path to start the visit in the treevisitor
- the visitordepth
- the depth to visitIDiffVisitor.visit(IDiff)
public IDiff getDiff(IPath path)
IDiffTree
null
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 IDiffTree.getChildren(IPath)
.
public IPath[] getChildren(IPath path)
IDiffTree
getChildren
in interface IDiffTree
public boolean isEmpty()
IDiffTree
public void add(IDiff delta)
IDiff
to the tree. A change event will
be generated unless the call to this method is nested in between calls
to beginInput()
and endInput(IProgressMonitor)
in which case the event for this addition and any other sync set
change will be fired in a batched event when endInput
is invoked.
Invoking this method outside of the above mentioned block will result
in the endInput(IProgressMonitor)
being invoked with a null
progress monitor. If responsiveness is required, the client should always
nest sync set modifications within beginInput/endInput
.
delta
- the delta to be added to this set.public void remove(IPath path)
beginInput()
and endInput(IProgressMonitor)
in which case the event for this removal and any other sync set
change will be fired in a batched event when endInput
is invoked.
Invoking this method outside of the above mentioned block will result
in the endInput(IProgressMonitor)
being invoked with a null
progress monitor. If responsiveness is required, the client should always
nest sync set modifications within beginInput/endInput
.
path
- the path to removepublic void clear()
public void beginInput()
org.eclipse.core.runtime.jobs.ILock
.
It is important that the lock is released after it is obtained. Calls to endInput
should be done in a finally block as illustrated in the following code snippet.
try { set.beginInput(); // do stuff } finally { set.endInput(progress); }
Calls to beginInput
and endInput
can be nested and must be matched.
public void endInput(IProgressMonitor monitor)
monitor
- a progress monitorbeginInput()
public IPath[] getPaths()
public IDiff[] getDiffs()
public long countFor(int state, int mask)
IDiffTree
For example, this will return the number of outgoing changes in the set:
long outgoing = countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
public int size()
IDiffTree
public void setPropertyToRoot(IDiff node, int property, boolean value)
public boolean getProperty(IPath path, int property)
IDiffTree
getProperty
in interface IDiffTree
path
- the pathproperty
- the propertypublic void setBusy(IDiff[] diffs, IProgressMonitor monitor)
IDiffTree
public void clearBusy(IProgressMonitor monitor)
IDiffTree
public boolean hasMatchingDiffs(IPath path, FastDiffFilter filter)
IDiffTree
hasMatchingDiffs
in interface IDiffTree
path
- the pathfilter
- the diff node filterpublic void reportError(IStatus status)
status
- the status that describes the error that occurred.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.