Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » EMF Compare
EMF Compare [message #1116521] Wed, 25 September 2013 14:57 Go to next message
Julio Sandobalin is currently offline Julio Sandobalin
Messages: 6
Registered: August 2013
Junior Member
Hi guys,

I run the example (http://wiki.eclipse.org/EMF_Compare/FAQ#How_can_I_use_EMF_Compare_programmatically.3F) with the jars:

com.google.guava_11.0.2.v201303041551.jar
org.eclipse.emf.common_2.9.0.v20130528-0742.jar
org.eclipse.emf.compare_3.0.0.201306101322.jar
org.eclipse.emf.compare.rcp_2.1.0.201306101322.jar
org.eclipse.emf.ecore_2.9.0.v20130528-0742.jar
org.eclipse.emf.ecore.xmi_2.9.0.v20130528-0742.jar
org.eclipse.uml2.common_1.8.0.v20130610-0712.jar
org.eclipse.uml2.types_1.1.0.v20130610-0712.jar
org.eclipse.uml2.uml_4.1.0.v20130610-0712.jar

Code example (http://wiki.eclipse.org/EMF_Compare/FAQ#How_can_I_use_EMF_Compare_programmatically.3F) :

public void compare(File model1, File model2) {
URI uri1 = URI.createFileURI("path/to/first/model.xmi");
URI uri2 = URI.createFileURI("path/to/second/model.xmi");
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
ResourceSet resourceSet1 = new ResourceSetImpl();
ResourceSet resourceSet2 = new ResourceSetImpl();
resourceSet1.getResource(uri1, true);
resourceSet2.getResource(uri2, true);
IComparisonScope scope = new DefaultComparisonScope(resourceSet1, resourceSet2);
Comparison comparison = EMFCompare.builder().build().compare(scope);
List<Diff> differences = comparison.getDifferences();
// Let's merge every single diff
IMerger.Registry mergerRegistry = new IMerger.RegistryImpl();
IBatchMerger merger = new BatchMerger(mergerRegistry);
merger.copyAllLeftToRight(differences, new BasicMonitor());
}

But when I run example in the line (merger.copyAllLeftToRight(differences, new BasicMonitor())Wink the ecplise launched the following error:


Exception in thread "main" java.lang.IllegalStateException: No merger found for diff ReferenceChangeSpec
at org.eclipse.emf.compare.merge.IMerger$RegistryImpl.getHighestRankingMerger(IMerger.java:277)
at org.eclipse.emf.compare.merge.BatchMerger.copyAllLeftToRight(BatchMerger.java:89)
at edu.upv.compare.DifferenceModel.compare(DifferenceModel.java:114)
at edu.upv.compare.DifferenceModel.main(DifferenceModel.java:34)

Why do I have the error when I run the example?


Thanks in advance for your help.

Regards.

Julio SandobalĂ­n
Re: EMF Compare [message #1117224 is a reply to message #1116521] Thu, 26 September 2013 08:06 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1625
Registered: July 2009
Senior Member
Julio,

Please refrain from spawning multiple threads for the same issue, and use explicit titles for your threads. http://www.eclipse.org/forums/index.php/t/508839/ should be abandonned in favor to this one where you provide a little more info on your issues.

Quote:
No merger found for diff ReferenceChangeSpec


You create a new registry of mergers, leave it empty and try to use it to merge differences. You are supposed to populate the registry with the different mergers first.

We usually try our best to comment the classes with usage information. Please see the javadoc of the IMerger.Registry for information on standalone usage. Here, you should have used
IMeger.RegistryImpl.createStandaloneInstance()
instead of
new IMerger.RegistryImpl()


Laurent Goubet
Obeo
Previous Topic:Missing preference options for EMF compare 2.1
Next Topic:EMF Compare
Goto Forum:
  


Current Time: Tue Sep 23 12:33:47 GMT 2014

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

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