Package org.eclipse.jface.text.source
Class AnnotationRulerColumn
java.lang.Object
org.eclipse.jface.text.source.AnnotationRulerColumn
- All Implemented Interfaces:
IVerticalRulerColumn,IVerticalRulerInfo,IVerticalRulerInfoExtension
- Direct Known Subclasses:
AnnotationColumn
public class AnnotationRulerColumn
extends Object
implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension
A vertical ruler column showing graphical representations of annotations.
Will become final.
Do not subclass.
- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotationRulerColumn(int width) Constructs this column with the given width.AnnotationRulerColumn(int width, IAnnotationAccess annotationAccess) Constructs this column with the given arguments.AnnotationRulerColumn(IAnnotationModel model, int width) Constructs this column with the given arguments.AnnotationRulerColumn(IAnnotationModel model, int width, IAnnotationAccess annotationAccess) Constructs this column with the given arguments. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotationType(Object annotationType) Adds the given annotation type to this annotation ruler column.voidRegisters a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.createControl(CompositeRuler parentRuler, Composite parentControl) Creates the column's SWT control.protected voidDraws the vertical ruler w/o drawing the Canvas background.protected voidDraws the vertical ruler w/o drawing the Canvas background.protected ITextViewerReturns the cached text viewer.Returns the column's SWT control.getHover()Returns the hover for this vertical ruler (column).protected intReturns the document offset of the upper left corner of the source viewer's view port, possibly including partially visible lines.intReturns the line number of the last mouse button activity.getModel()Returns the model currently used by the receiver.intgetWidth()Returns the width of this column's control.protected booleanhasAnnotation(int lineNumber) Tells whether the given line contains an annotation.protected booleanTells whether this ruler column propagates mouse listener events to its parent.protected voidmouseClicked(int rulerLine) Hook method for a mouse click event on the given ruler line.protected voidmouseDoubleClicked(int rulerLine) Hook method for a mouse double click event on the given ruler line.protected voidmouseDown(int rulerLine) Hook method for a mouse down event on the given ruler line.voidredraw()Redraws this column.voidremoveAnnotationType(Object annotationType) Removes the given annotation type from this annotation ruler column.voidRemoves a previously registered listener.voidSets the font of this ruler column.voidsetHover(IAnnotationHover hover) voidsetModel(IAnnotationModel model) Associates an annotation model with this ruler column.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.
-
Constructor Details
-
AnnotationRulerColumn
Constructs this column with the given arguments.- Parameters:
model- the annotation model to get the annotations fromwidth- the width of the vertical rulerannotationAccess- the annotation access- Since:
- 3.0
-
AnnotationRulerColumn
Constructs this column with the given arguments.- Parameters:
width- the width of the vertical rulerannotationAccess- the annotation access- Since:
- 3.0
-
AnnotationRulerColumn
Constructs this column with the given arguments.- Parameters:
model- the annotation model to get the annotations fromwidth- the width of the vertical ruler
-
AnnotationRulerColumn
public AnnotationRulerColumn(int width) Constructs this column with the given width.- Parameters:
width- the width of the vertical ruler
-
-
Method Details
-
getControl
Description copied from interface:IVerticalRulerColumnReturns the column's SWT control.- Specified by:
getControlin interfaceIVerticalRulerColumn- Specified by:
getControlin interfaceIVerticalRulerInfo- Returns:
- the column's SWT control
-
getWidth
public int getWidth()Description copied from interface:IVerticalRulerColumnReturns the width of this column's control.- Specified by:
getWidthin interfaceIVerticalRulerColumn- Specified by:
getWidthin interfaceIVerticalRulerInfo- Returns:
- the width of this column's control
-
createControl
Description copied from interface:IVerticalRulerColumnCreates the column's SWT control.- Specified by:
createControlin interfaceIVerticalRulerColumn- Parameters:
parentRuler- the parent ruler of this columnparentControl- the control of the parent ruler- Returns:
- the column's SWT control
-
isPropagatingMouseListener
protected boolean isPropagatingMouseListener()Tells whether this ruler column propagates mouse listener events to its parent.- Returns:
trueif propagating to parent- Since:
- 3.0
-
mouseDown
protected void mouseDown(int rulerLine) Hook method for a mouse down event on the given ruler line.- Parameters:
rulerLine- the ruler line- Since:
- 3.5
-
mouseDoubleClicked
protected void mouseDoubleClicked(int rulerLine) Hook method for a mouse double click event on the given ruler line.- Parameters:
rulerLine- the ruler line
-
mouseClicked
protected void mouseClicked(int rulerLine) Hook method for a mouse click event on the given ruler line.Note: The event is sent on mouse up.
- Parameters:
rulerLine- the ruler line- Since:
- 3.0
-
hasAnnotation
protected boolean hasAnnotation(int lineNumber) Tells whether the given line contains an annotation.- Parameters:
lineNumber- the line number- Returns:
trueif the given line contains an annotation
-
getInclusiveTopIndexStartOffset
protected int getInclusiveTopIndexStartOffset()Returns the document offset of the upper left corner of the source viewer's view port, possibly including partially visible lines.- Returns:
- document offset of the upper left corner including partially visible lines
-
doPaint
Draws the vertical ruler w/o drawing the Canvas background.- Parameters:
gc- the GC to draw into
-
doPaint1
Draws the vertical ruler w/o drawing the Canvas background. Implementation based onITextViewerExtension5. Will replacedoPaint(GC).- Parameters:
gc- the GC to draw into
-
redraw
public void redraw()Description copied from interface:IVerticalRulerColumnRedraws this column.- Specified by:
redrawin interfaceIVerticalRulerColumn
-
setModel
Description copied from interface:IVerticalRulerColumnAssociates an annotation model with this ruler column. A valuenullis acceptable and clears the ruler.- Specified by:
setModelin interfaceIVerticalRulerColumn- Parameters:
model- the new annotation model, may benull
-
setFont
Description copied from interface:IVerticalRulerColumnSets the font of this ruler column.- Specified by:
setFontin interfaceIVerticalRulerColumn- Parameters:
font- the new font of the ruler column
-
getCachedTextViewer
Returns the cached text viewer.- Returns:
- the cached text viewer
-
getModel
Description copied from interface:IVerticalRulerInfoExtensionReturns the model currently used by the receiver.- Specified by:
getModelin interfaceIVerticalRulerInfoExtension- Returns:
- the model of the receiver, or
nullif no model is installed.
-
addAnnotationType
Adds the given annotation type to this annotation ruler column. Starting with this call, annotations of the given type are shown in this annotation ruler column.- Parameters:
annotationType- the annotation type- Since:
- 3.0
-
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
-
removeAnnotationType
Removes the given annotation type from this annotation ruler column. Annotations of the given type are no longer shown in this annotation ruler column.- Parameters:
annotationType- the annotation type- Since:
- 3.0
-
getHover
Description copied from interface:IVerticalRulerInfoExtensionReturns the hover for this vertical ruler (column).- Specified by:
getHoverin interfaceIVerticalRulerInfoExtension- Returns:
- the hover for this column
-
setHover
- Parameters:
hover- The hover to set.- Since:
- 3.0
-
addVerticalRulerListener
Description copied from interface:IVerticalRulerInfoExtensionRegisters a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.- Specified by:
addVerticalRulerListenerin interfaceIVerticalRulerInfoExtension- Parameters:
listener- the listener to be informed
-
removeVerticalRulerListener
Description copied from interface:IVerticalRulerInfoExtensionRemoves a previously registered listener. Iflisteneris not registered with the receiver, calling this method has no effect.- Specified by:
removeVerticalRulerListenerin interfaceIVerticalRulerInfoExtension- Parameters:
listener- the listener to be removed
-