Bug 519323 - [CSS] GMFSYSMLElementAdapter does not support
typeAppliedStereotype CSS attribute
- Copy-paste the snippet from the UML adapter into the SysML adapter, so
the latter supports the typeAppliedStereotypes CSS attribute
Change-Id: Id29b2c740b7ffc956e64b039c9a97c410996384d
Signed-off-by: Shuai Li <shuai.li@cea.fr>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/css/dom/GMFSYSMLElementAdapter.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/css/dom/GMFSYSMLElementAdapter.java
index cfa6f26..417b4f1 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/css/dom/GMFSYSMLElementAdapter.java
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/css/dom/GMFSYSMLElementAdapter.java
@@ -44,6 +44,8 @@
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.TimeEvent;
import org.eclipse.uml2.uml.Trigger;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.TypedElement;
/**
* DOM Element Adapter for SYSML Elements
@@ -75,6 +77,9 @@
/** The Constant APPLIED_STEREOTYPES_PROPERTY. */
public static final String APPLIED_STEREOTYPES_PROPERTY = "appliedStereotypes"; //$NON-NLS-1$
+
+ /** The Constant TYPE_APPLIED_STEREOTYPES_PROPERTY */
+ private static final String TYPE_APPLIED_STEREOTYPES_PROPERTY = "typeAppliedStereotypes"; //$NON-NLS-1$
/** The Constant DEPRECATED. */
public static final String DEPRECATED = "deprecated"; //$NON-NLS-1$
@@ -182,6 +187,22 @@
}
return null;
}
+
+ if (TYPE_APPLIED_STEREOTYPES_PROPERTY.equals(attr) && semanticElement instanceof TypedElement) {
+ Type type = ((TypedElement) semanticElement).getType();
+ if (type != null) {
+ List<String> appliedStereotypes = new LinkedList<>();
+ for (Stereotype stereotype : type.getAppliedStereotypes()) {
+ appliedStereotypes.add(stereotype.getName());
+ appliedStereotypes.add(stereotype.getQualifiedName());
+ }
+
+ if (!appliedStereotypes.isEmpty()) {
+ return ListHelper.deepToString(appliedStereotypes, CSS_VALUES_SEPARATOR);
+ }
+ }
+ }
+
for (EObject stereotypeApplication : currentElement.getStereotypeApplications()) {
EStructuralFeature feature = stereotypeApplication.eClass().getEStructuralFeature(attr);
if (feature != null) {