Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare] opening editor programmatically results in unexpected/wrong view
[EMF Compare] opening editor programmatically results in unexpected/wrong view [message #674993] Sun, 29 May 2011 21:55 Go to next message
Eclipse UserFriend
Originally posted by: Birgit Engelmann

Hi,

I am currently trying to create an emf compare editor view in an eclipse
plugin. What happens is that the elements of the tree, where usually the
structual changes are displayed, show some strange texts like "Model
Element Change Right Target false" (seems like the internal
description). And the visualization part is completely empty and only in
the properties view some entries are displayed.

The code to do so is the following:

// creating two models
Tournament t1 = BowlingFactory.eINSTANCE.createTournament();
t1.getMatchups().add(BowlingFactory.eINSTANCE.createMatchup());

Tournament t2 = BowlingFactory.eINSTANCE.createTournament();
t2.getMatchups().add(BowlingFactory.eINSTANCE.createMatchup());
t2.getMatchups().add(BowlingFactory.eINSTANCE.createMatchup());

// matching and diffing
MatchModel match = MatchService.doMatch(t1, t2, null);
DiffModel diff = DiffService.doDiff(match, false);

// create snapshot
ComparisonResourceSnapshot snapshot =
DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
snapshot.setDiff(diff);
snapshot.setMatch(match);

// open editor
ModelCompareEditorInput input = new ModelCompareEditorInput(snapshot);
CompareUI.openCompareEditor(input. true);


The created models are standard ecore models.
The code up until creating the DiffModel seems to work fine. I can print
the DiffElements and it finds that one Matchup was deleted. No error is
thrown when creating the view.

Any idea what I am doing wrong and how I can resolve this issue?

Thanks and regards,
Birgit
Re: [EMF Compare] opening editor programmatically results in unexpected/wrong view [message #675156 is a reply to message #674993] Mon, 30 May 2011 12:55 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Birgit,

As we no longer internally use the Compare editor with such an input, we might have a regression that went unnoticed on that. Do you have a better result when using code such as this?

----------
// matching and diffing
MatchResourceSet match = MatchService.doResourceSetMatch(t1, t2, null);
DiffResourceSet diff = DiffService.doDiff(match, false);

// create snapshot
ComparisonResourceSetSnapshot snapshot =
DiffFactory.eINSTANCE.createComparisonResourceSetSnapshot();
snapshot.setMatchResourceSet(match);
snapshot.setDiffResourceSet(diff);

// open editor
ModelCompareEditorInput input = new ModelCompareEditorInput(snapshot);
CompareUI.openCompareEditor(input, true);
----------

Laurent Goubet
Obeo
Re: [EMF Compare] opening editor programmatically results in unexpected/wrong view [message #675228 is a reply to message #675156] Mon, 30 May 2011 15:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Birgit Engelmann

Laurent,

thank you. This helped. Creating two resourceSets and adding the two
in-memory-models to their resources it worked. Now the editor looks how
it should look like.

Thank you very much for your help and the quick answer.
Birgit

Am 30.05.2011 14:55, schrieb Laurent Goubet:
> Birgit,
>
> As we no longer internally use the Compare editor with such an input, we
> might have a regression that went unnoticed on that. Do you have a
> better result when using code such as this?
>
> ----------
> // matching and diffing
> MatchResourceSet match = MatchService.doResourceSetMatch(t1, t2, null);
> DiffResourceSet diff = DiffService.doDiff(match, false);
>
> // create snapshot
> ComparisonResourceSetSnapshot snapshot =
> DiffFactory.eINSTANCE.createComparisonResourceSetSnapshot();
> snapshot.setMatchResourceSet(match);
> snapshot.setDiffResourceSet(diff);
>
> // open editor
> ModelCompareEditorInput input = new ModelCompareEditorInput(snapshot);
> CompareUI.openCompareEditor(input, true);
> ----------
>
> Laurent Goubet
> Obeo
Re: [EMF Compare] opening editor programmatically results in unexpected/wrong view [message #675321 is a reply to message #675228] Tue, 31 May 2011 07:39 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Birgit,

Then we do have a regression :s.

Could you raise a bug against EMF Compare (https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMF&component=Compare) with the two screenshots you attached here and the code snippet that provoked it?

Laurent Goubet
Obeo
Previous Topic:[EMF Compare] Exception while merge(): "The feature XY does not exist in Project"
Next Topic:[EMF Compare] Inverse use of EMF Compare
Goto Forum:
  


Current Time: Fri Mar 29 10:37:04 GMT 2024

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

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

Back to the top