Class AbstractInlinedAnnotation
java.lang.Object
org.eclipse.jface.text.source.Annotation
org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation
- Direct Known Subclasses:
LineContentAnnotation,LineFooterAnnotation,LineHeaderAnnotation
Abstract class for inlined annotation.
- Since:
- 3.13
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
FieldsFields inherited from class org.eclipse.jface.text.source.Annotation
TYPE_UNKNOWN -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractInlinedAnnotation(Position position, ISourceViewer viewer) Inlined annotation constructor.protectedAbstractInlinedAnnotation(Position position, ISourceViewer viewer, Consumer<MouseEvent> onMouseHover, Consumer<MouseEvent> onMouseOut, Consumer<MouseEvent> onMouseMove) Inlined annotation constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(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 theStyledTextwidget where the annotation must be drawn.Returns theISourceViewerwhere the annotation must be drawn.protected booleanReturn whether the annotation is in visible lines.protected booleanisInVisibleLines(int offset) Return whether the given offset is in visible lines.voidCalled when mouse over the inlined annotation.voidCalled when mouse moved in the inlined annotation.voidCalled when mouse out the inlined annotation.voidredraw()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- theISourceViewerwhere the annotation must be drawn.
-
AbstractInlinedAnnotation
protected AbstractInlinedAnnotation(Position position, ISourceViewer viewer, Consumer<MouseEvent> onMouseHover, Consumer<MouseEvent> onMouseOut, Consumer<MouseEvent> onMouseMove) Inlined annotation constructor.- Parameters:
position- the position where the annotation must be drawn.viewer- theISourceViewerwhere the annotation must be drawn.onMouseHover- the consumer to be called on mouse hover. If set, the implementor needs to take care of setting the cursor if wanted.onMouseOut- the consumer to be called on mouse out. If set, the implementor needs to take care of resetting the cursor.onMouseMove- the consumer to be called on mouse move- Since:
- 3.27
-
-
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 theStyledTextwidget where the annotation must be drawn.- Returns:
- the
StyledTextwidget where the annotation must be drawn.
-
getViewer
Returns theISourceViewerwhere the annotation must be drawn.- Returns:
- the
ISourceViewerwhere 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
-
onMouseMove
Called when mouse moved in the inlined annotation.- Parameters:
e- the mouse event- Since:
- 3.27
-
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:
trueif the annotation is in visible lines andfalseotherwise.
-
isInVisibleLines
protected boolean isInVisibleLines(int offset) Return whether the given offset is in visible lines.- Parameters:
offset- the offset- Returns:
trueif the given offset is in visible lines andfalseotherwise.
-