Package org.eclipse.jface.text.source
Class OverviewRuler
java.lang.Object
org.eclipse.jface.text.source.OverviewRuler
- All Implemented Interfaces:
IOverviewRuler,IOverviewRulerExtension,IVerticalRuler,IVerticalRulerInfo
Ruler presented next to a source viewer showing all annotations of the viewer's annotation model
in a compact format. The ruler has the same height as the source viewer.
This overview ruler uses non-saturated colors unless setUseSaturatedColors(boolean) gets
called.
Clients usually instantiate and configure objects of this class.
- Since:
- 2.1
-
Constructor Summary
ConstructorsConstructorDescriptionOverviewRuler(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. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotationType(Object annotationType) Adds the given annotation type to this overview ruler.voidaddHeaderAnnotationType(Object annotationType) Adds the given annotation type to the header of this ruler.createControl(Composite parent, ITextViewer textViewer) Creates the ruler's SWT control.intReturns the height of the visual presentation of an annotation in this overview ruler.Returns the ruler's SWT control.Returns this rulers header control.intReturns the line number of the last mouse button activity.getModel()Returns the current annotation model of this ruler ornullif the ruler has no model.intgetWidth()Returns the width of this ruler's control.booleanhasAnnotation(int y) Returns whether there is an annotation an the given vertical coordinate.voidremoveAnnotationType(Object annotationType) Removes the given annotation type from this overview ruler.voidremoveHeaderAnnotationType(Object annotationType) Removes the given annotation type from the header of this ruler.voidsetAnnotationTypeColor(Object annotationType, Color color) Sets the color for the given annotation type in this overview ruler.voidsetAnnotationTypeLayer(Object annotationType, int layer) Sets the drawing layer for the given annotation type in this overview ruler.voidsetModel(IAnnotationModel model) Associates an annotation model with this ruler.voidsetUseSaturatedColors(boolean useSaturatedColor) Sets whether to use saturated colors in the overview ruler.inttoDocumentLineNumber(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.voidupdate()Forces the vertical ruler to synchronize itself with its annotation model and its viewer's view port.
-
Constructor Details
-
Method Details
-
getControl
Description copied from interface:IVerticalRulerInfoReturns the ruler's SWT control.- Specified by:
getControlin interfaceIVerticalRulerInfo- Returns:
- the ruler's SWT control
-
getWidth
public int getWidth()Description copied from interface:IVerticalRulerInfoReturns the width of this ruler's control.- Specified by:
getWidthin interfaceIVerticalRulerInfo- Returns:
- the width of this ruler's control
-
setModel
Description copied from interface:IVerticalRulerAssociates an annotation model with this ruler. A valuenullis acceptable and clears the ruler.- Specified by:
setModelin interfaceIVerticalRuler- Parameters:
model- the new annotation model, may benull
-
createControl
Description copied from interface:IVerticalRulerCreates the ruler's SWT control.- Specified by:
createControlin interfaceIVerticalRuler- Parameters:
parent- the parent control of the ruler's controltextViewer- the text viewer to which this ruler belongs- Returns:
- the ruler's SWT control
-
update
public void update()Description copied from interface:IVerticalRulerForces the vertical ruler to synchronize itself with its annotation model and its viewer's view port.- Specified by:
updatein interfaceIVerticalRuler
-
addAnnotationType
Description copied from interface:IOverviewRulerAdds the given annotation type to this overview ruler. Starting with this call, annotations of the given type are shown in the overview ruler.- Specified by:
addAnnotationTypein interfaceIOverviewRuler- Parameters:
annotationType- the annotation type
-
removeAnnotationType
Description copied from interface:IOverviewRulerRemoves the given annotation type from this overview ruler. Annotations of the given type are no longer shown in the overview ruler.- Specified by:
removeAnnotationTypein interfaceIOverviewRuler- Parameters:
annotationType- the annotation type
-
setAnnotationTypeLayer
Description copied from interface:IOverviewRulerSets the drawing layer for the given annotation type in this overview ruler.- Specified by:
setAnnotationTypeLayerin interfaceIOverviewRuler- Parameters:
annotationType- the annotation typelayer- the drawing layer
-
setAnnotationTypeColor
Description copied from interface:IOverviewRulerSets the color for the given annotation type in this overview ruler.- Specified by:
setAnnotationTypeColorin interfaceIOverviewRuler- Parameters:
annotationType- the annotation typecolor- the color
-
getLineOfLastMouseButtonActivity
public int getLineOfLastMouseButtonActivity()Description copied from interface:IVerticalRulerInfoReturns the line number of the last mouse button activity. Based on the input document of the connected text viewer.- Specified by:
getLineOfLastMouseButtonActivityin interfaceIVerticalRulerInfo- Returns:
- the line number of the last mouse button activity or
-1if the last mouse activity does not correspond to a valid document line
-
toDocumentLineNumber
public int toDocumentLineNumber(int y_coordinate) Description copied from interface:IVerticalRulerInfoTranslates a y-coordinate of the ruler's SWT control into the according line number of the document of the connected text viewer.- Specified by:
toDocumentLineNumberin interfaceIVerticalRulerInfo- Parameters:
y_coordinate- a y-coordinate of the ruler's SWT control- Returns:
- the line number of that coordinate or
-1if that coordinate does not correspond to a valid document line
-
getModel
Description copied from interface:IVerticalRulerReturns the current annotation model of this ruler ornullif the ruler has no model.- Specified by:
getModelin interfaceIVerticalRuler- Returns:
- this ruler's annotation model or
nullif there is no model
-
getAnnotationHeight
public int getAnnotationHeight()Description copied from interface:IOverviewRulerReturns the height of the visual presentation of an annotation in this overview ruler. Assumes that all annotations are represented using the same height.- Specified by:
getAnnotationHeightin interfaceIOverviewRuler- Returns:
- the visual height of an annotation
-
hasAnnotation
public boolean hasAnnotation(int y) Description copied from interface:IOverviewRulerReturns whether there is an annotation an the given vertical coordinate. This method takes the compression factor of the overview ruler into account.- Specified by:
hasAnnotationin interfaceIOverviewRuler- Parameters:
y- the y-coordinate- Returns:
trueif there is an annotation,falseotherwise
-
getHeaderControl
Description copied from interface:IOverviewRulerReturns this rulers header control. This is the little area between the top of the text widget and the top of this overview ruler.- Specified by:
getHeaderControlin interfaceIOverviewRuler- Returns:
- the header control of this overview ruler.
-
addHeaderAnnotationType
Description copied from interface:IOverviewRulerAdds the given annotation type to the header of this ruler. Starting with this call, the presence of annotations is tracked and the header is drawn in the configured color.- Specified by:
addHeaderAnnotationTypein interfaceIOverviewRuler- Parameters:
annotationType- the annotation type to be tracked
-
removeHeaderAnnotationType
Description copied from interface:IOverviewRulerRemoves the given annotation type from the header of this ruler. The presence of annotations of the given type is no longer tracked and the header is drawn in the default color, depending on the other configured configured annotation types.- Specified by:
removeHeaderAnnotationTypein interfaceIOverviewRuler- Parameters:
annotationType- the annotation type to be removed
-
setUseSaturatedColors
public void setUseSaturatedColors(boolean useSaturatedColor) Sets whether to use saturated colors in the overview ruler.The initial value is defined by the ruler implementation.
- Specified by:
setUseSaturatedColorsin interfaceIOverviewRulerExtension- Parameters:
useSaturatedColor-trueif saturated colors should be used,falseotherwise- Since:
- 3.8
-