|
Re: [EMF Compare] Origin of a moved element in a 'MOVE' change! [message #1270144 is a reply to message #1268437] |
Wed, 12 March 2014 14:42 |
|
Hi,
For the sake of keeping the comparison model brief, we have not duplicated some of the info that "can be computed". Furthermore, this is not a straightforward thing to determine and even if we did set up a reference to the "origin container"... it would most likely be hard to understand as the "origin" might not always be present anymore and we decided not to reference Match elements from the differences. You might want to look at the ReferenceChangeMerger to see how we determine the needed information when merging moves, but in a nutshell, this could be determined with something similar to :
Diff moveDiff = ...;
Comparison comparison = diff.getMatch().getComparison();
EObject movedValue = moveDiff.getValue();
Match valueMatch = comparison.getMatch(movedValue);
EObject originContainer;
if (!comparison.isThreeWay()) {
originContainer = valueMatch.getLeft();
} else {
originContainer = valueMatch.getOrigin();
}
Basically, you should always use the "Match" elements when trying to navigate from one side to the other.
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.02706 seconds