use of org.eclipse.emf.compare.diff.DiffBuilder in project tdq-studio-se by Talend.
the class AbstractComparisonLevel method diffEngineWithFilter.
/**
* ignore the difference of id(not xmi id) Atrribute.
*
* @return
*/
protected IDiffEngine diffEngineWithFilter() {
IDiffProcessor diffProcessor = new DiffBuilder();
IDiffEngine diffEngine = new DefaultDiffEngine(diffProcessor) {
@Override
protected FeatureFilter createFeatureFilter() {
return new FeatureFilter() {
// @Override
@Override
public boolean checkForOrderingChanges(EStructuralFeature feature) {
return false;
}
@Override
protected boolean isIgnoredAttribute(EAttribute attribute) {
// $NON-NLS-1$
return "id".equals(attribute.getName()) || attribute.isID() || super.isIgnoredAttribute(attribute);
}
};
}
};
return diffEngine;
}
use of org.eclipse.emf.compare.diff.DiffBuilder in project InformationSystem by ObeoNetwork.
the class EMFCompareUtils method initializeComparator.
/**
* Initializes the EMF Compare comparator.
*
* @return the EMFCompare comparator.
*/
private static EMFCompare initializeComparator() {
final IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER);
final IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
final IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(matcher, comparisonFactory);
matchEngineFactory.setRanking(20);
final IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
matchEngineRegistry.add(matchEngineFactory);
final IDiffProcessor diffProcessor = new DiffBuilder();
final IDiffEngine diffEngine = new DefaultDiffEngine(diffProcessor) {
@Override
protected FeatureFilter createFeatureFilter() {
return new FeatureFilter() {
@Override
protected boolean isIgnoredAttribute(EAttribute attribute) {
if (attribute == null) {
// comparison, do it here.
return true;
} else {
return super.isIgnoredAttribute(attribute);
}
}
};
}
};
final EMFCompare comparator = EMFCompare.builder().setDiffEngine(diffEngine).setMatchEngineFactoryRegistry(matchEngineRegistry).build();
return comparator;
}
Aggregations