Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsma Smaoui2020-09-25 13:49:00 +0000
committerPatrick Tessier2020-10-08 12:04:22 +0000
commitd8ae065d19e7e79963c5fde29447880cb74a1d4a (patch)
tree63e727b984e5f702919a407bddedc2f772b865cd /plugins
parentb92bffae3d7986b34ee81363260503fc58b8a986 (diff)
downloadorg.eclipse.papyrus-d8ae065d19e7e79963c5fde29447880cb74a1d4a.tar.gz
org.eclipse.papyrus-d8ae065d19e7e79963c5fde29447880cb74a1d4a.tar.xz
org.eclipse.papyrus-d8ae065d19e7e79963c5fde29447880cb74a1d4a.zip
Bug 567354 - [Properties] edit button for MultiReferenceEditor did not
work for stereotyped elements https://bugs.eclipse.org/bugs/show_bug.cgi?id=567354 Change-Id: I21964d93dfd5e1bb64f33437695be5ccd5f6fe1f Signed-off-by: Asma Smaoui <asma.smaoui@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java
index 422c9b70b98..093f85b5343 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010,2020 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,14 +10,17 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Asma Smaoui (CEA LIST) asma.smaoui@cea.fr - Bug 567354
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.constraints;
import java.lang.ref.WeakReference;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.constraints.SimpleConstraint;
import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint;
import org.eclipse.papyrus.infra.constraints.constraints.Constraint;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Stereotype;
@@ -25,8 +28,6 @@ import org.eclipse.uml2.uml.Stereotype;
/**
* A constraint to test if the given object is a UML Element and
* has the given Stereotype
- *
- * @author Camille Letavernier
*/
public class HasStereotypeConstraint extends AbstractConstraint {
@@ -48,12 +49,20 @@ public class HasStereotypeConstraint extends AbstractConstraint {
@Override
public boolean match(Object selection) {
- Element element = UMLUtil.resolveUMLElement(selection);
+
+ Element element = null;
+ EObject eobject = EMFHelper.getEObject(selection);
+ if (eobject instanceof Element) {
+ element = (Element) eobject;
+ } else {
+ element = org.eclipse.uml2.uml.util.UMLUtil.getBaseElement((EObject) selection);
+ }
+
if (element == null) {
return false;
}
- umlElement = new WeakReference<Element>(element);
+ umlElement = new WeakReference<>(element);
Stereotype stereotype = UMLUtil.getAppliedStereotype(element, stereotypeName, false);
return stereotype != null;

Back to the top