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 SandobalinFriend
Messages: 6
Registered: August 2013
Junior Member
Hi guys,

I run the example ( with the jars:

Code example ( :

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

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

Thanks in advance for your help.


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 GoubetFriend
Messages: 1752
Registered: July 2009
Senior Member

Please refrain from spawning multiple threads for the same issue, and use explicit titles for your threads. should be abandonned in favor to this one where you provide a little more info on your issues.

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
instead of
new IMerger.RegistryImpl()

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

Current Time: Mon Oct 24 22:18:25 GMT 2016

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

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