Eclipse Platform Release 3.7

## 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.

Since:
  3.2
See Also:
  `DiffTree`
Restriction:
  This interface is not intended to be implemented by clients. Clients should use `DiffTree` instead.

Field Summary
`static int` `P_BUSY_HINT` Property constant used to indicate that a particular path may be involved in an operation.
`static int` `P_HAS_DESCENDANT_CONFLICTS` Property constant used to indicate that a particular path has descendants that are conflicts.

Method Summary
`void` `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.
`IDiff` `getDiff(IPath path)` Returns the delta identified by the given path, or `null` 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 busy
`int` `size()` Return the number of diffs contained in the tree.

Field Detail

### P_BUSY_HINT

    static final int P_BUSY_HINT

  Property constant used to indicate that a particular path may be involved in an operation.

  See Also:
    Constant Field Values

### P_HAS_DESCENDANT_CONFLICTS

    static final int P_HAS_DESCENDANT_CONFLICTS

  Property constant used to indicate that a particular path has descendants that are conflicts.

  See Also:
    Constant Field Values

Method Detail

### addDiffChangeListener

    void addDiffChangeListener(IDiffChangeListener listener)

  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

    void removeDiffChangeListener(IDiffChangeListener listener)

  Remove the listener from the tree. Removing a listener that is not registered has no effect.

  Parameters:
    `listener` - the listener to be removed

### accept

    void accept(IPath path,
                IDiffVisitor visitor,
                int depth)

  Accepts the given visitor. The only kinds of deltas visited are `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.

  Parameters:
    `path` - the path to start the visit in the tree
    `visitor` - the visitor
    `depth` - the depth to visit
  See Also:
    `IDiffVisitor.visit(IDiff)`

### getDiff

    IDiff getDiff(IPath path)

  Returns the delta identified by the given path, or `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 `getChildren(IPath)`.

  Parameters:
    `path` - the path of the desired delta
  Returns:
    the delta, or `null` if no such delta exists

### getChildren

    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 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 state
    `mask` - the sync state mask
  Returns:
    the number of matching resources in the set.

### setBusy

    void setBusy(IDiff[] diffs,
                 IProgressMonitor monitor)

  Set the given diff nodes and all their parents to busy

  Parameters:
    `diffs` - the busy diffs
    `monitor` - a progress monitor or `null` if progress indication is not required

### getProperty

    boolean getProperty(IPath path,
                        int property)

  Return the value of the property for the given path.

  Parameters:
    `path` - the path
    `property` - the property
  Returns:
    the value of the property

### clearBusy

    void clearBusy(IProgressMonitor monitor)

  Clear all busy properties in this tree.

  Parameters:
    `monitor` - a progress monitor or `null` if progress indication is not required

### hasMatchingDiffs

    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.

  Parameters:
    `path` - the path
    `filter` - the diff node filter
  Returns:
    whether the given diff tree contains any deltas that match the given filter

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.