Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsma Smaoui2018-04-09 13:27:40 +0000
committerPatrick Tessier2018-04-16 13:00:12 +0000
commit58dd92ea7bba42cd32a076b4a27886af6781afc3 (patch)
treef37392b715b1ad2617bc0f01383ec0df4e9a47bf
parent2630ded2db3a86b6eda0989158048e6fc2b19fea (diff)
downloadorg.eclipse.papyrus-58dd92ea7bba42cd32a076b4a27886af6781afc3.tar.gz
org.eclipse.papyrus-58dd92ea7bba42cd32a076b4a27886af6781afc3.tar.xz
org.eclipse.papyrus-58dd92ea7bba42cd32a076b4a27886af6781afc3.zip
Bug 533382 - [CSS] CSS "connectorEndType" property
* add a connecctoEndType property to modify a connector shape according to the type of its conenctable elements Change-Id: I85f584733df25be614c050ac5f7eb13a038f1aff Signed-off-by: Asma Smaoui <asma.smaoui@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/META-INF/MANIFEST.MF3
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java22
2 files changed, 24 insertions, 1 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/META-INF/MANIFEST.MF
index e1fd857ad80..88a670c8b35 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/META-INF/MANIFEST.MF
@@ -2,7 +2,8 @@ Manifest-Version: 1.0
Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.css;bundle-version="[2.1.0,3.0.0)";visibility:=reexport,
org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)",
org.eclipse.e4.ui.css.core;bundle-version="[0.11.0,1.0.0)",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.uml.service.types;bundle-version="[3.1.0,4.0.0)"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 2.0.0.qualifier
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 4ed569fe411..484e7b0be3b 100755
--- 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
@@ -13,6 +13,7 @@
* Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 517679
* Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 431940
* Alain Le Guennec (Esterel Technologies SAS) - Bug 521575
+ * Asma Smaoui (CEA LIST) - Bug 533382
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.css.dom;
@@ -23,6 +24,7 @@ import static org.eclipse.papyrus.uml.diagram.common.stereotype.IStereotypePrope
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
@@ -37,7 +39,11 @@ 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.papyrus.uml.service.types.utils.ConnectorUtils;
import org.eclipse.uml2.uml.AcceptEventAction;
+import org.eclipse.uml2.uml.ConnectableElement;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.ConnectorEnd;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Event;
import org.eclipse.uml2.uml.NamedElement;
@@ -65,6 +71,11 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
private static final String STEREOTYPE_REFERENCE_EDGE_SOURCE_APPLIED_STEREOTYPES_PROPERTY = "sourceAppliedStereotypes";//$NON-NLS-1$
/**
+ * CSS property to access the connected elements type of a connector
+ */
+ private static final String CONNECTOR_END_TYPE_PROPERTY = "connectorEndType"; //$NON-NLS-1$
+
+ /**
* Name of the CSS Simple Selector to match on the Stereotype Compartment Shape
*/
private static final String STEREOTYPE_COMMENT = "StereotypeComment"; //$NON-NLS-1$
@@ -251,6 +262,17 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
return String.valueOf(false);
}
}
+ if (CONNECTOR_END_TYPE_PROPERTY.equals(attr) && semanticElement instanceof Connector) {
+ EList<ConnectorEnd> ends = ((Connector) semanticElement).getEnds();
+ if (ends != null && !ends.isEmpty()) {
+ // check that both connectable elements have the same type before returning the type
+ ConnectableElement source = new ConnectorUtils().getSourceConnectorEnd((Connector) semanticElement).getRole();
+ ConnectableElement target = new ConnectorUtils().getTargetConnectorEnd((Connector) semanticElement).getRole();
+ if (source.getType() != null && target.getType() != null && source.getType().equals(target.getType())) {
+ return source.getType().getName();
+ }
+ }
+ }
}
// manage of stereotype reference link

Back to the top