Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » emf compare two jface treeviewer model data
emf compare two jface treeviewer model data [message #990425] Wed, 12 December 2012 12:58 Go to next message
sam mn is currently offline sam mnFriend
Messages: 26
Registered: August 2010
Junior Member
Pardon me but I have a simple question to ask relating to EMF Compare. Tried searching a lot, but couldn't find much information.
Can we use EMF Compare to compare two jface treeviewer model data and show it in another diff viewer ?

http://www.eclipse.org/forums/index.php/t/441260/


In Detail:
Actually we have xml files, which are unmarshalled and displayed into a tree view. We are checking this into repo. So we have versions of this xml file and would like to perform a comparison operation. Once we checkout the xml file, we extract model data (by JAXB unmarshall) and then show it in jface treeviewer.

Now, can we feed this model data of two different xml files to emf compare and show the diff in another jface treeviewer?

Can I use this outside eclipse ? i mean in my RCP project ?

Any links I can look for examples because [org.eclipse.emf.compare.examples.standalone] is not accessible.

[Updated on: Wed, 12 December 2012 13:01]

Report message to a moderator

Re: emf compare two jface treeviewer model data [message #990569 is a reply to message #990425] Thu, 13 December 2012 08:42 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

Your message is quite confusing, drop the "jface" and "viewers" part : EMF Compare compares EMF models, not viewers. the viewers are means to graphically display the underlying models as trees.

You have two XML files. You can load them as EMF models. This is what you will compare :

URI xml1 = URI.createURI("path/to/file1.xml", true);
URI xml2 = URI.createURI("path/to/file2.xml", true);

ResourceSet resourceSet1 = new ResourceSetImpl();
ResourceSet resourceSet2 = new ResourceSetImpl();

resourceSet1.getResource(xml1, true);
resourceSet2.getResource(xml2, true);

IComparisonScope scope = EMFCompare.createDefaultScope(resourceSet1, resourceSet2);
Comparison comparison = EMFCompare.builder().build().compare(scope);


That is the basics on how to compare. Then, take a look at how to open a compare dialog, an existing enhancement request on the API we provide for the latter and the discussion from which this enhancement request was created for some more info on the matter.

Laurent Goubet
Obeo

[Updated on: Thu, 13 December 2012 08:42]

Report message to a moderator

Re: emf compare two jface treeviewer model data [message #990588 is a reply to message #990569] Thu, 13 December 2012 10:23 Go to previous messageGo to next message
sam mn is currently offline sam mnFriend
Messages: 26
Registered: August 2010
Junior Member
Thanks for the reply Laurent. I will try working with the XML files.

But one question remains in my mind, i.e can't we compare just the Model Data (underlying models) of two different jface treeViewers ?
Re: emf compare two jface treeviewer model data [message #990591 is a reply to message #990588] Thu, 13 December 2012 10:46 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Sam,

Not if the "model data" is not an EMF model itself. I had assumed that was the case, but your question makes me think I was mistaken. You could probably create a metamodel for the jface treeviewers ... but that seems a little overkill.

Since the data is held in XML files, I'd say that you can probably find a schema to represent it (you probably already do since you load those files in memory). You might want to follow Ed's advice from your cross-post on Generating an EMF Model using XML Schema.

Laurent Goubet
Obeo
Re: emf compare two jface treeviewer model data [message #990633 is a reply to message #990591] Thu, 13 December 2012 14:17 Go to previous messageGo to next message
sam mn is currently offline sam mnFriend
Messages: 26
Registered: August 2010
Junior Member
Couldn't find following imports:

import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareConstants;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.EMFCompareStructureMergeViewer;

I have eclipse indigo and have installed the latest version of EMF Compare. Searched and couldn't find them. Not sure where to find these lib's

Also checked the git @ https://github.com/eclipse/emf.compare

[Updated on: Thu, 13 December 2012 14:19]

Report message to a moderator

Re: emf compare two jface treeviewer model data [message #990835 is a reply to message #990633] Fri, 14 December 2012 11:40 Go to previous messageGo to next message
Mikael Barbero is currently offline Mikael BarberoFriend
Messages: 55
Registered: July 2009
Member
I just finished to update the wiki page http://wiki.eclipse.org/EMF_Compare/How_To_Open_Compare_Dialog_With_Comparison to reflect latest additions to EMF Compare.

You should use the latest integration build to be able to use it: http://download.eclipse.org/modeling/emf/compare/updates/interim/2.1/

It will be in M4.


Best regards,

Mikael Barbero
Obeo
Re: emf compare two jface treeviewer model data [message #990862 is a reply to message #990835] Fri, 14 December 2012 15:01 Go to previous messageGo to next message
Christoph Nebel is currently offline Christoph NebelFriend
Messages: 2
Registered: July 2009
Junior Member
Mikael - thanks a lot for the update of the wiki page!

One additional question: I want to open the compare dialog (implemented as suggested on the wiki page) via a menu call in a simple E4 rcp app.
I get an internal error: org.eclipse.e4.core.di.InjectionException: java.lang.IllegalStateException: Workbench has not been created yet.

Is the suggested CompareUI approach not suitable for pure E4 apps? It seems so. Or is there maybe something missing in the required plugins?

I saw, that there is a org.eclipse.emf.compare.rcp.ui plugin on git? Is that the way to do it? Could you give me a hint how to open teh compare dialog in a pure E4 app?

Thanks a lot for your help.
Re: emf compare two jface treeviewer model data [message #990863 is a reply to message #990835] Fri, 14 December 2012 15:03 Go to previous messageGo to next message
Christoph Nebel is currently offline Christoph NebelFriend
Messages: 2
Registered: July 2009
Junior Member
Mikael - thanks a lot for the update of the wiki page!

One additional question: I want to open the compare dialog (implemented as suggested on the wiki page) via a menu call in a simple E4 rcp app.
I get an internal error: org.eclipse.e4.core.di.InjectionException: java.lang.IllegalStateException: Workbench has not been created yet.

Is the suggested CompareUI approach not suitable for pure E4 apps? It seems so. Or is there maybe something missing in the required plugins?

I saw, that there is a org.eclipse.emf.compare.rcp.ui plugin on git? Is that the way to do it? Could you give me a hint how to open teh compare dialog in a pure E4 app?

Thanks a lot for your help.
Re: emf compare two jface treeviewer model data [message #996949 is a reply to message #990863] Thu, 03 January 2013 09:10 Go to previous message
Mikael Barbero is currently offline Mikael BarberoFriend
Messages: 55
Registered: July 2009
Member
Hi Christoph,

Sorry for the late answer, the end of the year is always a bit overladen. My answers below.

Quote:
One additional question: I want to open the compare dialog (implemented as suggested on the wiki page) via a menu call in a simple E4 rcp app.
I get an internal error: org.eclipse.e4.core.di.InjectionException: java.lang.IllegalStateException: Workbench has not been created yet.

Is the suggested CompareUI approach not suitable for pure E4 apps? It seems so. Or is there maybe something missing in the required plugins?


It's true that CompareUI is not suitable for pure RCP apps. It depends on the org.eclipse.ui.ide plugin which is not part of the RCP. The fact you are using E4 should not change anything as org.eclipse.ui.ide is implemented on top of the compatibility layer (the layer that bridges the gap between E4 and Eclipse IDE plugins).

Quote:
I saw, that there is a org.eclipse.emf.compare.rcp.ui plugin on git? Is that the way to do it?


org.eclipse.emf.compare.rcp.ui is only meant to factorize some code that is not dependent to the Eclipse IDE and that would ultimately lead to a RCP UI of EMF Compare. Currently, we have no plan to develop this UI and the org.eclipse.emf.compare.rcp.ui plugin do not contain any RCP implementation of a dialog or an editor.

Quote:
Could you give me a hint how to open teh compare dialog in a pure E4 app?


The only hint I can give you is to add the org.eclipse.compare plugin to your dependencies set. This will add you a lot of behavior from the Eclipse IDE that you probably don't want and that you may need to filter out in your RCP *Advisors (or whatever is provided by the E4 RCP, as I don't know if there are still the concept of Advisors within it).

Regards,


Best regards,

Mikael Barbero
Obeo
Previous Topic:different xmi but the same model in fact
Next Topic:How contribute action to compare with menu
Goto Forum:
  


Current Time: Fri Apr 19 09:24:06 GMT 2024

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

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

Back to the top