Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 69464

Summary: Provide ability to set line style on org.eclipse.draw2d.LineBorder
Product: [Tools] GEF Reporter: Will Smythe <smythew>
Component: GEF-Legacy Draw2dAssignee: gef-inbox <gef-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: ahunter.eclipse
Version: 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Will Smythe CLA 2004-07-07 09:51:55 EDT
The current implementation of LineBorder draws a line with a solid border - it 
would be fairly simple to provide a mechanism to set the style 
(Graphics.LINE_DASH for example) of the line. I implemented the following 
class, but I would expect you to move these methods into the existing 
LineBorder class.

/*
 * Created on Jul 7, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.ibm.etools.tui.ui.editparts;

import org.eclipse.draw2d.*;
import org.eclipse.draw2d.geometry.*;
import org.eclipse.swt.graphics.*;

/**
 * @author smythew
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class StyledLineBorder extends LineBorder {
    
    private int style;

    public StyledLineBorder(Color color, int width, int style) {
        super(color, width);
        
        setStyle(style);
    }
    public int getStyle() {
        return style;
    }

    public void setStyle(int style) {
        this.style = style;
    }

    public void paint(IFigure figure, Graphics graphics, Insets insets) {
        graphics.setLineStyle(style);
        
        super.paint(figure, graphics, insets);
    }
}
Comment 1 Anthony Hunter CLA 2008-12-10 16:21:30 EST

*** This bug has been marked as a duplicate of bug 255554 ***