use of org.eclipse.emf.compare.ReferenceChange 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.ReferenceChange 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.ReferenceChange in project tdq-studio-se by Talend.
the class FileMetadataTableComparisonLevel method compareWithReloadObject.
@Override
protected boolean compareWithReloadObject() throws ReloadCompareException {
Map<ResourceSet, List<Resource>> rsJrxmlMap = removeJrxmlsFromResourceSet();
EMFCompare comparator = createDefaultEMFCompare();
MetadataTable tempOldTable = (MetadataTable) getTempTableFromOldFile();
if (tempOldTable == null) {
return false;
}
IComparisonScope scope = new DefaultComparisonScope(tempOldTable, (MetadataTable) selectedObj, null);
Comparison compare = comparator.compare(scope);
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) {
ReferenceChange refChange = (ReferenceChange) diff;
if (diff.getKind() == DifferenceKind.ADD) {
handleRemoveElement(refChange);
} else if (diff.getKind() == DifferenceKind.DELETE) {
handleAddElement(refChange);
}
}
}
tempMetadataTable.getFeature().clear();
return true;
}
use of org.eclipse.emf.compare.ReferenceChange in project statecharts by Yakindu.
the class EdgeChangePostProcessor method postProcessEdgeDeletion.
/**
* In this case by default following dependencies are created:<br>
* <br>
* EdgeDeletion <-requires-- OutgoingTransitionDeletion --requires->
* IncomingTransitionDeletion<br>
* <br>
* Needs to be changed into:<br>
* <br>
* EdgeDeletion --requires-> OutgoingTransitionDeletion --requires->
* IncomingTransitionDeletion<br>
*
* @param edgeChange
*/
private void postProcessEdgeDeletion(EdgeChange edgeChange) {
Set<Diff> requiredOutgoingTransitionDeletions = new HashSet<Diff>();
for (Diff requireds : edgeChange.getRequiredBy()) {
if (requireds instanceof ReferenceChange) {
ReferenceChange requiredRefChange = (ReferenceChange) requireds;
// to add the corresponding change in incoming transition refs
if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS && requiredRefChange.getKind() == DifferenceKind.DELETE) {
requiredOutgoingTransitionDeletions.add(requiredRefChange);
}
}
}
edgeChange.getRequires().addAll(requiredOutgoingTransitionDeletions);
}
use of org.eclipse.emf.compare.ReferenceChange in project statecharts by Yakindu.
the class EdgeChangePostProcessor method postProcessEdgeAddition.
/**
* In this case by default following dependencies are created:<br>
* <br>
* EdgeDeletion --requires-> OutgoingTransitionDeletion <-requires--
* IncomingTransitionDeletion<br>
* <br>
* Needs to be changed into:<br>
* <br>
* EdgeDeletion --requires-> IncomingTransitionDeletion --requires->
* OutgoingTransitionDeletion<br>
*
* @param edgeChange
*/
private void postProcessEdgeAddition(EdgeChange edgeChange) {
Set<Diff> requiredIncomingTransitionAdditions = new HashSet<Diff>();
for (Diff requireds : edgeChange.getRequires()) {
if (requireds instanceof ReferenceChange) {
ReferenceChange requiredRefChange = (ReferenceChange) requireds;
// to add the corresponding change in incoming transition refs
if (requiredRefChange.getReference() == SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS && requiredRefChange.getKind() == DifferenceKind.ADD) {
requiredIncomingTransitionAdditions.addAll(findRequiredIncomingTransitionRefChange(requiredRefChange, DifferenceKind.ADD));
}
}
}
edgeChange.getRequires().addAll(requiredIncomingTransitionAdditions);
}
Aggregations