public final class VerticalRuler extends Object implements IVerticalRuler, IVerticalRulerExtension
IVerticalRuler.
The same can be achieved by using CompositeRuler configured
with an AnnotationRulerColumn. Clients may use this class as
is.
ITextViewer| Constructor and Description |
|---|
VerticalRuler(int width)
Constructs a vertical ruler with the given width.
|
VerticalRuler(int width,
IAnnotationAccess annotationAcccess)
Constructs a vertical ruler with the given width and the given annotation
access.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMouseListener(MouseListener listener)
Deprecated.
will be removed
|
Control |
createControl(Composite parent,
ITextViewer textViewer)
Creates the ruler's SWT control.
|
protected void |
doPaint(GC gc)
Draws the vertical ruler w/o drawing the Canvas background.
|
protected void |
doPaint1(GC gc)
Draws the vertical ruler w/o drawing the Canvas background.
|
Control |
getControl()
Returns the ruler's SWT control.
|
int |
getLineOfLastMouseButtonActivity()
Returns the line number of the last mouse button activity.
|
IAnnotationModel |
getModel()
Returns the current annotation model of this ruler or
null
if the ruler has no model. |
int |
getWidth()
Returns the width of this ruler's control.
|
void |
removeMouseListener(MouseListener listener)
Deprecated.
will be removed
|
void |
setFont(Font font)
Sets the font of this vertical ruler.
|
void |
setLocationOfLastMouseButtonActivity(int x,
int y)
Sets the location of the last mouse button activity.
|
void |
setModel(IAnnotationModel model)
Associates an annotation model with this ruler.
|
int |
toDocumentLineNumber(int y_coordinate)
Translates a y-coordinate of the ruler's SWT control into
the according line number of the document of the connected text viewer.
|
void |
update()
Thread-safe implementation.
|
protected static int |
widgetLine2ModelLine(ITextViewer viewer,
int widgetLine)
Returns the line of the viewer's document that corresponds to the given widget line.
|
public VerticalRuler(int width)
width - the width of the vertical rulerpublic VerticalRuler(int width,
IAnnotationAccess annotationAcccess)
width - the width of the vertical rulerannotationAcccess - the annotation accesspublic Control getControl()
IVerticalRulerInfogetControl in interface IVerticalRulerInfopublic Control createControl(Composite parent, ITextViewer textViewer)
IVerticalRulercreateControl in interface IVerticalRulerparent - the parent control of the ruler's controltextViewer - the text viewer to which this ruler belongsprotected void doPaint(GC gc)
gc - the GC to draw intoprotected void doPaint1(GC gc)
ITextViewerExtension5 for its implementation. Will replace
doPaint(GC).gc - the GC to draw intopublic void update()
update in interface IVerticalRulerpublic void setModel(IAnnotationModel model)
IVerticalRulernull is acceptable and clears the ruler.setModel in interface IVerticalRulermodel - the new annotation model, may be nullpublic IAnnotationModel getModel()
IVerticalRulernull
if the ruler has no model.getModel in interface IVerticalRulernull if there is no modelpublic int getWidth()
IVerticalRulerInfogetWidth in interface IVerticalRulerInfopublic int getLineOfLastMouseButtonActivity()
IVerticalRulerInfo0.getLineOfLastMouseButtonActivity in interface IVerticalRulerInfopublic int toDocumentLineNumber(int y_coordinate)
IVerticalRulerInfotoDocumentLineNumber in interface IVerticalRulerInfoy_coordinate - a y-coordinate of the ruler's SWT control-1 if that
coordinate does not correspond to a valid document lineprotected static final int widgetLine2ModelLine(ITextViewer viewer, int widgetLine)
viewer - the viewerwidgetLine - the widget linepublic void setFont(Font font)
IVerticalRulerExtensionsetFont in interface IVerticalRulerExtensionfont - the new font of the vertical rulerpublic void setLocationOfLastMouseButtonActivity(int x,
int y)
IVerticalRulerExtensionsetLocationOfLastMouseButtonActivity in interface IVerticalRulerExtensionx - the x-coordinatey - the y-coordinatepublic void addMouseListener(MouseListener listener)
listener - the listener to be addedpublic void removeMouseListener(MouseListener listener)
listener - the listener to be removedGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.