public class OverviewRuler extends Object implements IOverviewRulerExtension, IOverviewRuler
This overview ruler uses non-saturated colors unless setUseSaturatedColors(boolean)
gets
called.
Clients usually instantiate and configure objects of this class.
Constructor and Description |
---|
OverviewRuler(IAnnotationAccess annotationAccess,
int width,
ISharedTextColors sharedColors)
Constructs a overview ruler of the given width using the given annotation access and the given
color manager.
|
OverviewRuler(IAnnotationAccess annotationAccess,
int width,
ISharedTextColors sharedColors,
boolean discolorTemporaryAnnotation)
Constructs a overview ruler of the given width using the given annotation
access and the given color manager.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnnotationType(Object annotationType)
Adds the given annotation type to this overview ruler.
|
void |
addHeaderAnnotationType(Object annotationType)
Adds the given annotation type to the header of this ruler.
|
Control |
createControl(Composite parent,
ITextViewer textViewer)
Creates the ruler's SWT control.
|
int |
getAnnotationHeight()
Returns the height of the visual presentation of an annotation in this
overview ruler.
|
Control |
getControl()
Returns the ruler's SWT control.
|
Control |
getHeaderControl()
Returns this rulers header 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.
|
boolean |
hasAnnotation(int y)
Returns whether there is an annotation an the given vertical coordinate.
|
void |
removeAnnotationType(Object annotationType)
Removes the given annotation type from this overview ruler.
|
void |
removeHeaderAnnotationType(Object annotationType)
Removes the given annotation type from the header of this ruler.
|
void |
setAnnotationTypeColor(Object annotationType,
Color color)
Sets the color for the given annotation type in this overview ruler.
|
void |
setAnnotationTypeLayer(Object annotationType,
int layer)
Sets the drawing layer for the given annotation type in this overview ruler.
|
void |
setModel(IAnnotationModel model)
Associates an annotation model with this ruler.
|
void |
setUseSaturatedColors(boolean useSaturatedColor)
Sets whether to use saturated colors in the overview 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()
Forces the vertical ruler to synchronize itself with its
annotation model and its viewer's view port.
|
public OverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors)
Note: As of 3.4, temporary annotations are no longer discolored.
Use OverviewRuler(IAnnotationAccess, int, ISharedTextColors, boolean)
if you
want to keep the old behavior.
annotationAccess
- the annotation accesswidth
- the width of the vertical rulersharedColors
- the color managerpublic OverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors, boolean discolorTemporaryAnnotation)
annotationAccess
- the annotation accesswidth
- the width of the vertical rulersharedColors
- the color managerdiscolorTemporaryAnnotation
- true
if temporary annotations should be discoloredpublic Control getControl()
IVerticalRulerInfo
getControl
in interface IVerticalRulerInfo
public int getWidth()
IVerticalRulerInfo
getWidth
in interface IVerticalRulerInfo
public void setModel(IAnnotationModel model)
IVerticalRuler
null
is acceptable and clears the ruler.setModel
in interface IVerticalRuler
model
- the new annotation model, may be null
public Control createControl(Composite parent, ITextViewer textViewer)
IVerticalRuler
createControl
in interface IVerticalRuler
parent
- the parent control of the ruler's controltextViewer
- the text viewer to which this ruler belongspublic void update()
IVerticalRuler
update
in interface IVerticalRuler
public void addAnnotationType(Object annotationType)
IOverviewRuler
addAnnotationType
in interface IOverviewRuler
annotationType
- the annotation typepublic void removeAnnotationType(Object annotationType)
IOverviewRuler
removeAnnotationType
in interface IOverviewRuler
annotationType
- the annotation typepublic void setAnnotationTypeLayer(Object annotationType, int layer)
IOverviewRuler
setAnnotationTypeLayer
in interface IOverviewRuler
annotationType
- the annotation typelayer
- the drawing layerpublic void setAnnotationTypeColor(Object annotationType, Color color)
IOverviewRuler
setAnnotationTypeColor
in interface IOverviewRuler
annotationType
- the annotation typecolor
- the colorpublic int getLineOfLastMouseButtonActivity()
IVerticalRulerInfo
getLineOfLastMouseButtonActivity
in interface IVerticalRulerInfo
-1
if
the last mouse activity does not correspond to a valid document linepublic int toDocumentLineNumber(int y_coordinate)
IVerticalRulerInfo
toDocumentLineNumber
in interface IVerticalRulerInfo
y_coordinate
- a y-coordinate of the ruler's SWT control-1
if that
coordinate does not correspond to a valid document linepublic IAnnotationModel getModel()
IVerticalRuler
null
if the ruler has no model.getModel
in interface IVerticalRuler
null
if there is no modelpublic int getAnnotationHeight()
IOverviewRuler
getAnnotationHeight
in interface IOverviewRuler
public boolean hasAnnotation(int y)
IOverviewRuler
hasAnnotation
in interface IOverviewRuler
y
- the y-coordinatetrue
if there is an annotation, false
otherwisepublic Control getHeaderControl()
IOverviewRuler
getHeaderControl
in interface IOverviewRuler
public void addHeaderAnnotationType(Object annotationType)
IOverviewRuler
addHeaderAnnotationType
in interface IOverviewRuler
annotationType
- the annotation type to be trackedpublic void removeHeaderAnnotationType(Object annotationType)
IOverviewRuler
removeHeaderAnnotationType
in interface IOverviewRuler
annotationType
- the annotation type to be removedpublic void setUseSaturatedColors(boolean useSaturatedColor)
The initial value is defined by the ruler implementation.
setUseSaturatedColors
in interface IOverviewRulerExtension
useSaturatedColor
- true
if saturated colors should be used,
false
otherwise
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.