Class AbstractInlinedAnnotation

java.lang.Object
org.eclipse.jface.text.source.Annotation
org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation
Direct Known Subclasses:
LineContentAnnotation, LineHeaderAnnotation

public abstract class AbstractInlinedAnnotation extends Annotation
Abstract class for inlined annotation.
Since:
3.13
Restriction:
This interface is not intended to be implemented by clients.
  • Field Details

  • Constructor Details

    • AbstractInlinedAnnotation

      protected AbstractInlinedAnnotation(Position position, ISourceViewer viewer)
      Inlined annotation constructor.
      Parameters:
      position - the position where the annotation must be drawn.
      viewer - the ISourceViewer where the annotation must be drawn.
  • Method Details

    • getPosition

      public Position getPosition()
      Returns the position where the annotation must be drawn. For ITextViewerExtension5 (enabling folding with widget/model projection), this position is the model position.
      Returns:
      the model position where the annotation must be drawn.
    • getTextWidget

      public StyledText getTextWidget()
      Returns the StyledText widget where the annotation must be drawn.
      Returns:
      the StyledText widget where the annotation must be drawn.
    • getViewer

      public ISourceViewer getViewer()
      Returns the ISourceViewer 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 context
      textWidget - the text widget to draw on
      widgetOffset - the offset
      length - the length of the line
      color - the color of the line
      x - the x position of the annotation
      y - the y position of the annotation
    • onMouseHover

      public void onMouseHover(MouseEvent e)
      Called when mouse over the inlined annotation.
      Parameters:
      e - the mouse event
    • onMouseOut

      public void onMouseOut(MouseEvent e)
      Called when mouse out the inlined annotation.
      Parameters:
      e - the mouse event
    • getAction

      public Consumer<MouseEvent> getAction(MouseEvent e)
      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 and false 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 and false otherwise.