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 | |
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>
13 files changed, 562 insertions, 518 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 index 3267986a22c..15a131ce319 100644 --- 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 @@ -1,71 +1,73 @@ -/**
- * 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();
- }
- }
-}
+/** + * 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.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.editparts.IFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; + +/** + * The custom edit policy for the duration observation stereotype label. + */ +public class CustomDurationObservationStereotypeLabelEditPart extends DurationObservationStereotypeLabelEditPart implements IFloatingLabelEditPart { + + /** + * 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 index d4905a3fb3b..48dc8a01c13 100644 --- 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 @@ -1,71 +1,73 @@ -/**
- * 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();
- }
- }
-}
+/** + * 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.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.editparts.IFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; + +/** + * The custom edit policy for the time observation stereotype label. + */ +public class CustomTimeObservationStereotypeLabelEditPart extends TimeObservationStereotypeLabelEditPart implements IFloatingLabelEditPart { + + /** + * 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.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/FloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/FloatingLabelEditPart.java index 08c0403b6e0..bbff3079a09 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/FloatingLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/FloatingLabelEditPart.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010, 2014 CEA LIST and others. + * Copyright (c) 2010, 2014, 2017 CEA LIST and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation + * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 525463 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.editparts; @@ -27,7 +28,7 @@ import org.eclipse.papyrus.uml.diagram.common.editpolicies.MaskManagedFloatingLa /** * The Class FloatingNameEditPart. */ -public class FloatingLabelEditPart extends PapyrusLabelEditPart implements NamedStyleProperties { +public class FloatingLabelEditPart extends PapyrusLabelEditPart implements NamedStyleProperties, IFloatingLabelEditPart { /** The Constant DEFAULT_LABEL_DISPLAYED. */ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/IFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/IFloatingLabelEditPart.java new file mode 100644 index 00000000000..0446f76c200 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/IFloatingLabelEditPart.java @@ -0,0 +1,21 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * 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: + * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Initial API and implementation, Bug 525463 + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.common.editparts; + +/** + * An interface to check if the Label EditPart must be Floating. + */ +public interface IFloatingLabelEditPart { + // Do Nothing +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java index 952a27e3038..bf5706c05e0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2008 CEA LIST. + * Copyright (c) 2008, 2017 CEA LIST. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 525463 * *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.editpolicies; @@ -33,7 +34,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editparts.IFloatingLabelEditPart; /** * @author Patrick Tessier @@ -66,7 +67,7 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit */ @Override protected EditPolicy createChildEditPolicy(EditPart child) { - if ((child instanceof IBorderItemEditPart) && !(child instanceof FloatingLabelEditPart)) { + if ((child instanceof IBorderItemEditPart) && !(child instanceof IFloatingLabelEditPart)) { // return new BorderItemSelectionEditPolicy(); return new BorderItemResizableEditPolicy(); } @@ -97,7 +98,7 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit */ @Override protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) { - + return super.getConstraintFor(request, child); } @@ -107,7 +108,7 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit */ @Override protected Object getConstraintFor(Point point) { - + return null; } @@ -126,7 +127,7 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit */ @Override protected Command getCreateCommand(CreateRequest request) { - + return null; } 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(); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomDurationObservationStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomDurationObservationStereotypeLabelEditPart.java index 21f434ebdf6..3532f93239f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomDurationObservationStereotypeLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomDurationObservationStereotypeLabelEditPart.java @@ -1,71 +1,73 @@ -/**
- * 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.composite.custom.edit.parts;
-
-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.composite.edit.parts.DurationObservationStereotypeLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
-
-/**
- * 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();
- }
- }
-}
+/** + * 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.composite.custom.edit.parts; + +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.composite.edit.parts.DurationObservationStereotypeLabelEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy; + +/** + * The custom edit policy for the duration observation stereotype label. + */ +public class CustomDurationObservationStereotypeLabelEditPart extends DurationObservationStereotypeLabelEditPart implements IFloatingLabelEditPart { + + /** + * 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.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomParameterAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomParameterAppliedStereotypeEditPart.java index f8b216c1ca5..6b538419e6e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomParameterAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomParameterAppliedStereotypeEditPart.java @@ -1,71 +1,73 @@ -/**
- * 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.composite.custom.edit.parts;
-
-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.composite.edit.parts.ParameterAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
-
-/**
- * The custom edit policy for the parameter applied stereotype.
- */
-public class CustomParameterAppliedStereotypeEditPart extends ParameterAppliedStereotypeEditPart {
-
- /**
- * Constructor.
- *
- * @param view
- * The view
- */
- public CustomParameterAppliedStereotypeEditPart(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();
- }
- }
-}
+/** + * 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.composite.custom.edit.parts; + +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.composite.edit.parts.ParameterAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy; + +/** + * The custom edit policy for the parameter applied stereotype. + */ +public class CustomParameterAppliedStereotypeEditPart extends ParameterAppliedStereotypeEditPart implements IFloatingLabelEditPart { + + /** + * Constructor. + * + * @param view + * The view + */ + public CustomParameterAppliedStereotypeEditPart(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.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortAppliedStereotypeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortAppliedStereotypeEditPart.java index 997aa7135d9..15c25243bf2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortAppliedStereotypeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortAppliedStereotypeEditPart.java @@ -1,71 +1,73 @@ -/**
- * 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.composite.custom.edit.parts;
-
-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.composite.edit.parts.PortAppliedStereotypeEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
-
-/**
- * The custom edit policy for the port applied stereotype.
- */
-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.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();
- }
- }
-}
+/** + * 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.composite.custom.edit.parts; + +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.composite.edit.parts.PortAppliedStereotypeEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy; + +/** + * The custom edit policy for the port applied stereotype. + */ +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.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.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomTimeObservationStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomTimeObservationStereotypeLabelEditPart.java index ad96a2c4795..711d3150ddb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomTimeObservationStereotypeLabelEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomTimeObservationStereotypeLabelEditPart.java @@ -1,71 +1,73 @@ -/**
- * 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.composite.custom.edit.parts;
-
-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.composite.edit.parts.TimeObservationStereotypeLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy;
-
-/**
- * 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();
- }
- }
-}
+/** + * 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.composite.custom.edit.parts; + +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.composite.edit.parts.TimeObservationStereotypeLabelEditPart; +import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy; + +/** + * The custom edit policy for the time observation stereotype label. + */ +public class CustomTimeObservationStereotypeLabelEditPart extends TimeObservationStereotypeLabelEditPart implements IFloatingLabelEditPart { + + /** + * 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.css/theme/umlBase.css b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css index 06817385acc..b241086f9a5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css @@ -10,7 +10,7 @@ * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - Generic shape default value implementation. Default symbol implementation. * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Bug 471348 * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 507488 - * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 521573 + * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 521573, 525463 *****************************************************************************/ /* Display name in italic when isAbstract=true (bug 464129)*/ @@ -451,7 +451,8 @@ CompositeStructureDiagram TimeObservation > Compartment[kind="symbol"]{ CompositeStructureDiagram DurationObservation > Label, CompositeStructureDiagram TimeObservation > Label, -CompositeStructureDiagram Port > Label{ +CompositeStructureDiagram Port > Label, +CompositeStructureDiagram Parameter > Label{ visible:true; textAlignment:"left"; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen index 1d068d2514e..b30768cb13f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.gmfgen @@ -3045,7 +3045,7 @@ <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="add superclass for floating Label" - genView="/0/@diagram/@topLevelNodes.2/@labels.1 /0/@diagram/@childNodes.2/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@topLevelNodes.4/@labels.1 /0/@diagram/@topLevelNodes.0/@labels.3 /0/@diagram/@childNodes.8/@labels.3 /0/@diagram/@childNodes.6/@labels.3 /0/@diagram/@childNodes.10/@labels.1" + genView="/0/@diagram/@topLevelNodes.2/@labels.1 /0/@diagram/@childNodes.2/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@topLevelNodes.4/@labels.1 /0/@diagram/@topLevelNodes.0/@labels.3 /0/@diagram/@childNodes.8/@labels.3 /0/@diagram/@childNodes.6/@labels.3 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@topLevelNodes.0/@labels.0" name="FloatingLabelEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/> <extensionNodes diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/edit/parts/ActorNameEditPartTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/edit/parts/ActorNameEditPartTN.java index 83c39657da1..bf153660634 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/edit/parts/ActorNameEditPartTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src-gen/org/eclipse/papyrus/uml/diagram/usecase/edit/parts/ActorNameEditPartTN.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014, 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 @@ -8,6 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation + * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 525463 */ package org.eclipse.papyrus.uml.diagram.usecase.edit.parts; @@ -58,18 +59,16 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; import org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil; import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; import org.eclipse.papyrus.uml.diagram.usecase.edit.policies.UMLTextSelectionEditPolicy; import org.eclipse.papyrus.uml.diagram.usecase.part.UMLVisualIDRegistry; import org.eclipse.papyrus.uml.diagram.usecase.providers.UMLElementTypes; @@ -86,7 +85,7 @@ import org.eclipse.uml2.uml.Feature; /** * @generated */ -public class ActorNameEditPartTN extends PapyrusLabelEditPart +public class ActorNameEditPartTN extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart, ILabelRoleProvider { /** @@ -116,12 +115,14 @@ public class ActorNameEditPartTN extends PapyrusLabelEditPart /** * direct edition mode (default, undefined, registered editor, etc.) + * * @generated */ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; /** * configuration from a registered edit dialog + * * @generated */ protected IDirectEditorConfiguration configuration; @@ -708,6 +709,7 @@ public class ActorNameEditPartTN extends PapyrusLabelEditPart /** * Initializes the extended editor configuration + * * @generated */ protected void initExtendedEditorConfiguration() { @@ -723,6 +725,7 @@ public class ActorNameEditPartTN extends PapyrusLabelEditPart /** * Updates the preference configuration + * * @generated */ protected void updateExtendedEditorConfiguration() { @@ -736,10 +739,12 @@ public class ActorNameEditPartTN extends PapyrusLabelEditPart } /** - * Performs the direct edit usually used by GMF editors. - * @param theRequest the direct edit request that starts the direct edit system - * @generated - */ + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @generated + */ protected void performDefaultDirectEditorEdit(final Request theRequest) { // initialize the direct edit manager try { |