Class LineContentAnnotation
java.lang.Object
org.eclipse.jface.text.source.Annotation
org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation
org.eclipse.jface.text.source.inlined.LineContentAnnotation
Inlined annotation which is drawn in the line content and which takes some place with a given
width.
- Since:
- 3.13
-
Field Summary
Fields inherited from class org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation
TYPE
Fields inherited from class org.eclipse.jface.text.source.Annotation
TYPE_UNKNOWN
-
Constructor Summary
ConstructorDescriptionLineContentAnnotation
(Position position, ISourceViewer viewer) Line content annotation constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
draw
(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) Draw the inlined annotation.protected int
drawAndComputeWidth
(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) Draw the inlined annotation.final int
getWidth()
Returns the annotation width.Methods inherited from class org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation
getAction, getPosition, getTextWidget, getViewer, isInVisibleLines, isInVisibleLines, onMouseHover, onMouseOut, redraw
Methods inherited from class org.eclipse.jface.text.source.Annotation
getText, getType, isMarkedDeleted, isPersistent, markDeleted, setText, setType
-
Constructor Details
-
LineContentAnnotation
Line content annotation constructor.- Parameters:
position
- the position where the annotation must be drawn.viewer
- theISourceViewer
where the annotation must be drawn.
-
-
Method Details
-
getWidth
public final int getWidth()Returns the annotation width. By default it computes the well width for the text annotation.- Returns:
- the annotation width.
-
draw
public final void draw(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) Draw the inlined annotation. By default it draw the text of the annotation with gray color. User can override this method to draw anything.After drawn, compute the text width and update it.
- Overrides:
draw
in classAbstractInlinedAnnotation
- Parameters:
gc
- the graphics contexttextWidget
- the text widget to draw onoffset
- the offsetlength
- the length of the linecolor
- the color of the linex
- the x position of the annotationy
- the y position of the annotation
-
drawAndComputeWidth
protected int drawAndComputeWidth(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) Draw the inlined annotation. By default it draws the text of the annotation with gray color. User can override this method to draw anything.- Parameters:
gc
- the graphics contexttextWidget
- the text widget to draw onoffset
- the offset of the linelength
- the length of the linecolor
- the color of the linex
- the x position of the annotationy
- the y position of the annotation- Returns:
- the text width.
-