Package org.eclipse.jface.text
Class MarginPainter
- java.lang.Object
-
- org.eclipse.jface.text.MarginPainter
-
- All Implemented Interfaces:
EventListener
,IPainter
,PaintListener
,SWTEventListener
public class MarginPainter extends Object implements IPainter, PaintListener
Paints a vertical line (margin line) after a given column respecting the text viewer's font.Clients usually instantiate and configure objects of this class.
This class is not intended to be subclassed.
- Since:
- 2.1
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
-
Fields inherited from interface org.eclipse.jface.text.IPainter
CONFIGURATION, INTERNAL, KEY_STROKE, MOUSE_BUTTON, SELECTION, TEXT_CHANGE
-
-
Constructor Summary
Constructors Constructor Description MarginPainter(ITextViewer textViewer)
Creates a new painter for the given text viewer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deactivate(boolean redraw)
Deactivates this painter.void
dispose()
Disposes this painter.void
initialize()
Initializes this painter, by flushing and recomputing all caches and causing the widget to be redrawn.void
paint(int reason)
Requests this painter to repaint because of the given reason.void
paintControl(PaintEvent e)
Sent when a paint event occurs for the control.void
setMarginRulerColor(Color color)
Sets the color of the margin line.void
setMarginRulerColumn(int width)
Sets the column after which to draw the margin line.void
setMarginRulerStyle(int lineStyle)
Sets the line style of the margin line.void
setMarginRulerWidth(int lineWidth)
Sets the line width of the margin line.void
setPositionManager(IPaintPositionManager manager)
Sets the paint position manager that can be used by this painter or removes any previously set paint position manager.
-
-
-
Constructor Detail
-
MarginPainter
public MarginPainter(ITextViewer textViewer)
Creates a new painter for the given text viewer.- Parameters:
textViewer
- the text viewer
-
-
Method Detail
-
setMarginRulerColumn
public void setMarginRulerColumn(int width)
Sets the column after which to draw the margin line.- Parameters:
width
- the column
-
setMarginRulerStyle
public void setMarginRulerStyle(int lineStyle)
Sets the line style of the margin line.- Parameters:
lineStyle
- aSWT
style constant describing the line style
-
setMarginRulerWidth
public void setMarginRulerWidth(int lineWidth)
Sets the line width of the margin line.- Parameters:
lineWidth
- the line width
-
setMarginRulerColor
public void setMarginRulerColor(Color color)
Sets the color of the margin line. Must be called beforepaint
is called the first time.- Parameters:
color
- the color
-
initialize
public void initialize()
Initializes this painter, by flushing and recomputing all caches and causing the widget to be redrawn.
-
deactivate
public void deactivate(boolean redraw)
Description copied from interface:IPainter
Deactivates this painter. If the painter is inactive, this call does not have any effect.redraw
indicates whether the painter should remove any decoration it previously applied. A deactivated painter can be reactivated by callingpaint
.- Specified by:
deactivate
in interfaceIPainter
- Parameters:
redraw
-true
if any previously applied decoration should be removed- See Also:
IPainter.paint(int)
-
dispose
public void dispose()
Description copied from interface:IPainter
Disposes this painter. Prior to disposing, a painter should be deactivated. A disposed painter can not be reactivated.- Specified by:
dispose
in interfaceIPainter
- See Also:
IPainter.deactivate(boolean)
-
paint
public void paint(int reason)
Description copied from interface:IPainter
Requests this painter to repaint because of the given reason. Based on the given reason the painter can decide whether it will repaint or not. If it repaints and is inactive, it will activate itself.
-
paintControl
public void paintControl(PaintEvent e)
Description copied from interface:PaintListener
Sent when a paint event occurs for the control.- Specified by:
paintControl
in interfacePaintListener
- Parameters:
e
- an event containing information about the paint
-
setPositionManager
public void setPositionManager(IPaintPositionManager manager)
Description copied from interface:IPainter
Sets the paint position manager that can be used by this painter or removes any previously set paint position manager.- Specified by:
setPositionManager
in interfaceIPainter
- Parameters:
manager
- the paint position manager ornull
-
-