use of org.eclipse.emf.compare.EMFCompare in project tdq-studio-se by Talend.
the class AbstractComparisonLevel method createDefaultEMFCompare.
/**
* create a EMFCompare with default configuration.
*
* @return
*/
protected EMFCompare createDefaultEMFCompare() {
// Configure EMF Compare
IEObjectMatcher matcher = ModelElementMatchEngine.createDQEObjectMatcher(UseIdentifiers.NEVER);
DefaultEqualityHelperFactory equalityHelperFactory = new DefaultEqualityHelperFactory();
IComparisonFactory comparisonFactory = new DefaultComparisonFactory(equalityHelperFactory);
IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
// IMatchEngine.Factory.Registry matchEngineRegistry =
// EMFCompareRCPPlugin.getDefault().getMatchEngineFactoryRegistry();
DQMatchEngineFactory matchEngineFactoryImpl = new DQMatchEngineFactory(matcher, comparisonFactory);
matchEngineRegistry.add(matchEngineFactoryImpl);
Builder builder = EMFCompare.builder();
builder.setDiffEngine(diffEngineWithFilter());
EMFCompare comparator = builder.setMatchEngineFactoryRegistry(matchEngineRegistry).build();
return comparator;
}
use of org.eclipse.emf.compare.EMFCompare in project tdq-studio-se by Talend.
the class DataProviderComparisonLevel method compareWithReloadObject.
@Override
protected boolean compareWithReloadObject() throws ReloadCompareException {
Map<ResourceSet, List<Resource>> rsJrxmlMap = removeJrxmlsFromResourceSet();
EMFCompare comparator = createDefaultEMFCompare();
IComparisonScope scope = new DefaultComparisonScope(oldDataProvider, getSavedReloadObject(), null);
Comparison compare = comparator.compare(scope);
// add the jrxml into the ResourceSet after doMatch
addJrxmlsIntoResourceSet(rsJrxmlMap);
EList<Diff> differences = compare.getDifferences();
for (Diff diff : differences) {
// ignore the move Kind
if (diff.getKind() == DifferenceKind.MOVE) {
continue;
}
if (diff instanceof ReferenceChange) {
EObject value = ((ReferenceChange) diff).getValue();
if (isCatalogOrSchema(value)) {
copyRightToLeft(diff);
}
}
}
return true;
}
use of org.eclipse.emf.compare.EMFCompare in project tdq-studio-se by Talend.
the class TableViewComparisonLevel method compareWithReloadObject.
@Override
protected boolean compareWithReloadObject() throws ReloadCompareException {
// remove the jrxml from the ResourceSet before doMatch
Map<ResourceSet, List<Resource>> rsJrxmlMap = removeJrxmlsFromResourceSet();
DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
// Compare the two models
EMFCompare comparator = createDefaultEMFCompare();
IComparisonScope scope = new DefaultComparisonScope(columnFolderRepNode.getColumnSet(), getSavedReloadObject(), null);
Comparison compare = comparator.compare(scope);
// add the jrxml into the ResourceSet after doMatch
addJrxmlsIntoResourceSet(rsJrxmlMap);
EList<Diff> differences = compare.getDifferences();
for (Diff diff : differences) {
// ignore the move Kind
if (diff.getKind() == DifferenceKind.MOVE) {
continue;
}
// copy right to left
copyRightToLeft(diff);
}
return true;
}
use of org.eclipse.emf.compare.EMFCompare in project tdq-studio-se by Talend.
the class CatalogSchemaComparisonLevel method compareWithReloadObject.
@Override
protected boolean compareWithReloadObject() throws ReloadCompareException {
// remove the jrxml from the ResourceSet before doMatch
Map<ResourceSet, List<Resource>> rsJrxmlMap = removeJrxmlsFromResourceSet();
EMFCompare comparator = createDefaultEMFCompare();
IComparisonScope scope = new DefaultComparisonScope(getPackageFromObject(selectedObj), getSavedReloadObject(), null);
Comparison compare = comparator.compare(scope);
// add the jrxml into the ResourceSet after doMatch
addJrxmlsIntoResourceSet(rsJrxmlMap);
EList<Diff> differences = compare.getDifferences();
for (Diff diff : differences) {
// ignore the move Kind
if (diff.getKind() == DifferenceKind.MOVE) {
continue;
}
// ignore others except TdTable and TdView and Related TaggetValue
if (diff instanceof ReferenceChange) {
EObject value = ((ReferenceChange) diff).getValue();
boolean isIgnore = true;
if (value instanceof TaggedValue) {
TdTable tableContianer = SwitchHelpers.TABLE_SWITCH.doSwitch(value.eContainer());
if (tableContianer != null) {
isIgnore = false;
}
} else if (isValidTableHandle(value) || isValidViewHandle(value)) {
isIgnore = false;
}
if (!isIgnore) {
copyRightToLeft(diff);
}
}
}
return true;
}
use of org.eclipse.emf.compare.EMFCompare in project tdq-studio-se by Talend.
the class AbstractComparisonLevel method compareWithReloadObject.
/**
* Compare the old selected object with reload object(rightResource), and updated the content of old selected
* object.
*
* @param rightResource
* @return
* @throws ReloadCompareException
*/
protected boolean compareWithReloadObject() throws ReloadCompareException {
Map<ResourceSet, List<Resource>> rsJrxmlMap = removeJrxmlsFromResourceSet();
EMFCompare comparator = createDefaultEMFCompare();
IComparisonScope scope = new DefaultComparisonScope(oldDataProvider, getSavedReloadObject(), null);
Comparison compare = comparator.compare(scope);
// add the jrxml into the ResourceSet after doMatch
addJrxmlsIntoResourceSet(rsJrxmlMap);
EList<Diff> differences = compare.getDifferences();
for (Diff diff : differences) {
// ignore the move Kind
if (diff.getKind() == DifferenceKind.MOVE) {
continue;
}
copyRightToLeft(diff);
}
return true;
}
Aggregations