emf compare two jface treeviewer model data [message #990425] |
Wed, 12 December 2012 12:58 |
sam mn 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 |
|
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 #990591 is a reply to message #990588] |
Thu, 13 December 2012 10:46 |
|
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 #996949 is a reply to message #990863] |
Thu, 03 January 2013 09:10 |
Mikael Barbero 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
|
|
|
Powered by
FUDForum. Page generated in 0.02233 seconds