Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » [EMF Compare] Origin of a moved element in a 'MOVE' change!
[EMF Compare] Origin of a moved element in a 'MOVE' change! [message #1268437] Mon, 10 March 2014 13:57 Go to next message
ping cin is currently offline ping cinFriend
Messages: 13
Registered: February 2014
Junior Member
Hello everyone,

I am using EMF Compare in order to have the difference model from two versions of an ecore.

I noticed that when I move a property from a class to another, let say I move property p from A to B. I cannot find the information about the origin, in my example class A. However, I do find the information that p is in B now.

I have looked into the container, but I did not find anything.

I do not think that this information does not exist in EMF Compare, may be I am missing it somewhere.

Could someone help me here please?

Best Regards.
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 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1895
Registered: July 2009
Senior Member

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
Previous Topic:error occurred during: "Computing Model Differences"
Next Topic:Invalid link in EMF Compare developer guide
Goto Forum:

Current Time: Sun Nov 28 03:25:58 GMT 2021

Powered by FUDForum. Page generated in 0.02224 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top