Eclipse Platform
Release 3.3

org.eclipse.team.core.diff
Interface ITwoWayDiff

All Superinterfaces:
IDiff
All Known Subinterfaces:
IResourceDiff
All Known Implementing Classes:
ResourceDiff, TwoWayDiff

public interface ITwoWayDiff
extends IDiff

A two-way diff represents the changes between two states of the same object, referred to as the "before" state and the "after" state. It is modeled after the IResourceDelta but is simplified.

This interface is not intended to be implemented by clients. Clients that need to create two-way diffs should instead use or subclass TwoWayDiff

Since:
3.2
See Also:
IDiffTree

Field Summary
static int CONTENT
          Change constant (bit mask) indicating that the content of the object has changed.
static int COPY_FROM
          Change constant (bit mask) indicating that the object was copied from another location.
static int MOVE_FROM
          Change constant (bit mask) indicating that the object was moved from another location.
static int MOVE_TO
          Change constant (bit mask) indicating that the object was moved to another location.
static int REPLACE
          Change constant (bit mask) indicating that the object has been replaced by another at the same location (i.e., the object has been deleted and then added).
 
Fields inherited from interface org.eclipse.team.core.diff.IDiff
ADD, CHANGE, NO_CHANGE, REMOVE
 
Method Summary
 int getFlags()
          Returns flags which describe in more detail how a object has been affected.
 IPath getFromPath()
          Returns the full path (in the "before" state) from which this resource (in the "after" state) was moved.
 IPath getToPath()
          Returns the full path (in the "after" state) to which this resource (in the "before" state) was moved.
 
Methods inherited from interface org.eclipse.team.core.diff.IDiff
getKind, getPath, toDiffString
 

Field Detail

CONTENT

public static final int CONTENT
Change constant (bit mask) indicating that the content of the object has changed.

See Also:
getFlags(), Constant Field Values

MOVE_FROM

public static final int MOVE_FROM
Change constant (bit mask) indicating that the object was moved from another location. The location in the "before" state can be retrieved using getFromPath().

See Also:
getFlags(), Constant Field Values

MOVE_TO

public static final int MOVE_TO
Change constant (bit mask) indicating that the object was moved to another location. The location in the new state can be retrieved using getToPath().

See Also:
getFlags(), Constant Field Values

COPY_FROM

public static final int COPY_FROM
Change constant (bit mask) indicating that the object was copied from another location. The location in the "before" state can be retrieved using getFromPath().

See Also:
getFlags(), Constant Field Values

REPLACE

public static final int REPLACE
Change constant (bit mask) indicating that the object has been replaced by another at the same location (i.e., the object has been deleted and then added).

See Also:
getFlags(), Constant Field Values
Method Detail

getFlags

public int getFlags()
Returns flags which describe in more detail how a object has been affected.

The following codes (bit masks) are used when kind is CHANGE, and also when the object is involved in a move:

The following code is only used if kind is REMOVE (or CHANGE in conjunction with REPLACE): The following code is only used if kind is ADD (or CHANGE in conjunction with REPLACE): A simple move operation would result in the following diff information. If a object is moved from A to B (with no other changes to A or B), then A will have kind REMOVE, with flag MOVE_TO, and getToPath on A will return the path for B. B will have kind ADD, with flag MOVE_FROM, and getFromPath on B will return the path for A. B's other flags will describe any other changes to the resource, as compared to its previous location at A.

Note that the move flags only describe the changes to a single object; they don't necessarily imply anything about the parent or children of the object. If the children were moved as a consequence of a subtree move operation, they will have corresponding move flags as well.

Returns:
the flags
See Also:
CONTENT, MOVE_TO, MOVE_FROM, COPY_FROM, REPLACE, IDiff.getKind(), getFromPath(), getToPath()

getFromPath

public IPath getFromPath()
Returns the full path (in the "before" state) from which this resource (in the "after" state) was moved. This value is only valid if the MOVE_FROM change flag is set; otherwise, null is returned.

Note: the returned path never has a trailing separator.

Returns:
a path, or null
See Also:
getToPath(), IDiff.getPath(), getFlags()

getToPath

public IPath getToPath()
Returns the full path (in the "after" state) to which this resource (in the "before" state) was moved. This value is only valid if the MOVE_TO change flag is set; otherwise, null is returned.

Note: the returned path never has a trailing separator.

Returns:
a path, or null
See Also:
getFromPath(), IDiff.getPath(), getFlags()

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.