Skip to main content



      Home
Home » Modeling » Compare » EMF Compare 1.3 with Developer Guide
EMF Compare 1.3 with Developer Guide [message #1008698] Wed, 13 February 2013 10:50 Go to next message
Eclipse UserFriend
When i add required plug-ins (all of org.eclipse.emf.compare 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);
		return comparator.compare(scope);
	}
	 
	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 10:58] by Moderator

Re: EMF Compare 1.3 with Developer Guide [message #1008973 is a reply to message #1008698] Thu, 14 February 2013 03:26 Go to previous message
Eclipse UserFriend
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
Obeo
Previous Topic:EMF Compare Installation
Next Topic:Graphical comparison and difference display
Goto Forum:
  


Current Time: Thu Jul 03 04:20:09 EDT 2025

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

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

Back to the top