summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Wouters2014-02-27 02:55:58 (EST)
committerLaurent Wouters2014-02-27 04:25:56 (EST)
commita25fb2153a8f54f539f8508d4081aba794ba8733 (patch)
treec0ee8595150776178eec6af94bcb2ef1176eeb6a
parentdb21597e8d7c8c22c8cd2c8adb306d7d4807efd3 (diff)
downloadorg.eclipse.papyrus-a25fb2153a8f54f539f8508d4081aba794ba8733.zip
org.eclipse.papyrus-a25fb2153a8f54f539f8508d4081aba794ba8733.tar.gz
org.eclipse.papyrus-a25fb2153a8f54f539f8508d4081aba794ba8733.tar.bz2
408102: Control the display of stereotypes with CSS properties
https://bugs.eclipse.org/bugs/show_bug.cgi?id=4408102 Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java23
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java3
3 files changed, 36 insertions, 5 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
index 3e3d4bf..deabbfa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
@@ -34,6 +34,15 @@ import org.eclipse.uml2.uml.NamedElement;
*/
public abstract class NamedElementEditPart extends UMLNodeEditPart implements IUMLNamedElementEditPart {
+ /**
+ * CSS boolean property controlling whether stereotypes should be displayed
+ */
+ public static final String DISPLAY_STEREOTYPES = "displayStereotypes";
+
+ /**
+ * CSS boolean property controlling whether tags should be displayed
+ */
+ public static final String DISPLAY_TAGS = "displayTags";
/**
@@ -85,14 +94,24 @@ public abstract class NamedElementEditPart extends UMLNodeEditPart implements IU
protected void refreshLabelDisplay() {
View view = getNotationView();
BooleanValueStyle displayNameStyle = (BooleanValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), NameDisplayEditPolicy.DISPLAY_NAME);
+ BooleanValueStyle displayStereotypes = (BooleanValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_STEREOTYPES);
+ BooleanValueStyle displayTags = (BooleanValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_TAGS);
if(displayNameStyle != null && !displayNameStyle.isBooleanValue()) {
getNodeNamedElementFigure().removeNameLabel();
getNodeNamedElementFigure().removeStereotypeLabel();
getNodeNamedElementFigure().removeTaggedLabel();
} else {
getNodeNamedElementFigure().restoreNameLabel();
- getNodeNamedElementFigure().restoreStereotypeLabel();
- getNodeNamedElementFigure().restoreTaggedLabel();
+ if (displayStereotypes != null && !displayStereotypes.isBooleanValue()) {
+ getNodeNamedElementFigure().removeStereotypeLabel();
+ } else {
+ getNodeNamedElementFigure().restoreStereotypeLabel();
+ }
+ if (displayTags != null && !displayTags.isBooleanValue()) {
+ getNodeNamedElementFigure().removeTaggedLabel();
+ } else {
+ getNodeNamedElementFigure().restoreTaggedLabel();
+ }
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
index 243b254..0f38a5b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AppliedStereotypeNodeLabelDisplayEditPolicy.java
@@ -14,11 +14,15 @@
package org.eclipse.papyrus.uml.diagram.common.editpolicies;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.swt.graphics.Image;
@@ -55,7 +59,7 @@ public class AppliedStereotypeNodeLabelDisplayEditPolicy extends AppliedStereoty
// if (stereotypesToDisplay != "" || imageToDisplay != null) {
if(figure instanceof IPapyrusNodeUMLElementFigure) {
((IPapyrusNodeUMLElementFigure)figure).setStereotypeDisplay(tag + (stereotypesOnlyToDisplay().equals("") ? stereotypesToDisplay : stereotypesToDisplay), imageToDisplay);
- refreshAppliedStereotypesProperties(((IPapyrusNodeUMLElementFigure)figure));
+ refreshAppliedStereotypesProperties(((IPapyrusNodeNamedElementFigure) figure));
}
// TODO we should manage PapyrusNodeFigure here too (and
// WrappingLabel ?)
@@ -65,11 +69,18 @@ public class AppliedStereotypeNodeLabelDisplayEditPolicy extends AppliedStereoty
/**
* Refreshes the displayed stereotypes properties for this edit part.
*/
- protected void refreshAppliedStereotypesProperties(IPapyrusNodeUMLElementFigure figure) {
+ protected void refreshAppliedStereotypesProperties(IPapyrusNodeNamedElementFigure figure) {
final String stereotypesPropertiesToDisplay = AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay((View)getHost().getModel());
refreshAppliedStereotypesPropertiesInCompartment(stereotypesPropertiesToDisplay, figure);
refreshAppliedStereotypesPropertiesInBrace(stereotypesPropertiesToDisplay, figure);
+
+ BooleanValueStyle displayStereotypes = (BooleanValueStyle) getView().getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), NamedElementEditPart.DISPLAY_STEREOTYPES);
+ if (displayStereotypes != null && !displayStereotypes.isBooleanValue()) {
+ figure.removeStereotypeLabel();
+ } else {
+ figure.restoreStereotypeLabel();
+ }
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
index e952504..d162c87 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
@@ -50,7 +51,7 @@ public class InteractionOperandAppliedStereotypeLabelDisplayEditPolicy extends A
// if (stereotypesToDisplay != "" || imageToDisplay != null) {
if(figure instanceof IPapyrusNodeUMLElementFigure) {
((IPapyrusNodeUMLElementFigure)figure).setStereotypeDisplay(tag + (stereotypesOnlyToDisplay().equals("") ? stereotypesToDisplay : stereotypesToDisplay), imageToDisplay);
- refreshAppliedStereotypesProperties(((IPapyrusNodeUMLElementFigure)figure));
+ refreshAppliedStereotypesProperties(((IPapyrusNodeNamedElementFigure) figure));
}
}
}