diff options
author | Laurent Wouters | 2014-01-16 09:23:45 +0000 |
---|---|---|
committer | Laurent Wouters | 2014-01-21 14:55:42 +0000 |
commit | 92dfb73b7af0d2fdfa062d431e452dea3e1ac88c (patch) | |
tree | 5e6789ad5e688ff5b61ef452ace43e7f9945bab6 | |
parent | f466e72f9b93d3dd400fa9bd8a90d651a8d488bf (diff) | |
download | org.eclipse.papyrus-92dfb73b7af0d2fdfa062d431e452dea3e1ac88c.tar.gz org.eclipse.papyrus-92dfb73b7af0d2fdfa062d431e452dea3e1ac88c.tar.xz org.eclipse.papyrus-92dfb73b7af0d2fdfa062d431e452dea3e1ac88c.zip |
425584: [Component Diagram] Usage and Realization Links are solid (should be dashed)
Fixed conflicts between the application of CSS style on connectors and the custom implementation of dashed connectors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=425584
Change-Id: I9d9c120425e05a31476017ae935d3a7ec9cea61a
Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
5 files changed, 50 insertions, 20 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/figure/CustomContextLinkFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/figure/CustomContextLinkFigure.java index 503cc4c3282..7c1c0bd9944 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/figure/CustomContextLinkFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/figure/CustomContextLinkFigure.java @@ -41,7 +41,11 @@ public class CustomContextLinkFigure extends DashedEdgeFigure { add(conveyedLabel, 0);
}
- protected void setStyle() {
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure#resetStyle()
+ */
+ @Override
+ public void resetStyle() {
PolylineDecoration dec = new PolylineDecoration();
dec.setScale(15, 5);
dec.setLineWidth(1);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/edge/DashedEdgeFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/edge/DashedEdgeFigure.java index 2db5b5036bc..3461f0d73da 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/edge/DashedEdgeFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/edge/DashedEdgeFigure.java @@ -41,7 +41,7 @@ public class DashedEdgeFigure extends UMLEdgeFigure { */ public DashedEdgeFigure() { super(); - setStyle(); + setupDefaultStyle(); } /** @@ -60,7 +60,7 @@ public class DashedEdgeFigure extends UMLEdgeFigure { public DashedEdgeFigure(Boolean arrow) { super(); this.arrow = arrow; - setStyle(); + setupDefaultStyle(); createContents(); } @@ -72,7 +72,6 @@ public class DashedEdgeFigure extends UMLEdgeFigure { */ public void setArrow(Boolean arrow) { this.arrow = arrow; - setStyle(); } /** @@ -93,15 +92,17 @@ public class DashedEdgeFigure extends UMLEdgeFigure { */ @Override public void resetStyle() { - setStyle(); + setupDefaultStyle(); } /** * Sets initial Style for the figure. It does not give any special Color for * Background and Foreground. This is the style used for classic arrows: * ------> + * This method should not be overridden as it defines the default style for the arrow. + * Instead, custom styles should be defined by overriding the resetStyle method. */ - protected void setStyle() { + protected final void setupDefaultStyle() { PolylineDecoration dec = new PolylineDecoration(); dec.setScale(15, 5); dec.setLineWidth(1); @@ -117,6 +118,5 @@ public class DashedEdgeFigure extends UMLEdgeFigure { dashes[i] = 5; } setLineDash(dashes); - } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/figure/edges/UsageLinkFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/figure/edges/UsageLinkFigure.java index e651a1e988d..ae22a156055 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/figure/edges/UsageLinkFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/figure/edges/UsageLinkFigure.java @@ -21,21 +21,33 @@ import org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure; **/
public class UsageLinkFigure extends DashedEdgeFigure{
+ private boolean asLink = true;
/**
+ * @see org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure#resetStyle()
+ */
+ @Override
+ public void resetStyle() {
+ this.arrow = !asLink;
+ setupDefaultStyle();
+ if (asLink) {
+ this.setLineStyle(Graphics.LINE_SOLID);
+ } else {
+ this.setLineStyle(Graphics.LINE_CUSTOM);
+ }
+ }
+
+ /**
* display it as a line
*/
public void displayAsAlink(){
- setArrow(false);
- this.setLineStyle(Graphics.LINE_SOLID);
-
+ asLink = true;
}
+
/**
* display it as the UML representation with its decoration
*/
public void displayAsUMLShape(){
- this.setLineStyle(Graphics.LINE_CUSTOM);
- setArrow(true);
-
+ asLink = false;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/CustomContextLinkFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/CustomContextLinkFigure.java index efaf5ab083a..d802846854f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/CustomContextLinkFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/CustomContextLinkFigure.java @@ -41,7 +41,11 @@ public class CustomContextLinkFigure extends DashedEdgeFigure { add(conveyedLabel, 0);
}
- protected void setStyle() {
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure#resetStyle()
+ */
+ @Override
+ public void resetStyle() {
PolylineDecoration dec = new PolylineDecoration();
dec.setScale(15, 5);
dec.setLineWidth(1);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/TransitionFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/TransitionFigure.java index d20c18c6139..c787207712b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/TransitionFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/figures/TransitionFigure.java @@ -1,3 +1,15 @@ +/*****************************************************************************
+ * Copyright (c) 2014 CEA.
+ *
+ * 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:
+ * CEA - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.statemachine.custom.figures;
import org.eclipse.draw2d.Graphics;
@@ -16,15 +28,14 @@ public class TransitionFigure extends DashedEdgeFigure { */
public TransitionFigure() {
super();
- setStyle();
+ setupDefaultStyle();
}
/**
- * Sets initial Style for the figure. It does not give any special Color for
- * Background and Foreground. This is the style used for classic arrows:
- * ------>
+ * @see org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure#resetStyle()
*/
- protected void setStyle() {
+ @Override
+ public void resetStyle() {
PolylineDecoration dec = new PolylineDecoration();
dec.setScale(15, 5);
dec.setLineWidth(1);
@@ -34,6 +45,5 @@ public class TransitionFigure extends DashedEdgeFigure { this.setTargetDecoration(null);
}// arrow at target endpoint
this.setLineStyle(Graphics.LINE_CUSTOM); // line drawing style
-
}
}
|