Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2019-11-17 21:23:08 +0000
committerAnsgar Radermacher2019-11-18 13:02:14 +0000
commit366a0fc2e1ff16d6c5f735aedddd798a3bdfeac0 (patch)
treefc189b2289af48991672f0987c1cf75abb177e07
parentd159fd79d85c66ba619857283937d97618789a4e (diff)
downloadorg.eclipse.papyrus-366a0fc2e1ff16d6c5f735aedddd798a3bdfeac0.tar.gz
org.eclipse.papyrus-366a0fc2e1ff16d6c5f735aedddd798a3bdfeac0.tar.xz
org.eclipse.papyrus-366a0fc2e1ff16d6c5f735aedddd798a3bdfeac0.zip
Bug 551377 - [PropertyView] The class StereotypeModelElement must return ObservableValue dedicated to Stereotype Property edition
- Check, whether a sub-stereotype is applied on the passed model element Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr> Change-Id: I721927e2ee4b801e7c244220f33bbfd64325f304
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
index 921666e7256..d59d22f0c61 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/StereotypeModelElement.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2017 CEA LIST.
+ * Copyright (c) 2010, 2017, 2019 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,13 +10,15 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - bug 453445, 515650
- * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 502533
- * Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - Bug 551377
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - bug 453445, 515650
+ * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - bug 502533
+ * Vincent LORENZO (CEA LIST) vincent.lorenzo@cea.fr - bug 551377
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - bug 551377
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.modelelement;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.databinding.observable.IObservable;
@@ -108,13 +110,22 @@ public class StereotypeModelElement extends EMFModelElement implements ILabeledM
final Element baseElement = org.eclipse.uml2.uml.util.UMLUtil.getBaseElement(source);
+ // determine stereotype to use
+ Stereotype useStereotype = stereotype;
+ if (baseElement.getStereotypeApplication(stereotype) == null) {
+ // stereotype is not applied, use first applied sub-stereotype
+ Iterator<Stereotype> stereoIter = baseElement.getAppliedSubstereotypes(stereotype).iterator();
+ if (stereoIter.hasNext()) {
+ useStereotype = stereoIter.next();
+ }
+ }
if (feature.getUpperBound() != 1) {
List<?> wrappedList = (List<?>) source.eGet(feature);
// this observable uses the SetStereotypeValueRequest
- return new StereotypePropertyObservableList(wrappedList, domain, baseElement, feature, stereotype);
+ return new StereotypePropertyObservableList(wrappedList, domain, baseElement, feature, useStereotype);
}
// this observable uses the SetStereotypeValueRequest
- return new StereotypePropertyObservableValue(baseElement, feature, domain, stereotype);
+ return new StereotypePropertyObservableValue(baseElement, feature, domain, useStereotype);
}
/**

Back to the top