public static Comparison compareTwoResources(Resource right, Resource left) { IDiffProcessor diffProcessor = new DiffBuilder(); IDiffEngine diffEngine = new DefaultDiffEngine(diffProcessor) { @Override protected FeatureFilter createFeatureFilter() { return new FeatureFilter() { @Override public boolean checkForOrderingChanges(EStructuralFeature feature) { return false; } }; } }; Function nameFunction = new Function() { public String apply(EObject input) { if (input instanceof NameElement) { return ((NameElement)input).getName(); } // a null return here tells the match engine to fall back to the other matchers return null; } }; final IComparisonScope scope = new DefaultComparisonScope(right, left, null); IMatchEngine.Factory.Registry registry = EMFCompareRCPPlugin.getDefault().getMatchEngineFactoryRegistry(); /* * configure our matching engine */ IEObjectMatcher fallBackMatcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER); IEObjectMatcher customIDMatcher = new IdentifierEObjectMatcher(fallBackMatcher, nameFunction); IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory()); final MatchEngineFactoryImpl matchEngineFactory = new MatchEngineFactoryImpl(customIDMatcher, comparisonFactory); matchEngineFactory.setRanking(20); // default engine ranking is 10, must be higher to override. registry.add(matchEngineFactory); return EMFCompare.builder().setMatchEngineFactoryRegistry(registry).setDiffEngine(diffEngine).build().compare(scope); }