public class AttributeChangeMerger extends AbstractMerger
AbstractMerger
will be used to merge attribute changes.IMerger.Registry, IMerger.RegistryImpl
SUB_DIFF_AWARE_OPTION
Constructor and Description |
---|
AttributeChangeMerger() |
Modifier and Type | Method and Description |
---|---|
protected void |
accept(Diff diff,
boolean rightToLeft)
Accept the given difference.
|
protected void |
addInTarget(AttributeChange diff,
boolean rightToLeft)
This will be called when we need to create an element in the target side.
|
protected void |
changeValue(AttributeChange diff,
boolean rightToLeft)
This will be called by the merge operations in order to change single-valued attributes.
|
protected void |
doMove(AttributeChange diff,
Comparison comparison,
EObject expectedContainer,
Object expectedValue,
boolean rightToLeft)
This will do the actual work of moving the element into its attribute.
|
protected int |
findInsertionIndex(Comparison comparison,
Diff diff,
boolean rightToLeft)
This will be used by the distinct merge actions in order to find the index at which a value should be
inserted in its target list.
|
boolean |
isMergerFor(Diff target)
Check if the merger is a good candidate to merge the given difference.
|
protected void |
moveElement(AttributeChange diff,
boolean rightToLeft)
This will be called when trying to copy a "MOVE" diff.
|
protected String |
performThreeWayTextMerge(String left,
String right,
String origin)
Performs a three-way text merge for the given
origin , left , and right text
versions. |
protected void |
reject(Diff diff,
boolean rightToLeft)
Reject the given difference.
|
protected void |
removeFromTarget(AttributeChange diff,
boolean rightToLeft)
This will be called when we need to remove an element from the target side.
|
protected void |
resetInTarget(AttributeChange diff,
boolean rightToLeft)
Deprecated.
this has been refactored into
changeValue(AttributeChange, boolean) . |
addAt, copyLeftToRight, copyRightToLeft, createCopy, getDirectMergeDependencies, getDirectResultingMerges, getDirectResultingRejections, getMergeOptions, getRanking, getRegistry, handleEquivalences, handleImpliedBy, handleImplies, isAdd, mergeDiff, mergeRequiredBy, mergeRequires, setMergeOptions, setRanking, setRegistry
public boolean isMergerFor(Diff target)
target
- The given target difference.IMerger.isMergerFor(org.eclipse.emf.compare.Diff)
protected void accept(Diff diff, boolean rightToLeft)
accept
in class AbstractMerger
diff
- the difference to mergerightToLeft
- the direction of the mergeAbstractMerger.accept(org.eclipse.emf.compare.Diff, boolean)
protected void reject(Diff diff, boolean rightToLeft)
reject
in class AbstractMerger
diff
- the difference to mergerightToLeft
- the direction of the mergeAbstractMerger.reject(org.eclipse.emf.compare.Diff, boolean)
protected void addInTarget(AttributeChange diff, boolean rightToLeft)
All necessary sanity checks have been made to ensure that the current operation is one that should create an object in its side or add an objet to an attribute. In other words, either :
diff
- The diff we are currently merging.rightToLeft
- Tells us whether we are to add an object on the left or right side.protected void removeFromTarget(AttributeChange diff, boolean rightToLeft)
All necessary sanity checks have been made to ensure that the current operation is one that should delete an object. In other words, we are :
diff
- The diff we are currently merging.rightToLeft
- Tells us whether we are to add an object on the left or right side.protected void moveElement(AttributeChange diff, boolean rightToLeft)
diff
- The diff we are currently merging.rightToLeft
- Whether we should move the value in the left or right side.protected void doMove(AttributeChange diff, Comparison comparison, EObject expectedContainer, Object expectedValue, boolean rightToLeft)
#moveElement(boolean)
and no more verification will be made here.diff
- The diff we are currently merging.comparison
- Comparison holding this Diff.expectedContainer
- The container in which we are reorganizing an attribute.expectedValue
- The value that is to be moved within its attribute.rightToLeft
- Whether we should move the value in the left or right side.@Deprecated protected void resetInTarget(AttributeChange diff, boolean rightToLeft)
changeValue(AttributeChange, boolean)
.Should never be called on multi-valued attributes.
diff
- The diff we are currently merging.rightToLeft
- Tells us the direction of this merge operation.protected void changeValue(AttributeChange diff, boolean rightToLeft)
diff
- The diff we are currently merging.rightToLeft
- Direction of the merge.protected String performThreeWayTextMerge(String left, String right, String origin)
origin
, left
, and right
text
versions.left
- The left version of the String.right
- The right version of the String.origin
- The original version of the String.protected int findInsertionIndex(Comparison comparison, Diff diff, boolean rightToLeft)
DiffUtil.findInsertionIndex(Comparison, Diff, boolean)
for
more on this.
Sub-classes can override this if the insertion order is irrelevant. A return value of -1
will
be considered as "no index" and the value will be inserted at the end of its target list.
comparison
- This will be used in order to retrieve the Match for EObjects when comparing them.diff
- The diff which merging will trigger the need for an insertion index in its target list.rightToLeft
- true
if the merging will be done into the left list, so that we should consider the
right model as the source and the left as the target.diff
's value should be inserted into the 'target' list, as
inferred from rightToLeft
. -1
if the value should be inserted at the end of its
target list.DiffUtil.findInsertionIndex(Comparison, Diff, boolean)
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.