diff options
author | Camille Letavernier | 2015-01-07 12:20:37 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-01-07 12:20:37 +0000 |
commit | a6fae553a23163bc85d23a42ff8d26c032ff6ad7 (patch) | |
tree | 8adffb33b0b14253c289cc96120b0f3b148aa4ee /plugins | |
parent | d88a00d47b16bb7ee4e4d8f88e21cc40e33ee5f6 (diff) | |
parent | 919da28e2d8fb93e3253f726e0b74ab13e49a781 (diff) | |
download | org.eclipse.papyrus-a6fae553a23163bc85d23a42ff8d26c032ff6ad7.tar.gz org.eclipse.papyrus-a6fae553a23163bc85d23a42ff8d26c032ff6ad7.tar.xz org.eclipse.papyrus-a6fae553a23163bc85d23a42ff8d26c032ff6ad7.zip |
Merge "436547: [Diagram] All shapes shall be refactored https://bugs.eclipse.org/bugs/show_bug.cgi?id=436547"
Diffstat (limited to 'plugins')
8 files changed, 228 insertions, 163 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java index 3cd4f7d1642..1a9d043408c 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java @@ -42,46 +42,16 @@ import org.eclipse.papyrus.infra.gmfdiag.common.figure.IPapyrusWrappingLabel; import org.eclipse.papyrus.infra.gmfdiag.common.locator.IPapyrusBorderItemLocator; import org.eclipse.papyrus.infra.gmfdiag.common.locator.PapyrusLabelLocator; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.NamedStyleProperties; -public abstract class PapyrusLabelEditPart extends LabelEditPart { +public abstract class PapyrusLabelEditPart extends LabelEditPart implements NamedStyleProperties { /** * Default Margin when not present in CSS */ public static final int DEFAULT_MARGIN = 0; - /** - * CSS Integer property to define the horizontal Label Margin - */ - public static final String TOP_MARGIN_PROPERTY = "topMarginLabel"; //$NON-NLS-1$ - - /** - * CSS Integer property to define the vertical Label Margin - */ - public static final String LEFT_MARGIN_PROPERTY = "leftMarginLabel"; //$NON-NLS-1$ - - /** - * CSS Integer property to define the horizontal Label Margin - */ - public static final String BOTTOM_MARGIN_PROPERTY = "bottomMarginLabel"; //$NON-NLS-1$ - - /** - * CSS Integer property to define the vertical Label Margin - */ - public static final String RIGHT_MARGIN_PROPERTY = "rightMarginLabel"; //$NON-NLS-1$ - - /** The Constant TEXT_ALIGNMENT. */ - public static final String TEXT_ALIGNMENT = "textAlignment"; //$NON-NLS-1$ - - /** The Constant LABEL_OFFSET_Y. */ - public static final String LABEL_OFFSET_Y = "labelOffsetY"; //$NON-NLS-1$ - - /** The Constant LABEL_OFFSET_X. */ - public static final String LABEL_OFFSET_X = "labelOffsetX"; //$NON-NLS-1$ - - /** The Constant LABEL_CONSTRAINED. */ - public static final String LABEL_CONSTRAINED = "labelConstrained"; //$NON-NLS-1$ /** The external label locator. */ protected PapyrusLabelLocator papyrusLabelLocator = null; @@ -384,4 +354,5 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart { } } + } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java index 8347d572d68..a24b0978d66 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java @@ -41,35 +41,24 @@ import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomBoolean import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.figure.OneTopLineResizableBorder; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.NamedStyleProperties; /** * this edit policy has in charge to toggle the border of its edit part's figure. */ -public class BorderDisplayEditPolicy extends GraphicalEditPolicyEx implements IChangeListener, NotificationListener { - - /** The notation NameStyle property to define line position. */ - public static final String LINE_POSITION = "linePosition"; +public class BorderDisplayEditPolicy extends GraphicalEditPolicyEx implements IChangeListener, NotificationListener, NamedStyleProperties { /** The default value for the line position of compartment. */ - private static final String LINE_POSITION_DEFAULT_VALUE = "center"; + private static final String LINE_POSITION_DEFAULT_VALUE = NamedStyleProperties.PositionAsString.CENTER;//$NON-NLS-1$ /** The default value for the line length ratio of compartment. */ - private static final String LINE_LENGTH_RATIO_DEFAULT_VALUE = "1.0"; - - /** The notation NameStyle property to define the line length ratio of compartment's topLine. */ - private static final String LINE_LENGTH_RATIO = "lineLengthRatio"; + private static final String LINE_LENGTH_RATIO_DEFAULT_VALUE = "1.0";//$NON-NLS-1$ /** the default value for the line length of compartment. If the length is set to this default value, the length will be not forced */ private static final int DEFAULT_LENGTH_VALUE = -1; - /** The notation NameStyle property to define the line length of compartment's topLine. */ - public static final String LENGTH = "lineLength"; - - /** The notation NameStyle property to display. */ - public static final String DISPLAY_BORDER = "displayBorder"; - /** key for this edit policy. */ - public final static String BORDER_DISPLAY_EDITPOLICY = "BORDER_DISPLAY_EDITPOLICY"; + public final static String BORDER_DISPLAY_EDITPOLICY = "BORDER_DISPLAY_EDITPOLICY";//$NON-NLS-1$ /** The style observable. */ protected IObservableValue styleObservable; @@ -243,17 +232,17 @@ public class BorderDisplayEditPolicy extends GraphicalEditPolicyEx implements IC // get the value of the CSS property View view = getNotationView(); - String linePosition = NotationUtils.getStringValue(view, LINE_POSITION, LINE_POSITION_DEFAULT_VALUE).toLowerCase(); + String linePosition = NotationUtils.getStringValue(view, LINE_POSITION, LINE_POSITION_DEFAULT_VALUE).toUpperCase(); int position = PositionConstants.CENTER; - if ("left".equals(linePosition)) { + if (NamedStyleProperties.PositionAsString.LEFT.equals(linePosition)) { position = PositionConstants.LEFT; } - if ("right".equals(linePosition)) { + if (NamedStyleProperties.PositionAsString.RIGHT.equals(linePosition)) { position = PositionConstants.RIGHT; } - if ("center".equals(linePosition)) { + if (NamedStyleProperties.PositionAsString.CENTER.equals(linePosition)) { position = PositionConstants.CENTER; } @@ -313,9 +302,7 @@ public class BorderDisplayEditPolicy extends GraphicalEditPolicyEx implements IC } else { break; } - } - return null; } } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java index e7f14718f2e..8ee0bbefbac 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java @@ -25,12 +25,12 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ShapeDisplayCompartmentEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IRoundedRectangleFigure; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.ICSSNamedStyles; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.NamedStyleProperties; /** * The Class RoundedCompartmentEditPart provides refresh method to apply notation properties specific to roundedRectangleFigure */ -public abstract class PapyrusRoundedEditPartHelper implements ICSSNamedStyles { +public abstract class PapyrusRoundedEditPartHelper implements NamedStyleProperties { /** * Refresh border style. @@ -53,22 +53,22 @@ public abstract class PapyrusRoundedEditPartHelper implements ICSSNamedStyles { if (borderValueStyle instanceof StringValueStyle) { String value = ((StringValueStyle) borderValueStyle).getStringValue(); - if ("dash".equals(value)) { + if (NamedStyleProperties.BorderStyle.DASH.equals(value)) { borderStyle = Graphics.LINE_DASH; } - if ("dashDot".equals(value)) { + if (NamedStyleProperties.BorderStyle.DASH_DOT.equals(value)) { borderStyle = Graphics.LINE_DASHDOT; } - if ("dashDotDot".equals(value)) { + if (NamedStyleProperties.BorderStyle.DASH_DOT_DOT.equals(value)) { borderStyle = Graphics.LINE_DASHDOTDOT; } - if ("dot".equals(value)) { + if (NamedStyleProperties.BorderStyle.DOT.equals(value)) { borderStyle = Graphics.LINE_DOT; } - if ("solid".equals(value)) { + if (NamedStyleProperties.BorderStyle.SOLID.equals(value)) { borderStyle = Graphics.LINE_SOLID; } - if ("custom".equals(value)) { + if (NamedStyleProperties.BorderStyle.CUSTOM.equals(value)) { borderStyle = Graphics.LINE_CUSTOM; } } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java index 3333b7bafc6..a4d154a4641 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationUtils.java @@ -259,9 +259,14 @@ public class NotationUtils { } /** + * Gets the int value from a NamedStyle property. + * * @param view + * the view * @param property - * @param defaultValue + * the property + * @param defaultInt + * the default int * @return Integer corresponding to the property */ public static int getIntValue(View view, String property, int defaultInt) { @@ -270,23 +275,25 @@ public class NotationUtils { NamedStyle style; if (intValueStyle != null) { - style = view.getNamedStyle(intValueStyle, property); - if (style instanceof IntValueStyle) { value = ((IntValueStyle) style).getIntValue(); } } - return value; } /** + * Gets the boolean value from a NamedStyle property. + * * @param view + * the view * @param property + * the property * @param defaultValue + * the default value * @return Boolean corresponding to the property */ public static boolean getBooleanValue(View view, String property, boolean defaultValue) { @@ -295,23 +302,26 @@ public class NotationUtils { NamedStyle style; if (booleanValueStyle != null) { - style = view.getNamedStyle(booleanValueStyle, property); - if (style instanceof BooleanValueStyle) { value = ((BooleanValueStyle) style).isBooleanValue(); } } - return value; } + /** + * Gets the string value from a NamedStyle property. + * * @param view + * the view * @param property + * the property * @param defaultValue - * @return String corresponding to the property + * the default value + * @return the string value */ public static String getStringValue(View view, String property, String defaultValue) { String value = defaultValue; @@ -319,14 +329,11 @@ public class NotationUtils { NamedStyle style; if (stringValueStyle != null) { - style = view.getNamedStyle(stringValueStyle, property); - if (style instanceof StringValueStyle) { value = ((StringValueStyle) style).getStringValue(); } } - return value; } @@ -345,9 +352,7 @@ public class NotationUtils { NamedStyle style; if (intValueStyle != null) { - style = view.getNamedStyle(intValueStyle, property); - if (style instanceof StringListValueStyle) { // Get the string list EList<String> valueList = ((StringListValueStyle) style).getStringListValue(); @@ -360,7 +365,6 @@ public class NotationUtils { } } } - return value; } } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/ICSSNamedStyles.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/ICSSNamedStyles.java deleted file mode 100644 index 47117ff1e0c..00000000000 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/ICSSNamedStyles.java +++ /dev/null @@ -1,71 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2014 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:
- * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.common.utils;
-
-/**
- * Contains constants for the CSS-specific NameStyle, use to customize figure.
- *
- */
-public interface ICSSNamedStyles {
-
- /**
- * The name of the NamedStyle controlling whether the header have to be display or not.
- */
- public static final String DISPLAY_HEADER = "displayHeader";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle controlling whether the svg picture use the original color or the color can be chosen by the user.
- */
- public static final String USE_ORIGINAL_COLORS = "useOriginalColors";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle to select the border style of the figure.
- */
- public static final String BORDER_STYLE = "borderStyle"; //$NON-NLS-N$
-
- /**
- * The name of the NamedStyle controlling whether the floating label is constrained or not.
- */
- public static final String FLOATING_LABEL_CONSTRAINED = "isFloatingLabelConstrained";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle to select the offset height of the floating label when it is not constrained.
- */
- public static final String FLOATING_LABEL_OFFSET_HEIGHT = "floatingLabelOffsetHeight";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle to select the offset width of the floating label when it is not constrained.
- */
- public static final String FLOATING_LABEL_OFFSET_WIDTH = "floatingLabelOffsetWidth";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle controlling whether the figure will be oval or not.
- */
- public static final String IS_OVAL = "isOval";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle to select the offset height of the corner radius.
- */
- public static final String RADIUS_HEIGHT = "radiusHeight";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle to select the offset width of the corner radius.
- */
- public static final String RADIUS_WIDTH = "radiusWidth";//$NON-NLS-N$
-
- /**
- * The name of the NamedStyle to select the custom dash when the style of the line is set to custom.
- */
- public static final String LINE_CUSTOM_VALUE = "customDash";//$NON-NLS-N$
-
-}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/NamedStyleProperties.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/NamedStyleProperties.java new file mode 100644 index 00000000000..7ff681e33cb --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/NamedStyleProperties.java @@ -0,0 +1,180 @@ +/*****************************************************************************
+ * Copyright (c) 2010, 2014 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:
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.utils;
+
+
+/**
+ * Contains constants for the CSS-specific NameStyle, use to customize figure.
+ */
+public interface NamedStyleProperties {
+
+ /* NamedStyle used on PapyrusRoundedEditPartHelper for generic figure */
+
+ /**
+ * The NamedStyle property controlling whether the header have to be display or not.
+ */
+ public static final String DISPLAY_HEADER = "displayHeader";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property controlling whether the svg picture use the original color or the color can be chosen by the user.
+ */
+ public static final String USE_ORIGINAL_COLORS = "useOriginalColors";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property to select the border style of the figure.
+ */
+ public static final String BORDER_STYLE = "borderStyle"; //$NON-NLS-N$
+
+ /**
+ * The NamedStyle property controlling whether the floating label is constrained or not.
+ */
+ public static final String FLOATING_LABEL_CONSTRAINED = "isFloatingLabelConstrained";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property to select the offset height of the floating label when it is not constrained.
+ */
+ public static final String FLOATING_LABEL_OFFSET_HEIGHT = "floatingLabelOffsetHeight";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property to select the offset width of the floating label when it is not constrained.
+ */
+ public static final String FLOATING_LABEL_OFFSET_WIDTH = "floatingLabelOffsetWidth";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property controlling whether the figure will be oval or not.
+ */
+ public static final String IS_OVAL = "isOval";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property to select the offset height of the corner radius.
+ */
+ public static final String RADIUS_HEIGHT = "radiusHeight";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property to select the offset width of the corner radius.
+ */
+ public static final String RADIUS_WIDTH = "radiusWidth";//$NON-NLS-N$
+
+ /**
+ * The NamedStyle property to select the custom dash when the style of the line is set to custom.
+ */
+ public static final String LINE_CUSTOM_VALUE = "customDash";//$NON-NLS-N$
+
+ /* NamedStyle use on PapyrusLabelEditPart */
+
+ /**
+ * NamedStyle property to define the horizontal Label Margin
+ */
+ public static final String TOP_MARGIN_PROPERTY = "topMarginLabel"; //$NON-NLS-1$
+
+ /**
+ * NamedStyle property to define the vertical Label Margin
+ */
+ public static final String LEFT_MARGIN_PROPERTY = "leftMarginLabel"; //$NON-NLS-1$
+
+ /**
+ * NamedStyle property to define the horizontal Label Margin
+ */
+ public static final String BOTTOM_MARGIN_PROPERTY = "bottomMarginLabel"; //$NON-NLS-1$
+
+ /**
+ * NamedStyle property to define the vertical Label Margin
+ */
+ public static final String RIGHT_MARGIN_PROPERTY = "rightMarginLabel"; //$NON-NLS-1$
+
+ /** The NamedStyle property to define the text alignment. */
+ public static final String TEXT_ALIGNMENT = "textAlignment"; //$NON-NLS-1$
+
+ /** NamedStyle property to define the label offset on Y. */
+ public static final String LABEL_OFFSET_Y = "labelOffsetY"; //$NON-NLS-1$
+
+ /** NamedStyle property to define the label offset on X. */
+ public static final String LABEL_OFFSET_X = "labelOffsetX"; //$NON-NLS-1$
+
+ /** NamedStyle property controlling whether the label is constrained or not. */
+ public static final String LABEL_CONSTRAINED = "labelConstrained"; //$NON-NLS-1$
+
+ /* NamedStyle used on floatingLabelEditPart */
+
+ /** NamedStyle property to display floating name. */
+ public static final String DISPLAY_FLOATING_LABEL = "visible"; //$NON-NLS-1$
+
+ /** NamedStyle property to define the position for External Label */
+ public static final String POSITION = "position"; //$NON-NLS-1$
+
+ /* NamedStyle properties used for border display. */
+
+ /** The notation NameStyle property to define line position from compartment. */
+ public static final String LINE_POSITION = "linePosition"; //$NON-NLS-1$
+
+ /** The notation NameStyle property to define the line length ratio of compartment's topLine. */
+ public static final String LINE_LENGTH_RATIO = "lineLengthRatio"; //$NON-NLS-1$
+
+ /** The notation NameStyle property to define the line length of compartment's topLine. */
+ public static final String LENGTH = "lineLength"; //$NON-NLS-1$
+
+ /** The notation NameStyle property to display. */
+ public static final String DISPLAY_BORDER = "displayBorder"; //$NON-NLS-1$
+
+ /* Positions used for the name, the topLine and the Floating label. */
+ interface PositionAsString {
+ /** The Constant NORTH as String. */
+ public static final String NORTH = "NORTH"; //$NON-NLS-1$
+
+ /** The Constant SOUTH as String. */
+ public static final String SOUTH = "SOUTH"; //$NON-NLS-1$
+
+ /** The Constant EAST as String. */
+ public static final String EAST = "EAST"; //$NON-NLS-1$
+
+ /** The Constant WEST as String. */
+ public static final String WEST = "WEST"; //$NON-NLS-1$
+
+ /** The Constant NONE as String. */
+ public static final String NONE = "NONE"; //$NON-NLS-1$
+
+ /** The Constant AUTO as String. */
+ public static final String AUTO = "AUTO"; //$NON-NLS-1$
+
+ /** The Constant LEFT as String. */
+ public static final String LEFT = "LEFT"; //$NON-NLS-1$
+
+ /** The Constant RIGHT as String. */
+ public static final String RIGHT = "RIGHT"; //$NON-NLS-1$
+
+ /** The Constant CENTER as String. */
+ public static final String CENTER = "CENTER"; //$NON-NLS-1$
+ }
+
+ /* Border style */
+ interface BorderStyle {
+
+ /** The Constant DASH as String. */
+ public static final String DASH = "dash"; //$NON-NLS-1$
+
+ /** The Constant DASH_DOT as String. */
+ public static final String DASH_DOT = "dashDot"; //$NON-NLS-1$
+
+ /** The Constant DASH_DOT_DOT as String. */
+ public static final String DASH_DOT_DOT = "dashDotDot"; //$NON-NLS-1$
+
+ /** The Constant DOT as String. */
+ public static final String DOT = "dot"; //$NON-NLS-1$
+
+ /** The Constant SOLID as String. */
+ public static final String SOLID = "solid"; //$NON-NLS-1$
+
+ /** The Constant CUSTOM as String. */
+ public static final String CUSTOM = "custom"; //$NON-NLS-1$
+ }
+}
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 5b6f61cf08e..c2aa9b1839b 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 @@ -16,17 +16,13 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.NamedStyleProperties; import org.eclipse.papyrus.uml.diagram.common.editpolicies.MaskManagedFloatingLabelEditPolicy; /** * The Class FloatingNameEditPart. */ -public class FloatingLabelEditPart extends PapyrusLabelEditPart { - - /** The Constant DISPLAY_FLOATING_NAME. */ - public static final String DISPLAY_FLOATING_LABEL = "visible"; - - // private static final String DISPLAY_FLOATING_LABEL = "displayFloatingLabel"; +public class FloatingLabelEditPart extends PapyrusLabelEditPart implements NamedStyleProperties { /** The Constant DEFAULT_LABEL_DISPLAYED. */ @@ -49,10 +45,7 @@ public class FloatingLabelEditPart extends PapyrusLabelEditPart { @Override protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); - // installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.ExternalLabelDisplayEditPolicy.EXTERNAL_LABEL_POLICY, new ExternalLabelDisplayEditPolicy()); installEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL, new MaskManagedFloatingLabelEditPolicy()); - // installEditPolicy("test", new FeedBackFloatingLabelEditPolicy()); - } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ExternalLabelPositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ExternalLabelPositionLocator.java index 2d4175b28c9..9e04698d345 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ExternalLabelPositionLocator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ExternalLabelPositionLocator.java @@ -36,6 +36,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; import org.eclipse.papyrus.infra.gmfdiag.common.locator.IPapyrusBorderItemLocator; import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.NamedStyleProperties; import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; /** @@ -122,19 +123,19 @@ public class ExternalLabelPositionLocator implements IPapyrusBorderItemLocator { @Override public int getPosition() { // Get the forced value(CSS, Notation) - String ForcedPosition = NotationUtils.getStringValue(view, "position", "AUTO").toUpperCase(); + String ForcedPosition = NotationUtils.getStringValue(view, NamedStyleProperties.POSITION, NamedStyleProperties.PositionAsString.AUTO); // if there is a forced position - if (!"AUTO".equals(ForcedPosition)) { - if ("EAST".equals(ForcedPosition)) { + if (!NamedStyleProperties.PositionAsString.AUTO.equals(ForcedPosition)) { + if (NamedStyleProperties.PositionAsString.EAST.equals(ForcedPosition)) { position = PositionConstants.EAST; } - if ("WEST".equals(ForcedPosition)) { + if (NamedStyleProperties.PositionAsString.WEST.equals(ForcedPosition)) { position = PositionConstants.WEST; } - if ("NORTH".equals(ForcedPosition)) { + if (NamedStyleProperties.PositionAsString.NORTH.equals(ForcedPosition)) { position = PositionConstants.NORTH; } - if ("SOUTH".equals(ForcedPosition)) { + if (NamedStyleProperties.PositionAsString.SOUTH.equals(ForcedPosition)) { position = PositionConstants.SOUTH; } } else { @@ -332,7 +333,7 @@ public class ExternalLabelPositionLocator implements IPapyrusBorderItemLocator { req.setLocation(offset); Command command = editPart.getCommand(req); if (command != null && command.canExecute()) { - command.setLabel(RequestConstants.REQ_MOVE + ": " + offset.toString()); + command.setLabel(RequestConstants.REQ_MOVE + ": " + offset.toString()); //$NON-NLS-1$ TransactionUtil.getEditingDomain(view).getCommandStack().execute(GEFtoEMFCommandWrapper.wrap(command)); } } |