diff options
author | Fanch BONNABESSE | 2017-11-07 15:31:18 +0000 |
---|---|---|
committer | Vincent Lorenzo | 2017-11-16 08:56:05 +0000 |
commit | 204da4c9f3dbbd6ac4cdd86a06d24ed6bb12f09b (patch) | |
tree | dafb38921f398f90f831f0a73207d284c88f0d27 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component | |
parent | 6f2e77515dcd40a801c2e25c7dba1099692c7cc9 (diff) | |
download | org.eclipse.papyrus-204da4c9f3dbbd6ac4cdd86a06d24ed6bb12f09b.tar.gz org.eclipse.papyrus-204da4c9f3dbbd6ac4cdd86a06d24ed6bb12f09b.tar.xz org.eclipse.papyrus-204da4c9f3dbbd6ac4cdd86a06d24ed6bb12f09b.zip |
Bug 525463: [SysML 1.1] Dash line not present when moving a floating
label
https://bugs.eclipse.org/bugs/show_bug.cgi?id=525463
Add an interface to check the modification of the EditPolicy.
Change-Id: Idb9b180ed38b0503f657b9dd33d51b1e8a963b58
Signed-off-by: Fanch BONNABESSE <fanch.bonnabesse@all4tec.net>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/part/CustomPortAppliedStereotypeEditPart.java | 147 |
1 files changed, 75 insertions, 72 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/part/CustomPortAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/part/CustomPortAppliedStereotypeEditPart.java index a59a7c9f8e0..5d1c6585165 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/part/CustomPortAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/part/CustomPortAppliedStereotypeEditPart.java @@ -1,72 +1,75 @@ -/**
- * 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.component.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.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.component.edit.parts.PortAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
-
-/**
- * The custom edit policy for the port applied stereotype.
- * @since 3.0
- */
-public class CustomPortAppliedStereotypeEditPart extends PortAppliedStereotypeEditPart {
-
- /**
- * Constructor.
- *
- * @param view The view
- */
- public CustomPortAppliedStereotypeEditPart(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.component.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();
- }
- }
-}
+/** + * Copyright (c) 2015, 2017 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 + * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 525463 + */ +package org.eclipse.papyrus.uml.diagram.component.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.common.editparts.IFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.component.edit.parts.PortAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy; + +/** + * The custom edit policy for the port applied stereotype. + * + * @since 3.0 + */ +public class CustomPortAppliedStereotypeEditPart extends PortAppliedStereotypeEditPart implements IFloatingLabelEditPart { + + /** + * Constructor. + * + * @param view + * The view + */ + public CustomPortAppliedStereotypeEditPart(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.component.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(); + } + } +} |