|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.compare.structuremergeviewer.DiffElement
org.eclipse.compare.structuremergeviewer.DiffContainer
org.eclipse.compare.structuremergeviewer.DiffNode
public class DiffNode
Diff node are used as the compare result of the differencing engine.
Since it implements the ITypedElement and ICompareInput
interfaces it can be used directly to display the
compare result in a DiffTreeViewer and as the input to any other
compare/merge viewer.
DiffNodes are typically created as the result of performing
a compare with the Differencer.
Clients typically use this class as is, but may subclass if required.
DiffTreeViewer,
Differencer| Field Summary |
|---|
| Fields inherited from interface org.eclipse.compare.ITypedElement |
|---|
FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE |
| Constructor Summary | |
|---|---|
DiffNode(IDiffContainer parent,
int kind)
Creates a new DiffNode and initializes with the given values. |
|
DiffNode(IDiffContainer parent,
int kind,
ITypedElement ancestor,
ITypedElement left,
ITypedElement right)
Creates a new DiffNode and initializes with the given values. |
|
DiffNode(int kind)
Creates a new DiffNode with the given diff kind. |
|
DiffNode(int kind,
ITypedElement ancestor,
ITypedElement left,
ITypedElement right)
Creates a new DiffNode and initializes with the given values. |
|
DiffNode(ITypedElement left,
ITypedElement right)
Creates a new DiffNode with diff kind Differencer.CHANGE
and initializes with the given values. |
|
| Method Summary | |
|---|---|
void |
addCompareInputChangeListener(ICompareInputChangeListener listener)
Registers a listener for changes of this ICompareInput. |
void |
copy(boolean leftToRight)
Copy one side (source) to the other side (destination) depending on the value of leftToRight. |
boolean |
dontExpand()
Returns true if this node shouldn't automatically be expanded in
a DiffTreeViewer. |
boolean |
equals(java.lang.Object other)
|
protected void |
fireChange()
Sends out notification that a change has occurred on the ICompareInput. |
ITypedElement |
getAncestor()
Returns the ancestor side of this input. |
ITypedElement |
getId()
Returns the first not- null input of this node. |
Image |
getImage()
The DiffElement implementation of this ITypedInput
method returns null. |
ITypedElement |
getLeft()
Returns the left side of this input. |
java.lang.String |
getName()
Returns the (non- null) name of the left or right side if they are identical. |
ITypedElement |
getRight()
Returns the right side of this input. |
java.lang.String |
getType()
The DiffElement implementation of this ITypedElement
method returns ITypedElement.UNKNOWN_TYPE. |
int |
hashCode()
|
void |
removeCompareInputChangeListener(ICompareInputChangeListener listener)
Unregisters a ICompareInput listener. |
void |
setAncestor(ITypedElement ancestor)
Sets the ancestor input to the given value. |
void |
setDontExpand(boolean dontExpand)
Controls whether this node is not automatically expanded when displayed in a DiffTreeViewer. |
void |
setLeft(ITypedElement left)
Sets the left input to the given value. |
void |
setRight(ITypedElement right)
Sets the right input to the given value. |
| Methods inherited from class org.eclipse.compare.structuremergeviewer.DiffContainer |
|---|
add, findChild, getChildren, hasChildren, remove, removeToRoot |
| Methods inherited from class org.eclipse.compare.structuremergeviewer.DiffElement |
|---|
getKind, getParent, setKind, setParent |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.compare.structuremergeviewer.ICompareInput |
|---|
getKind |
| Methods inherited from interface org.eclipse.compare.structuremergeviewer.IDiffElement |
|---|
getKind, getParent, setParent |
| Constructor Detail |
|---|
public DiffNode(IDiffContainer parent,
int kind,
ITypedElement ancestor,
ITypedElement left,
ITypedElement right)
DiffNode and initializes with the given values.
parent - under which the new container is added as a child or nullkind - of difference (defined in Differencer)ancestor - the common ancestor input to a compareleft - the left input to a compareright - the right input to a compare
public DiffNode(ITypedElement left,
ITypedElement right)
DiffNode with diff kind Differencer.CHANGE
and initializes with the given values.
left - the left input to a compareright - the right input to a compare
public DiffNode(int kind,
ITypedElement ancestor,
ITypedElement left,
ITypedElement right)
DiffNode and initializes with the given values.
kind - of difference (defined in Differencer)ancestor - the common ancestor input to a compareleft - the left input to a compareright - the right input to a comparepublic DiffNode(int kind)
DiffNode with the given diff kind.
kind - of difference (defined in Differencer)
public DiffNode(IDiffContainer parent,
int kind)
DiffNode and initializes with the given values.
parent - under which the new container is added as a child or nullkind - of difference (defined in Differencer)| Method Detail |
|---|
public void addCompareInputChangeListener(ICompareInputChangeListener listener)
ICompareInput.
Has no effect if an identical listener is already registered.
addCompareInputChangeListener in interface ICompareInputlistener - the listener to addpublic void removeCompareInputChangeListener(ICompareInputChangeListener listener)
ICompareInput listener.
Has no effect if listener is not registered.
removeCompareInputChangeListener in interface ICompareInputlistener - the listener to removeprotected void fireChange()
ICompareInput.
public boolean dontExpand()
true if this node shouldn't automatically be expanded in
a DiffTreeViewer.
true if node shouldn't automatically be expandedpublic void setDontExpand(boolean dontExpand)
dontExpand - if true this node is not automatically expanded in DiffTreeViewerpublic ITypedElement getId()
null input of this node.
Method checks the three inputs in the order: ancestor, right, left.
null input of this nodepublic java.lang.String getName()
null) name of the left or right side if they are identical.
Otherwise both names are concatenated (separated with a slash ('/')).
Subclasses may re-implement to provide a different name for this node.
getName in interface ITypedElementgetName in interface ICompareInputpublic Image getImage()
DiffElementDiffElement implementation of this ITypedInput
method returns null. Subclasses may re-implement to provide
an image for this element.
getImage in interface ITypedElementgetImage in interface ICompareInputgetImage in class DiffElementnull.public java.lang.String getType()
DiffElementDiffElement implementation of this ITypedElement
method returns ITypedElement.UNKNOWN_TYPE. Subclasses may
re-implement to provide a type for this element.
getType in interface ITypedElementgetType in class DiffElementITypedElement.UNKNOWN_TYPE.public void setAncestor(ITypedElement ancestor)
ancestor - the new value for the ancestor inputpublic ITypedElement getAncestor()
ICompareInputnull if this input has no ancestor
or in the two-way compare case.
getAncestor in interface ICompareInputnullpublic void setLeft(ITypedElement left)
left - the new value for the left inputpublic ITypedElement getLeft()
ICompareInputnull if there is no left side (deletion or addition).
getLeft in interface ICompareInputnullpublic void setRight(ITypedElement right)
right - the new value for the right inputpublic ITypedElement getRight()
ICompareInputnull if there is no right side (deletion or addition).
getRight in interface ICompareInputnullpublic void copy(boolean leftToRight)
ICompareInputleftToRight. 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.
copy in interface ICompareInputleftToRight - if true the left side is copied to the right side.
If false the right side is copied to the left sidepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Object
|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.