### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.workbench.texteditor Index: src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java,v retrieving revision 1.42 diff -u -r1.42 SourceViewerDecorationSupport.java --- src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java 9 May 2007 07:28:42 -0000 1.42 +++ src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java 15 Jun 2007 16:05:18 -0000 @@ -161,27 +161,67 @@ * @since 3.3 */ private static final class DashedBoxDrawingStrategy extends BoxDrawingStrategy { + private int evenSteps(int len, int s) { + int twoS= 2 * s; + return (len) / twoS * twoS; + } + /* * @see org.eclipse.ui.texteditor.SourceViewerDecorationSupport.BoxDrawingStrategy#drawBox(org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Color, org.eclipse.swt.graphics.Rectangle) */ protected void drawBox(GC gc, StyledText textWidget, Color color, Rectangle bounds) { - //clean bg: - gc.setForeground(textWidget.getBackground()); - gc.setLineStyle(SWT.LINE_SOLID); + gc.setForeground(color); int x= bounds.x; int y= bounds.y; int w= bounds.width - 1; int h= bounds.height - 1; gc.drawRectangle(x, y, w, h); - gc.setForeground(color); - gc.setLineDash(new int[] { 3 }); + gc.setForeground(textWidget.getBackground()); + +//dash from left & adjust right: + int d= 3; //dash length + int c= 4; //no-dash-zone at corners + gc.setLineDash(new int[] { d }); + if (w > 2 * c) { + int w2= evenSteps(w - 2 * c, d) + d - 1; + gc.drawLine(x + c, y, x + c + w2, y); + gc.drawLine(x + c, y + h, x + c + w2, y + h); + } + if (h > 2 * c) { + int h2= evenSteps(h - 2 * c, d) + d - 1; + gc.drawLine(x, y + c, x, y + c + h2); + gc.drawLine(x + w, y + c, x + w, y + c + h2); + } + +////dash from left & right (partial dashes at center): +// int d= 3; +// int o= 6; +// gc.setLineDash(new int[] { d }); +// if (w > 2 * o) { +// gc.drawLine(x + o, y, x + w/2, y); +// gc.drawLine(x + w - o, y, x + w/2, y); +// +// gc.drawLine(x + o, y + h, x + w/2, y + h); +// gc.drawLine(x + w - o, y + h, x + w/2, y + h); +// } +// if (h > 2 * o) { +// gc.drawLine(x, y + o, x, y + h - o); +// gc.drawLine(x + w, y + o, x + w, y + h - o); +// } - // gc.drawRectangle(x, y, w, h) is platform-dependent and can look "animated" - gc.drawLine(x, y, x + w, y); - gc.drawLine(x, y + h, x + w, y + h); - gc.drawLine(x, y, x, y + h); - gc.drawLine(x + w, y, x + w, y + h); +////dash from left (partial dashes at right): +// int d= 6; +// int o= 6; +// gc.setLineDash(new int[] { d }); +// if (w > 2 * o) { +// gc.drawLine(x + o, y, x + w - o, y); +// gc.drawLine(x + o, y + h, x + w - o, y + h); +// } +// if (h > 2 * o) { +// gc.drawLine(x, y + o, x, y + h - o); +// gc.drawLine(x + w, y + o, x + w, y + h - o); +// } //RESET (same GC is passed around!): gc.setLineStyle(SWT.LINE_SOLID);