Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaadia Dhouib2015-03-13 10:48:14 +0000
committersdhouib2015-05-28 12:59:30 +0000
commit1feec0aec5250f6ac60db9bd7e0dcf65b8a8bf31 (patch)
tree0b410dd57dee378ace0f8f2b52d3798128ba7fb8 /extraplugins
parent0c7813f94e0a6a92b29b2d1a5a12d42ffaeb7233 (diff)
downloadorg.eclipse.papyrus-1feec0aec5250f6ac60db9bd7e0dcf65b8a8bf31.tar.gz
org.eclipse.papyrus-1feec0aec5250f6ac60db9bd7e0dcf65b8a8bf31.tar.xz
org.eclipse.papyrus-1feec0aec5250f6ac60db9bd7e0dcf65b8a8bf31.zip
Resolving Bug #462061 [Composite Structure Diagram] Display of
stereotype's icon on ports Resolving Bug #462062 [RobotML Diagrams] Display of ports icons
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/css/style.css2
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicies/PortNodeLabelDisplayEditPolicy.java2
-rw-r--r--extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicy/provider/RobotMLDiagramsEditPolicyProvider.java56
3 files changed, 35 insertions, 25 deletions
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/css/style.css b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/css/style.css
index abcf14dcf50..320ae53c773 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/css/style.css
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/css/style.css
@@ -1,5 +1,5 @@
Property {maskLabel:name; elementIcon:false;}
Property[type] {maskLabel:name type; }
-Port>Label {maskLabel:name; elementIcon:flase;}
+Port {maskLabel:name;}
Port>Label:stereotype{visible: false;}
Class {elementIcon:false;} \ No newline at end of file
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicies/PortNodeLabelDisplayEditPolicy.java b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicies/PortNodeLabelDisplayEditPolicy.java
index 01216cfb0d2..52062f2d1d5 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicies/PortNodeLabelDisplayEditPolicy.java
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicies/PortNodeLabelDisplayEditPolicy.java
@@ -51,7 +51,7 @@ public class PortNodeLabelDisplayEditPolicy extends AppliedStereotypeNodeLabelDi
// retrieve the first stereotype in the list of displayed stereotype
- // String firstStereotypeName = tokenizer.nextToken();
+
EList<Stereotype> stereotype_list = getUMLElement().getAppliedStereotypes();
if (stereotype_list.size() != 0) {
Stereotype stereotype = stereotype_list.get(0);
diff --git a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicy/provider/RobotMLDiagramsEditPolicyProvider.java b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicy/provider/RobotMLDiagramsEditPolicyProvider.java
index 6e63543f3e2..141e92434ff 100644
--- a/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicy/provider/RobotMLDiagramsEditPolicyProvider.java
+++ b/extraplugins/robotml/org.eclipse.papyrus.robotml.diagram.common/src/org/eclipse/papyrus/robotml/diagram/common/editpolicy/provider/RobotMLDiagramsEditPolicyProvider.java
@@ -11,6 +11,8 @@
*****************************************************************************/
package org.eclipse.papyrus.robotml.diagram.common.editpolicy.provider;
+import java.util.Iterator;
+
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
@@ -32,6 +34,7 @@ import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabe
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Profile;
public class RobotMLDiagramsEditPolicyProvider extends AbstractProvider
implements IEditPolicyProvider {
@@ -61,29 +64,36 @@ public class RobotMLDiagramsEditPolicyProvider extends AbstractProvider
if (editPart.getModel() instanceof View) {
EObject element = ((View) editPart.getModel()).getElement();
if (element instanceof Element) {
- if (((Element) element).getNearestPackage().getAppliedProfile(
- ROBOTML_ID) != null) {
- // System.err.println(list.get(i).getProfile().getName());
- if (editPart instanceof PortEditPart) {
- NotificationListener editPolicy = new PortNodeLabelDisplayEditPolicy();
- editPart.installEditPolicy(
- AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY,
- (EditPolicy) editPolicy);
- Object model = editPart.getModel();
- LayoutConstraint notifier = ((Shape) model)
- .getLayoutConstraint();
- if (model instanceof Shape) {
- // to force refreshing the port icon when the
- // diagram is opening
- Notification notification = new ENotificationImpl(
- (InternalEObject) notifier,
- Notification.SET,
- NotationPackage.eINSTANCE.getLocation_X(),
- 0, 0);
- editPolicy.notifyChanged(notification);
- }
- }
- }
+
+ Iterator<Profile> itr = ((Element) element).getNearestPackage().getAllAppliedProfiles().iterator();
+ while(itr.hasNext()) {
+ Profile profile = itr.next();
+
+ if(profile.getName().equals(ROBOTML_ID))
+ {
+
+ if (editPart instanceof PortEditPart) {
+ NotificationListener editPolicy = new PortNodeLabelDisplayEditPolicy();
+ editPart.installEditPolicy(
+ AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY,
+ (EditPolicy) editPolicy);
+ Object model = editPart.getModel();
+ LayoutConstraint notifier = ((Shape) model)
+ .getLayoutConstraint();
+ if (model instanceof Shape) {
+ // to force refreshing the port icon when the
+ // diagram is opening
+ Notification notification = new ENotificationImpl(
+ (InternalEObject) notifier,
+ Notification.SET,
+ NotationPackage.eINSTANCE.getLocation_X(),
+ 0, 0);
+ editPolicy.notifyChanged(notification);
+ }
+ }
+ }
+ }
+
}
}
}

Back to the top