Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF Diff/Merge » Comparison and reference(Wrong comparison on a resource when it has references)
Comparison and reference [message #1250382] Wed, 19 February 2014 07:24 Go to next message
Charly ST is currently offline Charly STFriend
Messages: 3
Registered: February 2014
Junior Member
Hello,

I have a problem with the diffmerge plugin:



I have one resource that contains two items.


Item1 composed by : ID,Name,Value(Integer)
Item2 composed by : ID,Name,Value(Integer)

I have one resource ( Resource A) that contains an object which has for value a reference to Item1
I have one resource ( Resource B) that contains an object which has for value a reference to Item2

When I compare Resource A and Resource B through DiffMerge, the difference between the value isn't detected.

Do you have a solution for this problem?

Thanks in advance,
Re: Comparison and reference [message #1250740 is a reply to message #1250382] Wed, 19 February 2014 14:52 Go to previous messageGo to next message
Olivier Constant is currently offline Olivier ConstantFriend
Messages: 106
Registered: January 2012
Senior Member
Hi Charly,

By default the scope of the comparison does not extend to resources which are only cross-referenced, that is, resources which own elements that are cross-referenced but that are not contained by elements of your entry-point resources.

You thus need to define your own scope that "follows" whatever cross-references you may have between resources. Or you can define a generic scope that "follows" all cross-references it encounters without distinction.

For that purpose, you can extend GMFModelScope, or FragmentedModelScope if you do not care about GMF diagrams, then declare a corresponding scope factory through the UI extension point.

As an example, you may have a look at plugin diffmerge.ui.gmf where this is done for GMF models: the reference from GMF representations (Views) to model elements is declared as a reference to "follow". So if you launch a comparison on GMF files, the scope will extend to the models represented in the GMF diagrams. See method getCrossReferencesInScope in the GMF scope.

Hope it helps!

Olivier
Re: Comparison and reference [message #1255346 is a reply to message #1250740] Mon, 24 February 2014 10:45 Go to previous messageGo to next message
Charly ST is currently offline Charly STFriend
Messages: 3
Registered: February 2014
Junior Member
Hi Oliver,

First, thanks for your answer.

I extended the method getCrossReferencesInScope() and I had the reference to the resource needed to the comparison.



With this changes, the display of the comparison is not correct.

Before the changes I had Resource A on reference and Resource B on target
Now it's Resource needed (two times) on reference and Resource B + Resource needed on target

The list of IMatch when I do :
List<IMatch> result = input.getActualComparison().getContents(_sideRole);

is false.


Do you knwo why ?

Thanks in advance,
Charly
Re: Comparison and reference [message #1263413 is a reply to message #1255346] Tue, 04 March 2014 13:02 Go to previous messageGo to next message
Olivier Constant is currently offline Olivier ConstantFriend
Messages: 106
Registered: January 2012
Senior Member
Hi Charly,

Weird, I cannot reproduce your problem.
What do you mean by "Now it's Resource needed (two times) on reference"? Is the content of the needed Resource present twice in the same (REFERENCE) scope?

Olivier
Re: Comparison and reference [message #1265760 is a reply to message #1263413] Thu, 06 March 2014 14:16 Go to previous messageGo to next message
Charly ST is currently offline Charly STFriend
Messages: 3
Registered: February 2014
Junior Member
Hi Olivier,

The reference resource doesn't contains anymore the initial referenced resource but it contains only the cross referenced resource two times.

Thanks in advance,
Charly
Re: Comparison and reference [message #1269082 is a reply to message #1265760] Tue, 11 March 2014 11:04 Go to previous messageGo to next message
Olivier Constant is currently offline Olivier ConstantFriend
Messages: 106
Registered: January 2012
Senior Member
Hi Charly,

A very surprising result indeed. I would suggest to investigate the building of the scope in debug mode.

You may, for example, set a breakpoint in methods FragmentedModelScope#notifyInclusion and FragmentedModelScope#notifyReference. These are the methods that modify the set of resources in the scope.
Check that _rootResources initially contains Resource A, then watch for the moment where Resource A disappears from this collection.

Alternatively, can you think of some reference between elements in your models that you did not mention in your first post, so that I can try and reproduce the problem?

Olivier
Re: Comparison and reference [message #1279251 is a reply to message #1269082] Fri, 28 March 2014 13:07 Go to previous message
Olivier Constant is currently offline Olivier ConstantFriend
Messages: 106
Registered: January 2012
Senior Member
Hi again Charly,

I found and fixed a bug in FragmentedModelScope which might be related to your observations. When FragmentedModelScope was instantiated with a Resource as parameter, the Resource was registered twice in the scope.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=431448

The bug is fixed in the last build, so you might be interested in testing it. https://hudson.eclipse.org/hudson/job/buckminster-emf-diffmerge-master/

Cheers,
Olivier

Previous Topic:Resources loading problems.
Next Topic:Is the UI useable on RCP app without (too many) dependancies ?
Goto Forum:
  


Current Time: Fri Apr 19 21:42:33 GMT 2024

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

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

Back to the top