Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2016-01-28 15:01:26 +0000
committerGerrit Code Review @ Eclipse.org2016-02-24 14:42:54 +0000
commit15774f3975ee1b16a699665a185638a3a57b374b (patch)
treec5ec6a4d5f6c43ffb99d9c47499a23b1619fdbcc
parent6a71160368d47c5769b2df817ddaa4d30a000a44 (diff)
downloadorg.eclipse.papyrus-15774f3975ee1b16a699665a185638a3a57b374b.tar.gz
org.eclipse.papyrus-15774f3975ee1b16a699665a185638a3a57b374b.tar.xz
org.eclipse.papyrus-15774f3975ee1b16a699665a185638a3a57b374b.zip
Bug 486726 - [Test] Some regression on ShapeCustomisationTest for master
https://bugs.eclipse.org/bugs/show_bug.cgi?id=486726 - Fix regression - rebase Change-Id: I90b6e62f8ef3dd780159aa2948f5582d0e461c6e Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java53
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/RoundedUMLNodeEditPart.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedBorderNamedElementEditPart.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedCompartmentEditPart.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java6
5 files changed, 64 insertions, 22 deletions
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 a1d63a4ae57..cc07e3ea11a 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
@@ -35,38 +35,21 @@ public abstract class PapyrusRoundedEditPartHelper implements NamedStyleProperti
*
* @param editpart
* the editpart
- * @param defaultBorderStyle
- * the default border style
* @param defaultLineCustomValue
* the default line custom value
+ * @param defaultBorderStyle
*/
public static void refreshBorderStyle(IPapyrusEditPart editpart, int defaultBorderStyle, int[] defaultLineCustomValue) {
// get the Figure
if (editpart.getPrimaryShape() instanceof IRoundedRectangleFigure) {
IRoundedRectangleFigure roundedRectangleFigure = (IRoundedRectangleFigure) editpart.getPrimaryShape();
- EClass stringValueStyle = NotationPackage.eINSTANCE.getStringValueStyle();
-
- int borderStyle = defaultBorderStyle;
+ int borderStyle = getNotationBorderStyle(editpart, defaultBorderStyle);
- if (stringValueStyle != null) {
-
- if (((GraphicalEditPart) editpart).getModel() instanceof View) {
- // Get the border style on notation
- NamedStyle borderValueStyle = ((View) ((GraphicalEditPart) editpart).getModel()).getNamedStyle(stringValueStyle, BORDER_STYLE);
- // convert the string style name in integer
- if (borderValueStyle instanceof StringValueStyle) {
- String str = ((StringValueStyle) borderValueStyle).getStringValue();
- final LineStyleEnum lineStyle = LineStyleEnum.getByLiteral(str);
- if (lineStyle != null) {
- borderStyle = lineStyle.getLineStyle();
- }
- }
- }
- }
// set the border style of the figure
roundedRectangleFigure.setBorderStyle(borderStyle);
+
// get/set the custom dash value
int[] customDash = NotationUtils.getIntListValue((View) ((GraphicalEditPart) editpart).getModel(), LINE_CUSTOM_VALUE, defaultLineCustomValue);
roundedRectangleFigure.setCustomDash(customDash);
@@ -75,6 +58,36 @@ public abstract class PapyrusRoundedEditPartHelper implements NamedStyleProperti
}
/**
+ * Gets the Border style of the edit part defined in notation
+ *
+ * @param editpart
+ * @param defaultBorderStyle
+ * @return the border style
+ */
+ public static int getNotationBorderStyle(IPapyrusEditPart editpart, int defaultBorderStyle) {
+ EClass stringValueStyle = NotationPackage.eINSTANCE.getStringValueStyle();
+
+ int borderStyle = defaultBorderStyle;
+
+ if (stringValueStyle != null) {
+
+ if (((GraphicalEditPart) editpart).getModel() instanceof View) {
+ // Get the border style on notation
+ NamedStyle borderValueStyle = ((View) ((GraphicalEditPart) editpart).getModel()).getNamedStyle(stringValueStyle, BORDER_STYLE);
+ // convert the string style name in integer
+ if (borderValueStyle instanceof StringValueStyle) {
+ String str = ((StringValueStyle) borderValueStyle).getStringValue();
+ final LineStyleEnum lineStyle = LineStyleEnum.getByLiteral(str);
+ if (lineStyle != null) {
+ borderStyle = lineStyle.getLineStyle();
+ }
+ }
+ }
+ }
+ return borderStyle;
+ }
+
+ /**
* Refresh floating name.
*
* @param editpart
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/RoundedUMLNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/RoundedUMLNodeEditPart.java
index 8b26453701b..7d14508ecdb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/RoundedUMLNodeEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/RoundedUMLNodeEditPart.java
@@ -174,6 +174,16 @@ public abstract class RoundedUMLNodeEditPart extends UMLNodeEditPart {
}
/**
+ * Get the line type of the shape.
+ *
+ * @return the line type.
+ */
+ @Override
+ protected int getLineType() {
+ return PapyrusRoundedEditPartHelper.getNotationBorderStyle(this, getDefaultBorderStyle());
+ }
+
+ /**
* Gets the default shadow color.
*
* @return the default shadow color
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedBorderNamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedBorderNamedElementEditPart.java
index 289f25b19b7..ac3866327e5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedBorderNamedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedBorderNamedElementEditPart.java
@@ -230,6 +230,14 @@ public abstract class RoundedBorderNamedElementEditPart extends BorderNamedEleme
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ protected int getLineType() {
+ return PapyrusRoundedEditPartHelper.getNotationBorderStyle(this, getDefaultBorderStyle());
+ }
+
+ /**
* Adds listener to handle named Style modifications.
*/
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedCompartmentEditPart.java
index cd55813e62f..6b15a6804d4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/RoundedCompartmentEditPart.java
@@ -163,6 +163,15 @@ public abstract class RoundedCompartmentEditPart extends NamedElementEditPart {
super.refreshVisuals();
}
+ /**
+ * Get the line type of the shape.
+ *
+ * @return the line type.
+ */
+ @Override
+ protected int getLineType() {
+ return PapyrusRoundedEditPartHelper.getNotationBorderStyle(this, getDefaultBorderStyle());
+ }
/**
* Gets the name label color.
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java
index 1ad5c800d9e..b81af7a8ed0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java
@@ -119,8 +119,10 @@ public class RoundedCompartmentFigure extends NodeNamedElementFigure implements
@Override
public void setBorderStyle(final int borderStyle) {
this.borderStyle = borderStyle;
- if (null != shadowborder) {
- shadowborder.setStyle(borderStyle);
+
+ Border border = getBorder();
+ if (border instanceof RoundedRectangleBorder) {
+ ((RoundedRectangleBorder) border).setStyle(borderStyle);
}
}

Back to the top