Class AbstractInlinedAnnotation
java.lang.Object
org.eclipse.jface.text.source.Annotation
org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation
- Direct Known Subclasses:
LineContentAnnotation
,LineHeaderAnnotation
Abstract class for inlined annotation.
- Since:
- 3.13
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
Fields inherited from class org.eclipse.jface.text.source.Annotation
TYPE_UNKNOWN
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractInlinedAnnotation
(Position position, ISourceViewer viewer) Inlined annotation constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(GC gc, StyledText textWidget, int widgetOffset, int length, Color color, int x, int y) Draw the inlined annotation.Returns the position where the annotation must be drawn.Returns theStyledText
widget where the annotation must be drawn.Returns theISourceViewer
where the annotation must be drawn.protected boolean
Return whether the annotation is in visible lines.protected boolean
isInVisibleLines
(int offset) Return whether the given offset is in visible lines.void
Called when mouse over the inlined annotation.void
Called when mouse out the inlined annotation.void
redraw()
Redraw the inlined annotation.Methods inherited from class org.eclipse.jface.text.source.Annotation
getText, getType, isMarkedDeleted, isPersistent, markDeleted, setText, setType
-
Field Details
-
TYPE
The type of inlined annotations.- See Also:
-
-
Constructor Details
-
AbstractInlinedAnnotation
Inlined annotation constructor.- Parameters:
position
- the position where the annotation must be drawn.viewer
- theISourceViewer
where the annotation must be drawn.
-
-
Method Details
-
getPosition
Returns the position where the annotation must be drawn. ForITextViewerExtension5
(enabling folding with widget/model projection), this position is the model position.- Returns:
- the model position where the annotation must be drawn.
-
getTextWidget
Returns theStyledText
widget where the annotation must be drawn.- Returns:
- the
StyledText
widget where the annotation must be drawn.
-
getViewer
Returns theISourceViewer
where the annotation must be drawn.- Returns:
- the
ISourceViewer
where the annotation must be drawn.
-
redraw
public void redraw()Redraw the inlined annotation. -
draw
public void draw(GC gc, StyledText textWidget, int widgetOffset, 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.- Parameters:
gc
- the graphics contexttextWidget
- the text widget to draw onwidgetOffset
- the offsetlength
- the length of the linecolor
- the color of the linex
- the x position of the annotationy
- the y position of the annotation
-
onMouseHover
Called when mouse over the inlined annotation.- Parameters:
e
- the mouse event
-
onMouseOut
Called when mouse out the inlined annotation.- Parameters:
e
- the mouse event
-
getAction
- Parameters:
e
- MouseEvent to be used by overrides
-
isInVisibleLines
protected boolean isInVisibleLines()Return whether the annotation is in visible lines.- Returns:
true
if the annotation is in visible lines andfalse
otherwise.
-
isInVisibleLines
protected boolean isInVisibleLines(int offset) Return whether the given offset is in visible lines.- Parameters:
offset
- the offset- Returns:
true
if the given offset is in visible lines andfalse
otherwise.
-