Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java61
1 files changed, 49 insertions, 12 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
index 248e0bcc748..e29ea75df43 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
@@ -8,7 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotypes Display
+ * Celine Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 455311 : Refactor Stereotypes Display
+ * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - bug 461489: add supports of AcceptEventAction
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.css.dom;
@@ -29,10 +30,14 @@ import org.eclipse.papyrus.infra.tools.util.ListHelper;
import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant;
import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil;
import org.eclipse.papyrus.uml.diagram.css.helper.CSSDOMUMLSemanticElementHelper;
+import org.eclipse.uml2.uml.AcceptEventAction;
import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Event;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.TimeEvent;
+import org.eclipse.uml2.uml.Trigger;
/**
* DOM Element Adapter for UML Elements
@@ -50,11 +55,13 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
*/
private static final String STEREOTYPE_COMMENT = "StereotypeComment"; //$NON-NLS-1$
-
- // Helpers
+ /** The stereotype helper. */
public final StereotypeDisplayUtil stereotypeHelper = StereotypeDisplayUtil.getInstance();
+ /** The Constant IS_TIME_EVENT_ACTION. */
+ private static final String IS_TIME_EVENT_ACTION_PROPERTY = "isTimeEventAction"; //$NON-NLS-1$
+ /** The Constant APPLIED_STEREOTYPES_PROPERTY. */
public static final String APPLIED_STEREOTYPES_PROPERTY = "appliedStereotypes"; //$NON-NLS-1$
@@ -162,14 +169,46 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
}
}
}
+ // manage of isTimeEventAction=true attribute for AcceptEventAction
+ if (IS_TIME_EVENT_ACTION_PROPERTY.equals(attr)) {
+ if (semanticElement instanceof AcceptEventAction) {
+ return String.valueOf(isAcceptTimeEventAction((AcceptEventAction) semanticElement));
+ }
+ }
}
return null;
}
+ /**
+ * Checks if is accept time event action.
+ *
+ * @param action
+ * the action
+ * @return true, if is accept time event action
+ */
+ public static boolean isAcceptTimeEventAction(AcceptEventAction action) {
+ boolean hasTimeEvent = false;
+ boolean hasOthersTriggers = false;
+ // Get triggers
+ if (action.getTriggers() != null) {
+ for (Trigger trigger : action.getTriggers()) {
+ if (trigger != null) {
+ Event event = trigger.getEvent();
+ if (event instanceof TimeEvent) {
+ hasTimeEvent = true;
+ } else {
+ hasOthersTriggers = true;
+ }
+ }
+ }
+ }
+ // only time events have been encountered.
+ return hasTimeEvent && !hasOthersTriggers;
+ }
/**
* Retrieve the Matching String Value for the StereotypeCompartment Element
- *
+ *
* @param attr
* Attribute of the String to match with
* @return The matching value for this Attribute
@@ -181,12 +220,12 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
return stereotypeHelper.getName(propertyCompartment);
}
- return "";
+ return "";//$NON-NLS-1$
}
/**
* Retrieve the Matching String Value for the StereotypeCompartment Element
- *
+ *
* @param attr
* Attribute of the String to match with
* @return The matching value for this Attribute
@@ -211,13 +250,13 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
}
}
- return "";
+ return "";//$NON-NLS-1$
}
/**
* Get the matching Value of the Attribute
- *
+ *
* @param attr
* Attribute of the String to match with
* @return The matching value for this Attribute
@@ -241,17 +280,15 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
return null;
}
-
-
@Override
protected String getCSSValue(EStructuralFeature feature, Object value) {
if (feature instanceof EReference && value instanceof NamedElement) {
- return ((NamedElement) value).getName();
+ String name = ((NamedElement) value).getName();
+ return name == null || name.isEmpty() ? EMPTY_VALUE : name; // Bug 467716: Never return null or empty string if the value is not null
}
return super.getCSSValue(feature, value);
}
-
/**
* @see org.eclipse.papyrus.infra.gmfdiag.css.dom.GMFElementAdapter#getLocalName()
*

Back to the top