Home » Modeling » Compare » EMF Compare: Start over!?(Getting started with the newest versions of EMF Compare)
EMF Compare: Start over!? [message #1747279] |
Fri, 11 November 2016 10:07  |
Eclipse User |
|
|
|
Hi everyone,
first thing first: please forgive my poor english. i usually speak french and German
i'm new in this forum and a also a noob programmer.
i got a project and have to build an Editor on an ecore model (i think you all know about the model driven software dev, don't you?).
now i want to integrate a Graphical model comparison for the models created in the driven Editor.
i started by writing a class to programmaticaly compare two ecore model with respect to the given example in the developer documentation https://www.eclipse.org/emf/compare/documentation/latest/developer/developer-guide.html:
@SuppressWarnings("restriction")
public void compareOE(String model1, String model2) {
URI uri1 = URI.createFileURI("C:/Users/AnthonySO/Documents/Bachelorarbeit/Vorbereitung/Workspace/MARS4/emab.project.test1/model/emab.ecore");
URI uri2 = URI.createFileURI("C:/Users/AnthonySO/Documents/Bachelorarbeit/Vorbereitung/Workspace/MARS4/emab.project.test2/model/emab.ecore");
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
ResourceSet resourceSet1 = new ResourceSetImpl();
ResourceSet resourceSet2 = new ResourceSetImpl();
resourceSet1.getResource(uri1, true);
resourceSet2.getResource(uri2, true);
EMFCompare.Builder builder = EMFCompare.builder();
EMFCompare comparator = builder.build();
IComparisonScope scope = new DefaultComparisonScope(resourceSet1, resourceSet2, null);
ICompareEditingDomain editingDomain = EMFCompareEditingDomain.create(resourceSet1, resourceSet2, null);
AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
EMFCompareConfiguration compareConfig = new EMFCompareConfiguration(new CompareConfiguration());
CompareEditorInput input = new ComparisonScopeEditorInput(compareConfig,
editingDomain, adapterFactory, comparator, scope);
CompareUI.openCompareDialog(input); // or CompareUI.openCompareEditor(input);
}
1. i got a restriction warning and i want to solve it, but i don't know how. i thing it is not so that important, is it?
2. then i got the following error code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.eclipse.emf.compare.EMFCompare.<clinit>(EMFCompare.java:73)
at emab.diagram.compare.cutom.CustomCompare.compareOE(CustomCompare.java:79)
at emab.diagram.compare.cutom.CustomCompare.main(CustomCompare.java:94)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
is there any way out of this error?
|
|
| | | | |
Re: EMF Compare: Start over!? [message #1749290 is a reply to message #1748429] |
Mon, 05 December 2016 03:58  |
Eclipse User |
|
|
|
Hi Anthony,
Before you try and get your use case working in stand alone, have you tried comparing these files through the regular eclipse UI with EMF Compare's GMF Diagram support installed? Use the latest release's (3.3.0) update site to install the "GMF Support" feature, then try to compare your files through the normal action (select your two files -> compare with -> each other). If that doesn't work and you use a custom file extension, try and add that extension to our known content-types (Window > Preferences > General > Content Types > EMF Compare) and try again.
This will at least tell you if EMF Compare can support your files out of the box. If not, then you will have to see how to implement your own comparison algorithms and integrate them with EMF Compare. You can take a look at the supports we have for Papyrus (most advanced, probably most complicated as well) and Sirius to see how we integrate with graphical tools for the comparison. You can retrieve their source code by cloning our repository, they're located in the plugins folder and are prefixed by "org.eclipse.emf.compare.diagram".
Basically, you shouldn't need steps as high level as you outlined above (for example, the structure merge view is already provided by emf compare so you can just let us to the heavy lifting).
Laurent Goubet
Obeo
|
|
|
Goto Forum:
Current Time: Thu Apr 24 04:04:44 EDT 2025
Powered by FUDForum. Page generated in 0.04709 seconds
|