Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Cuccuru2014-12-16 10:22:03 +0000
committerArnaud Cuccuru2014-12-16 10:22:03 +0000
commitd145b2342617956ea08bbac73f1c2d6ef710f188 (patch)
treee93868f911b6ddd2248a371866863ed3addc86e1
parent2e90ebd361a5ec9e64244c734cacafbfc6df2ced (diff)
downloadorg.eclipse.papyrus-d145b2342617956ea08bbac73f1c2d6ef710f188.tar.gz
org.eclipse.papyrus-d145b2342617956ea08bbac73f1c2d6ef710f188.tar.xz
org.eclipse.papyrus-d145b2342617956ea08bbac73f1c2d6ef710f188.zip
409711: [Compare 2] Papyrus shall provide a PostProcessor for Compare 2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409711 A potential regression due to Bug 406405 was identified in the discussions related to this task. The regression actually occured. The committed changes fic this regression. Change-Id: I0241dfdba7b2c2826e8aad8d059e28b922aa48bb
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/postprocessor/PapyrusPostProcessor.java7
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/GeneralizationChangesHelper.java32
3 files changed, 22 insertions, 20 deletions
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF
index 7bafe023bfa..ee204236c7d 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.compare.diagram;bundle-version="2.1.0",
org.eclipse.uml2.uml;bundle-version="4.1.0",
org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
- org.eclipse.emf.compare.rcp;bundle-version="2.1.0"
+ org.eclipse.emf.compare.rcp;bundle-version="2.1.0",
+ org.eclipse.emf.compare.uml2;bundle-version="2.2.0"
Export-Package: org.eclipse.papyrus.uml.compare.postprocessor,
org.eclipse.papyrus.uml.compare.utils
Bundle-Vendor: %providerName
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/postprocessor/PapyrusPostProcessor.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/postprocessor/PapyrusPostProcessor.java
index 74f28673f06..f46709401c5 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/postprocessor/PapyrusPostProcessor.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/postprocessor/PapyrusPostProcessor.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,7 @@ import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.diagram.internal.extensions.NodeChange;
import org.eclipse.emf.compare.postprocessor.IPostProcessor;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
import org.eclipse.papyrus.uml.compare.utils.GeneralizationChangesHelper;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Feature;
@@ -125,7 +126,7 @@ public class PapyrusPostProcessor implements IPostProcessor {
Set<Feature> features = helper.getInheritedFeaturesWithNodeChange(c);
for (Feature f : features) {
for (Generalization generalization : helper.getGeneralizationPath(c, f)) {
- ReferenceChange generalizationAdded = helper.getGeneralizationChange(generalization);
+ DirectedRelationshipChange generalizationAdded = helper.getGeneralizationChange(generalization);
if (generalizationAdded != null) {
NodeChange nodeAdded = helper.getFeatureNodeChange(f);
if (nodeAdded != null) {
@@ -143,7 +144,7 @@ public class PapyrusPostProcessor implements IPostProcessor {
Set<Feature> features = helper.getInheritedFeaturesWithNodeChange(c);
for (Feature f : features) {
for (Generalization generalization : helper.getGeneralizationPath(c, f)) {
- ReferenceChange generalizationDeleted = helper.getGeneralizationChange(generalization);
+ DirectedRelationshipChange generalizationDeleted = helper.getGeneralizationChange(generalization);
if (generalizationDeleted != null) {
NodeChange nodeDeleted = helper.getFeatureNodeChange(f);
if (nodeDeleted != null) {
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/GeneralizationChangesHelper.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/GeneralizationChangesHelper.java
index abb9452dbf7..60131c7d52d 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/GeneralizationChangesHelper.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/GeneralizationChangesHelper.java
@@ -23,15 +23,14 @@ import java.util.Set;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.ReferenceChange;
import org.eclipse.emf.compare.diagram.internal.extensions.NodeChange;
+import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Feature;
import org.eclipse.uml2.uml.Generalization;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* Helper for extracting information used by the ComparePapyrusDiagramPostProcessor,
@@ -57,7 +56,7 @@ public class GeneralizationChangesHelper {
/**
* A mapping between Generalizations and Diffs representing addition or deletion of this generalization.
*/
- protected Map<Generalization, ReferenceChange> generalizationToReferenceChange = new HashMap<Generalization, ReferenceChange>();
+ protected Map<Generalization, DirectedRelationshipChange> generalizationToReferenceChange = new HashMap<Generalization, DirectedRelationshipChange>();
/**
* A mapping between pairings of Classifier/Feature to Generalization path, where a path is a List<Generalization>,
@@ -79,7 +78,7 @@ public class GeneralizationChangesHelper {
/**
* Constructor for this helper. Instantiation of this helper implies classification of Diffs associated with the given comparison.
- *
+ *
* @param comparison
*/
public GeneralizationChangesHelper(Comparison comparison) {
@@ -97,13 +96,14 @@ public class GeneralizationChangesHelper {
* classesWithNodeForInheritedFeature_ADDED, classesWithNodeForInheritedFeature_DELETED)
*/
protected void classifyDiffs() {
- for (Diff difference : this.comparison.getDifferences()) {
- if (difference instanceof ReferenceChange) {
- // TODO Changes may be required in connection with the following bug:
- // Bug 406405 - A macroscopic change has to be created for UML DirectedRelationship elements
- this.evaluateGeneralizationChange((ReferenceChange) difference);
+ for(Diff difference : this.comparison.getDifferences()) {
+ if (difference instanceof DirectedRelationshipChange) {
+ // if(difference instanceof ReferenceChange) {
+ // Changes done according to the following bug:
+ // Bug 406405 - A macroscopic change has to be created for UML DirectedRelationship elements
+ this.evaluateGeneralizationChange((DirectedRelationshipChange)difference);
} else if (difference instanceof NodeChange) {
- this.evaluateNodeForInheritedFeatureChange((NodeChange) difference);
+ this.evaluateNodeForInheritedFeatureChange((NodeChange)difference);
}
}
}
@@ -115,10 +115,10 @@ public class GeneralizationChangesHelper {
* @param difference
* The difference being evaluated
*/
- protected void evaluateGeneralizationChange(ReferenceChange difference) {
- // difference is a generalization if the associated eReference is Classifier.generalization
- if (difference.getReference().equals(UMLPackage.eINSTANCE.getClassifier_Generalization())) {
- this.generalizationToReferenceChange.put((Generalization) difference.getValue(), difference);
+ protected void evaluateGeneralizationChange(DirectedRelationshipChange difference) {
+ // difference is a generalization if the discriminant is a generalization
+ if (difference.getDiscriminant() instanceof Generalization) {
+ this.generalizationToReferenceChange.put((Generalization)difference.getDiscriminant(), difference);
}
}
@@ -295,9 +295,9 @@ public class GeneralizationChangesHelper {
* returns the ReferenceChange diff corresponding to the given Generalization, if any.
*
* @param generalization
- * @return the ReferenceChange diff corresponding to the given Generalization, if any.
+ * @return the DirectedRelationshipChange diff corresponding to the given Generalization, if any.
*/
- public ReferenceChange getGeneralizationChange(Generalization generalization) {
+ public DirectedRelationshipChange getGeneralizationChange(Generalization generalization) {
return this.generalizationToReferenceChange.get(generalization);
}

Back to the top