diff options
author | Nicolas FAUVERGUE | 2015-07-29 13:27:00 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-07-31 12:44:23 +0000 |
commit | cb996a76fe6f57dcbe6bc62465f73e9254845703 (patch) | |
tree | 2e014e8eefd37919c65694fe1fc79d526e6b3864 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus | |
parent | 4d94639ce51c5826dfe29d151cbf386d940e520f (diff) | |
download | org.eclipse.papyrus-cb996a76fe6f57dcbe6bc62465f73e9254845703.tar.gz org.eclipse.papyrus-cb996a76fe6f57dcbe6bc62465f73e9254845703.tar.xz org.eclipse.papyrus-cb996a76fe6f57dcbe6bc62465f73e9254845703.zip |
Bug 472932: [Stereotype Display] Impossible to hide IBD Port Stereotype
Label with CSS
https://bugs.eclipse.org/bugs/show_bug.cgi?id=472932
- Manage the DurationObservation and TimeObservation stereotype display
in Class Diagram
- Manage the Port stereotype display in Component Diagram
- Manage the DurationObservation, Parameter, Port and TimeObservation
stereotype display in Composite Diagram
Change-Id: I94bec687c963c672ff4e8626df5880f27a9f8b43
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus')
3 files changed, 150 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomDurationObservationStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomDurationObservationStereotypeLabelEditPart.java new file mode 100644 index 00000000000..3267986a22c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomDurationObservationStereotypeLabelEditPart.java @@ -0,0 +1,71 @@ +/**
+ * Copyright (c) 2015 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 472932
+ */
+package org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part;
+
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DurationObservationStereotypeLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+
+/**
+ * The custom edit policy for the duration observation stereotype label.
+ */
+public class CustomDurationObservationStereotypeLabelEditPart extends DurationObservationStereotypeLabelEditPart {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ * The view
+ */
+ public CustomDurationObservationStereotypeLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * Redefine the refresh label to get the STEREOTYPE_LABEL_POLICY if exist and don't recalculate the text.
+ *
+ * @see org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart#refreshLabel()
+ */
+ @Override
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ // Bug 472932 : Stereotype is always displayed
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomTimeObservationStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomTimeObservationStereotypeLabelEditPart.java new file mode 100644 index 00000000000..d4905a3fb3b --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/edit/part/CustomTimeObservationStereotypeLabelEditPart.java @@ -0,0 +1,71 @@ +/**
+ * Copyright (c) 2015 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 472932
+ */
+package org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part;
+
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TimeObservationStereotypeLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+
+/**
+ * The custom edit policy for the time observation stereotype label.
+ */
+public class CustomTimeObservationStereotypeLabelEditPart extends TimeObservationStereotypeLabelEditPart {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ * The view
+ */
+ public CustomTimeObservationStereotypeLabelEditPart(final View view) {
+ super(view);
+ }
+
+ /**
+ * Redefine the refresh label to get the STEREOTYPE_LABEL_POLICY if exist and don't recalculate the text.
+ *
+ * @see org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart#refreshLabel()
+ */
+ @Override
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ }
+ // Bug 472932 : Stereotype is always displayed
+ if (maskLabelPolicy == null) {
+ maskLabelPolicy = getEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY);
+ }
+ if (maskLabelPolicy == null) {
+ View view = (View) getModel();
+ if (view.isVisible()) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ } else {
+ setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
+ setLabelIconHelper(getFigure(), null);
+ }
+ }
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java index a373a64048e..bbdd9c10eec 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/factory/CustomUMLEditPartFactory.java @@ -27,8 +27,10 @@ import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CTargetISLinkLabel import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomConstraintEditPart; import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomDurationObservationEditPart; import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomDurationObservationFloatingNameEditPart; +import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomDurationObservationStereotypeLabelEditPart; import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomTimeObservationEditPart; import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomTimeObservationFloatingNameEditPart; +import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.CustomTimeObservationStereotypeLabelEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationClassRoleSourceEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationClassRoleTargetEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.AssociationSourceNameEditPart; @@ -37,12 +39,14 @@ import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ConstraintEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyBranchEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DurationObservationEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DurationObservationFloatingNameEditPart; +import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DurationObservationStereotypeLabelEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPartCN; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPartTN; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.SourceISLinkLabelEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TargetISLinkLabelEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TimeObservationEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TimeObservationFloatingNameEditPart; +import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.TimeObservationStereotypeLabelEditPart; import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.UMLEditPartFactory; import org.eclipse.papyrus.uml.diagram.clazz.part.UMLVisualIDRegistry; @@ -84,6 +88,10 @@ public class CustomUMLEditPartFactory extends UMLEditPartFactory { return new CSourceISLinkLabelEditPart(view); case TargetISLinkLabelEditPart.VISUAL_ID: return new CTargetISLinkLabelEditPart(view); + case DurationObservationStereotypeLabelEditPart.VISUAL_ID: + return new CustomDurationObservationStereotypeLabelEditPart(view); + case TimeObservationStereotypeLabelEditPart.VISUAL_ID: + return new CustomTimeObservationStereotypeLabelEditPart(view); } } return super.createEditPart(context, model); |