Class TwoWayDiff
- All Implemented Interfaces:
IDiff,ITwoWayDiff
- Direct Known Subclasses:
ResourceDiff
ITwoWayDiff. By default, this implementation
returns null for the getFromPath() and
getToPath(). Subclasses that support move diffs
should override these methods.
This class may be subclassed by clients.
- Since:
- 3.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intConstant (bit mask) that defines the area of the status that is reserved for use by this abstract class for encoding the flags of the diff. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetFlags()Returns flags which describe in more detail how a object has been affected.Returns the full path (in the "before" state) from which this resource (in the "after" state) was moved.Returns the full path (in the "after" state) to which this resource (in the "before" state) was moved.Methods inherited from class org.eclipse.team.core.diff.provider.Diff
getKind, getPath, getStatus, hashCode, toDiffStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.team.core.diff.IDiff
getKind, getPath, toDiffString
-
Field Details
-
FLAG_MASK
protected static final int FLAG_MASKConstant (bit mask) that defines the area of the status that is reserved for use by this abstract class for encoding the flags of the diff. However, subclasses may include their own bits in the flag as long as they do not overlap with the bits in theFLAG_MASK- See Also:
-
-
Constructor Details
-
TwoWayDiff
Create a two-way diff- Parameters:
path- the path of the model object that has changedkind- the kind of changeflags- additional flags that describe the change
-
-
Method Details
-
getFlags
public int getFlags()Description copied from interface:ITwoWayDiffReturns 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:CONTENT- The bytes contained by the resource have been altered.REPLACE- The object was deleted (either by a delete or move), and was subsequently re-created (either by a create, move, or copy).
REMOVE(orCHANGEin conjunction withREPLACE):MOVE_TO- The object has moved.getToPathwill return the path of where it was moved to.
ADD(orCHANGEin conjunction withREPLACE):MOVE_FROM- The object has moved.getFromPathwill return the path of where it was moved from.COPY_FROM- The object has copied.getFromPathwill return the path of where it was copied from.
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 flagMOVE_TO, andgetToPathon A will return the path for B. B will have kindADD, with flagMOVE_FROM, andgetFromPathon 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.
- Specified by:
getFlagsin interfaceITwoWayDiff- Returns:
- the flags
- See Also:
-
getToPath
Description copied from interface:ITwoWayDiffReturns the full path (in the "after" state) to which this resource (in the "before" state) was moved. This value is only valid if theMOVE_TOchange flag is set; otherwise,nullis returned.Note: the returned path never has a trailing separator.
- Specified by:
getToPathin interfaceITwoWayDiff- Returns:
- a path, or
null - See Also:
-
getFromPath
Description copied from interface:ITwoWayDiffReturns the full path (in the "before" state) from which this resource (in the "after" state) was moved. This value is only valid if theMOVE_FROMchange flag is set; otherwise,nullis returned.Note: the returned path never has a trailing separator.
- Specified by:
getFromPathin interfaceITwoWayDiff- Returns:
- a path, or
null - See Also:
-
equals
-