Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Porhel2015-12-23 11:02:12 +0000
committerMaxime Porhel2016-01-05 10:17:11 +0000
commit98d6777e2386ac8e3e6fe2789701549d4b615fd2 (patch)
tree2e18a49fdc629b308b7513982e981e50644edd5a
parent2cd54eb1f398a961739efde9d15df246e12778d2 (diff)
downloadorg.eclipse.sirius-98d6777e2386ac8e3e6fe2789701549d4b615fd2.tar.gz
org.eclipse.sirius-98d6777e2386ac8e3e6fe2789701549d4b615fd2.tar.xz
org.eclipse.sirius-98d6777e2386ac8e3e6fe2789701549d4b615fd2.zip
[485116] Update OneLineMarginBorder.dash pattern type
graphics.setLineDash(dash) was previously always called, but this causes NPE in org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.graphics. GraphicsToGraphics2DAdaptor and its sub-implementations. For exemple it occurs when it tries to transform the int[] into a float[] on Windows (image copy in the system clipboard) or on all systems when CopyToImageUtil is used. SWTGraphics is used in the editor and correctly handle null value. We cannot choose to call setLineDash(float[]) as org.eclipse.gmf.runtime.draw2d.ui.internal.graphics.ScaledGraphics and its sub-immplementations do not implement it, even if they delegates the final behavior to SWTGraphics at runtime. The chosen solution consists in calling the setLineDash(int []) only when the array is not null and the style CUSTOM as done in org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities. paintGridWithStyle(Graphics, IFigure, Point, int, int, int, int[]) Bug: 485116 Cherry-picked-from: 484507 Change-Id: Ie86eaafb80535ca1345d5cd85ae62a481784cdc8 Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/OneLineMarginBorder.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/OneLineMarginBorder.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/OneLineMarginBorder.java
index 562c4468a3..a849a02ab2 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/OneLineMarginBorder.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/OneLineMarginBorder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 THALES GLOBAL SERVICES.
+ * Copyright (c) 2013, 2016 THALES GLOBAL SERVICES 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
@@ -16,6 +16,7 @@ import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.gmf.runtime.draw2d.ui.figures.OneLineBorder;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
+import org.eclipse.swt.SWT;
/**
* Specific {@link OneLineBorder} with dash capabilities, two more supported
@@ -53,8 +54,9 @@ public class OneLineMarginBorder extends OneLineBorder {
*/
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
- graphics.setLineDash(dash);
-
+ if (dash != null && getStyle() == SWT.LINE_CUSTOM) {
+ graphics.setLineDash(dash);
+ }
super.paint(figure, graphics, insets);
int one = MapModeUtil.getMapMode(figure).DPtoLP(1);

Back to the top