|
Re: Get EObjects that cause a difference [message #1410703 is a reply to message #1410348] |
Thu, 21 August 2014 12:27 |
|
Hi abel,
The source object can be obtained through the Match to which each Diff is associated. For example :
Diff diff = ...;
Match match = diff.getMatch();
EObject leftChangedObject = match.getLeft();
This may not be exactly what you seek for containment changes, since in these case the "added" object is not the "changed" one
ReferenceChange diff = ...;
if (diff.getReference().isContainment()) {
diff.getMatch().getLeft(); // <= this is the left container of the added/removed object
diff.getMatch().getComparison().getMatch(diff.getValue()).getLeft(); // <= This is the left version of the added/removed object
} else {
diff.getMatch().getLeft(); // <= this is the object on which we've observed a change
diff.getMatch().getComparison().getMatch(diff.getValue()).getLeft(); // <= and this is the left version of the object that's been added/removed from a reference of the previous object (object from the previous line)
}
See also the developer guide
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.03525 seconds