Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » EMF Compare 1.3 with Developer Guide
EMF Compare 1.3 with Developer Guide [message #1008698] Wed, 13 February 2013 15:50 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
When i add required plug-ins (all of plug-in's) to my project

and write this code ;

public Comparison compare(File model1, File model2) {
		// Load the two input models
		ResourceSet resourceSet1 = new ResourceSetImpl();
		ResourceSet resourceSet2 = new ResourceSetImpl();
		String xmi1 = "path/to/first/model.xmi";
		String xmi2 = "path/to/second/model.xmi";
		load(xmi1, resourceSet1);
		load(xmi2, resourceSet2);
		// Configure EMF Compare
		IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER);
		IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
		IMatchEngine matchEngine = new DefaultMatchEngine(matcher, comparisonFactory);
		EMFCompare comparator = EMFCompare.builder().setMatchEngine(matchEngine).build();
		// Compare the two models
		IComparisonScope scope = EMFCompare.createDefaultScope(resourceSet1, resourceSet2);
	private void load(String absolutePath, ResourceSet resourceSet) {
	  URI uri = URI.createFileURI(absolutePath);
	  resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
	  // Resource will be loaded within the resource set
	  resourceSet.getResource(uri, true);

my project can't recognize EMFCompare, IEObjectMatcher and other EMF Compare classes why don't understand.

anyone can help me ?

( Eclipse Juno / EMF Compare 1.3 )

[Updated on: Wed, 13 February 2013 15:58]

Report message to a moderator

Re: EMF Compare 1.3 with Developer Guide [message #1008973 is a reply to message #1008698] Thu, 14 February 2013 08:26 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1895
Registered: July 2009
Senior Member
You are using EMF Compare 1.3 whilst the example from the FAQ shows the latest available API to launch comparison. This is mentionned in the very first line of the FAQ, along with a link to the old FAQ for 1.3 that would have shown you how to compare programmatically with that legacy version.

Again, this code comes from 2.1, the version that will be shipped with Kepler in June, and the most stable. Please use the 2.1.0M5 build (installable either from (the EMF Compare 2.1 milestones update site or from the Kepler staging repository).

Laurent Goubet
Previous Topic:EMF Compare Installation
Next Topic:Graphical comparison and difference display
Goto Forum:

Current Time: Sun Sep 26 13:50:25 GMT 2021

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

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

Back to the top