public class LineNumberRulerColumn extends Object implements IVerticalRulerColumn
Constructor and Description |
---|
LineNumberRulerColumn()
Constructs a new vertical ruler column.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeIndentations()
Computes the indentations for the given font and stores them in
fIndentation . |
protected int |
computeNumberOfDigits()
Does the real computation of the number of digits.
|
Control |
createControl(CompositeRuler parentRuler,
Composite parentControl)
Creates the column's SWT control.
|
protected String |
createDisplayString(int line)
Computes the string to be printed for
line . |
protected Color |
getBackground(Display display)
Returns the System background color for list widgets.
|
Control |
getControl()
Returns the column's SWT control.
|
protected Color |
getForeground()
Returns the foreground color being used to print the line numbers.
|
protected CompositeRuler |
getParentRuler()
Returns the parent (composite) ruler of this ruler column.
|
protected int |
getVisibleLinesInViewport()
Deprecated.
as of 3.2 the number of lines in the viewport cannot be computed because
StyledText supports variable line heights
|
int |
getWidth()
Returns the width of this column's control.
|
protected void |
handleDispose()
Disposes the column's resources.
|
protected boolean |
isViewerCompletelyShown()
Returns
true if the viewport displays the entire viewer contents, i.e. the
viewer is not vertically scrollable. |
protected void |
layout(boolean redraw)
Layouts the enclosing viewer to adapt the layout to changes of the
size of the individual components.
|
protected void |
paintLine(int line,
int y,
int lineheight,
GC gc,
Display display)
Paints the line.
|
protected void |
postRedraw()
Triggers a redraw in the display thread.
|
void |
redraw()
Redraws this column.
|
void |
setBackground(Color background)
Sets the background color of this column.
|
void |
setFont(Font font)
Sets the font of this ruler column.
|
void |
setForeground(Color foreground)
Sets the foreground color of this column.
|
void |
setModel(IAnnotationModel model)
Associates an annotation model with this ruler column.
|
protected boolean |
updateNumberOfDigits()
Computes the number of digits to be displayed.
|
public LineNumberRulerColumn()
public void setForeground(Color foreground)
foreground
- the foreground colorprotected Color getForeground()
public void setBackground(Color background)
background
- the background colorprotected Color getBackground(Display display)
display
- the displaypublic Control getControl()
IVerticalRulerColumn
getControl
in interface IVerticalRulerColumn
public int getWidth()
IVerticalRulerColumn
getWidth
in interface IVerticalRulerColumn
protected boolean updateNumberOfDigits()
true
if the number of digits changed compared
to the previous call of this method. If the method is called
for the first time, the return value is also true
.protected int computeNumberOfDigits()
protected void layout(boolean redraw)
redraw
- true
if this column can be redrawnprotected void computeIndentations()
fIndentation
.public Control createControl(CompositeRuler parentRuler, Composite parentControl)
IVerticalRulerColumn
createControl
in interface IVerticalRulerColumn
parentRuler
- the parent ruler of this columnparentControl
- the control of the parent rulerprotected void handleDispose()
protected int getVisibleLinesInViewport()
protected final boolean isViewerCompletelyShown()
true
if the viewport displays the entire viewer contents, i.e. the
viewer is not vertically scrollable.true
if the viewport displays the entire contents, false
otherwiseprotected String createDisplayString(int line)
line
. The default implementation returns
Integer.toString(line + 1)
.line
- the line number for which the line number string is generatedline
protected void paintLine(int line, int y, int lineheight, GC gc, Display display)
line
- the line of the document which the ruler is painted fory
- the y-coordinate of the box being painted for line
, relative to gc
lineheight
- the height of one line (and therefore of the box being painted)gc
- the drawing context the client may choose to draw on.display
- the display the drawing occurs onprotected final void postRedraw()
public void redraw()
IVerticalRulerColumn
redraw
in interface IVerticalRulerColumn
public void setModel(IAnnotationModel model)
IVerticalRulerColumn
null
is acceptable and clears the ruler.setModel
in interface IVerticalRulerColumn
model
- the new annotation model, may be null
public void setFont(Font font)
IVerticalRulerColumn
setFont
in interface IVerticalRulerColumn
font
- the new font of the ruler columnprotected CompositeRuler getParentRuler()
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.