Interface ICodeMining

All Known Implementing Classes:
AbstractCodeMining, LineContentCodeMining, LineEndCodeMining, LineHeaderCodeMining

public interface ICodeMining
A code mining represents a content (ex: label, icons) that should be shown along with source text, like the number of references, a way to run tests (with run/debug icons), etc. A code mining is unresolved when no content (ex: label, icons) is associated to it. For performance reasons the creation of a code mining and resolving should be done to two stages.
Since:
3.13
  • Method Details

    • getPosition

      Position getPosition()
      Returns the line position where code mining must be displayed in the line spacing area.
      Returns:
      the line position where code mining must be displayed in the line spacing area.
    • getProvider

      ICodeMiningProvider getProvider()
      Returns the owner provider which has created this mining.
      Returns:
      the owner provider which has created this mining.
    • getLabel

      String getLabel()
      Returns the label may be set early in the class lifecycle, or upon completion of the future provided by resolve(ITextViewer, IProgressMonitor) operation.

      The returned label can have several values:

      • null when mining is not resolved
      • null when mining is resolved means that mining was resolved with an error and it will not be displayed.
      • empty when mining is resolved means that mining will not be displayed
      • non empty when mining must be displayed
      Returns:
      the label may be set early in the class lifecycle, or upon completion of the future provided by resolve(ITextViewer, IProgressMonitor) operation.
    • resolve

      CompletableFuture<Void> resolve(ITextViewer viewer, IProgressMonitor monitor)
      Returns the future to resolve the content of mining, or CompletableFuture.completedFuture(Object) if no such resolution is necessary (in which case {#isResolved()} is expected to return true).
      Parameters:
      viewer - the viewer.
      monitor - the monitor.
      Returns:
      the future to resolve the content of mining, or CompletableFuture.completedFuture(Object) if no such resolution is necessary (in which case {#isResolved()} is expected to return true).
    • isResolved

      boolean isResolved()
      Returns whether the content mining is resolved. If it is not resolved, {resolve(ITextViewer, IProgressMonitor)} will be invoked later, triggering the future to resolve content.
      Returns:
      whether the content mining is resolved. If it is not resolved, {resolve(ITextViewer, IProgressMonitor)} will be invoked later, triggering the future to resolve content.
    • draw

      Point draw(GC gc, StyledText textWidget, Color color, int x, int y)
      Draw the code mining.
      Parameters:
      gc - the graphics context
      textWidget - the text widget to draw on
      color - the color of the line
      x - the x position of the annotation
      y - the y position of the annotation
      Returns:
      the size of the draw of mining.
    • getAction

      Consumer<MouseEvent> getAction()
      Returns the action to execute when mining is clicked and null otherwise.
      Returns:
      the action to execute when mining is clicked and null otherwise.
    • dispose

      void dispose()
      Dispose the mining. Typically shuts down or cancels all related asynchronous operations.