Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-02-05 11:05:27 +0000
committervlorenzo2013-02-05 11:05:27 +0000
commitc33d0d513d740d5d3669dde317002b4b21314121 (patch)
tree75ac99093236ccd7b33bbf82f9672f7c83e5cf81 /extraplugins/uml
parentf93cc3435aa4175f3760ad865f82f74cad030d88 (diff)
downloadorg.eclipse.papyrus-c33d0d513d740d5d3669dde317002b4b21314121.tar.gz
org.eclipse.papyrus-c33d0d513d740d5d3669dde317002b4b21314121.tar.xz
org.eclipse.papyrus-c33d0d513d740d5d3669dde317002b4b21314121.zip
399714: [EMF-Compare] Papyrus must provide an editor to compare 2 elements of 2 opened models
https://bugs.eclipse.org/bugs/show_bug.cgi?id=399714
Diffstat (limited to 'extraplugins/uml')
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/Messages.java17
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/messages.properties1
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java11
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java4
-rw-r--r--extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java13
5 files changed, 43 insertions, 3 deletions
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/Messages.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/Messages.java
new file mode 100644
index 00000000000..379560a3197
--- /dev/null
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/Messages.java
@@ -0,0 +1,17 @@
+package org.eclipse.papyrus.uml.compare.diff.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.compare.diff.messages.messages"; //$NON-NLS-1$
+
+ public static String GetDiffElementLabel_StereotypeAppliedOnAnElement;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/messages.properties b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/messages.properties
new file mode 100644
index 00000000000..a340ff643da
--- /dev/null
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/messages.properties
@@ -0,0 +1 @@
+GetDiffElementLabel_StereotypeAppliedOnAnElement=The stereotype {0} has been applied on the element
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java
index 60b476b7d8d..5f6fa9af8cb 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java
@@ -15,6 +15,7 @@
package org.eclipse.papyrus.uml.compare.diff.queries;
import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
import org.eclipse.emf.compare.diff.metamodel.AttributeChange;
import org.eclipse.emf.compare.diff.metamodel.AttributeChangeLeftTarget;
import org.eclipse.emf.compare.diff.metamodel.AttributeChangeRightTarget;
@@ -31,6 +32,7 @@ import org.eclipse.emf.compare.diff.metamodel.UpdateContainmentFeature;
import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement;
import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
import org.eclipse.emf.compare.diff.provider.DiffElementItemProvider;
+import org.eclipse.emf.compare.uml2diff.UMLStereotypeApplicationAddition;
import org.eclipse.emf.compare.uml2diff.UMLStereotypeUpdateAttribute;
import org.eclipse.emf.compare.util.AdapterUtils;
import org.eclipse.emf.ecore.EObject;
@@ -45,6 +47,7 @@ import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.CustomizationAndViewerActionDispatcher;
import org.eclipse.papyrus.infra.tools.util.EditorHelper;
import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
+import org.eclipse.papyrus.uml.compare.diff.messages.Messages;
import org.eclipse.ui.IEditorPart;
/**
@@ -196,7 +199,13 @@ public class GetDiffElementLabel implements IJavaModelQuery<EObject, String> {
//TODO : not tested
//TODO : useful ?
UpdateModelElement updateModelElement = (UpdateModelElement)context;
- diffLabel = itemProvider.getString("_UI_UpdateModelElement_type") + " " + updateModelElement.isConflicting(); //$NON-NLS-1$ //$NON-NLS-2$
+ diffLabel = ""; //$NON-NLS-1$
+ if(updateModelElement instanceof UMLStereotypeApplicationAddition){
+ diffLabel = NLS.bind(Messages.GetDiffElementLabel_StereotypeAppliedOnAnElement,labelProvider.getText(((UMLStereotypeApplicationAddition)updateModelElement).getStereotype()));
+ }
+ else{
+ diffLabel = itemProvider.getString("_UI_UpdateModelElement_type") + " " + updateModelElement.isConflicting(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
} else if(context instanceof ModelElementChangeLeftTarget) { //comes from ModelElementChangeLeftTargetItemProvider
//TODO : not tested
final ModelElementChangeLeftTarget operation = (ModelElementChangeLeftTarget)context;
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java
index a84fcb3074c..b9a1b0de840 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java
@@ -41,10 +41,10 @@ import org.eclipse.uml2.uml.util.UMLUtil;
public class UMLMatchEngine extends UMLStandaloneMatchEngine {//GenericMatchEngine {
/** the left object to compare */
- private EObject leftObject;
+ protected EObject leftObject;
/** the right object to compare */
- private EObject rightObject;
+ protected EObject rightObject;
/**
*
diff --git a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java
index 31c7934a96f..ea8d7623d68 100644
--- a/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java
+++ b/extraplugins/uml/compare/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java
@@ -17,7 +17,10 @@ import org.eclipse.emf.compare.FactoryException;
import org.eclipse.emf.compare.match.engine.internal.DistinctEcoreSimilarityChecker;
import org.eclipse.emf.compare.match.engine.internal.GenericMatchEngineToCheckerBridge;
import org.eclipse.emf.compare.match.statistic.MetamodelFilter;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.util.UMLUtil;
//TODO : verify the upper class for UML
/**
@@ -72,6 +75,16 @@ public class UMLSimilarityChecker extends DistinctEcoreSimilarityChecker {
return true;
}
}
+ //if the 2 elements are stereotypes applications, they are similar if the elements on which they are applied are similar
+ final Element base1 = UMLUtil.getBaseElement(obj1);
+ final Element base2 = UMLUtil.getBaseElement(obj2);
+ if(base1 != null && base2 != null) {
+ final EClass eClass1 = obj1.eClass();
+ final EClass eClass2 = obj2.eClass();
+ if(eClass1 == eClass2) {
+ return isSimilar(base1, base2);
+ }
+ }
return super.isSimilar(obj1, obj2);
}
}

Back to the top