public interface ICompareInput
Note: at most two sides of an ICompareInput can be null,
(as it is normal for additions or deletions) but not all three.
ICompareInput provides methods for registering
ICompareInputChangeListeners
that get informed if one (or more)
of the three sides of an ICompareInput object changes its value.
For example when accepting an incoming addition
the (non-null) left side of an ICompareInput
is copied to the right side by means of method copy.
This should trigger a call to compareInputChanged of registered
ICompareInputChangeListeners.
Clients can implement this interface, or use the convenience implementation
DiffNode.
StructureDiffViewer,
ContentMergeViewer,
DiffNode| Modifier and Type | Method and Description |
|---|---|
void |
addCompareInputChangeListener(ICompareInputChangeListener listener)
Registers the given listener for notification.
|
void |
copy(boolean leftToRight)
Copy one side (source) to the other side (destination) depending on the
value of
leftToRight. |
ITypedElement |
getAncestor()
Returns the ancestor side of this input.
|
Image |
getImage()
Returns an image representing this input.
|
int |
getKind()
Returns the kind of difference between the
three sides ancestor, left and right.
|
ITypedElement |
getLeft()
Returns the left side of this input.
|
String |
getName()
Returns name of input.
|
ITypedElement |
getRight()
Returns the right side of this input.
|
void |
removeCompareInputChangeListener(ICompareInputChangeListener listener)
Unregisters the given listener.
|
String getName()
null sides or a combination
thereof.Image getImage()
null sides.null if no icon should be shownint getKind()
ICompareInput
is the result of another compare. In this case it is used
together with getImage to compose a icon
which reflects the kind of difference between the two or three elements.Differencer)ITypedElement getAncestor()
null if this input has no ancestor
or in the two-way compare case.nullITypedElement getLeft()
null if there is no left side (deletion or addition).nullITypedElement getRight()
null if there is no right side (deletion or addition).nullvoid addCompareInputChangeListener(ICompareInputChangeListener listener)
listener - the listener to register for changes of this inputvoid removeCompareInputChangeListener(ICompareInputChangeListener listener)
listener - the listener to unregistervoid copy(boolean leftToRight)
leftToRight. This method is called from
a merge viewer if a corresponding action ("take left" or "take right")
has been pressed.
The implementation should handle the following cases:
null the destination must be deleted,
null the destination must be created
and filled with the contents from the source,
null the contents of source must be copied to destination.
ICompareInputChangeListener.leftToRight - if true the left side is copied to the right side.
If false the right side is copied to the left sideGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.