Interface ICodeMining
- All Known Implementing Classes:
- AbstractCodeMining,- DocumentFooterCodeMining,- 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 SummaryModifier and TypeMethodDescriptionvoiddispose()Dispose the mining.draw(GC gc, StyledText textWidget, Color color, int x, int y) Draw the code mining.Returns the action to execute when mining is clicked and null otherwise.getLabel()Returns the label may be set early in the class lifecycle, or upon completion of the future provided byresolve(ITextViewer, IProgressMonitor)operation.default Consumer<MouseEvent> Returns a consumer which is called when mouse is hovered over the code mining.default Consumer<MouseEvent> Returns a consumer which is called when mouse is moved inside the code mining.default Consumer<MouseEvent> Returns a consumer which is called when mouse is moved out of code mining.Returns the line position where code mining must be displayed in the line spacing area.Returns the owner provider which has created this mining.booleanReturns whether the content mining is resolved.resolve(ITextViewer viewer, IProgressMonitor monitor) Returns the future to resolve the content of mining, orCompletableFuture.completedFuture(Object)if no such resolution is necessary (in which case {#isResolved()} is expected to returntrue).
- 
Method Details- 
getPositionPosition 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.
 
- 
getProviderICodeMiningProvider getProvider()Returns the owner provider which has created this mining.- Returns:
- the owner provider which has created this mining.
 
- 
getLabelString getLabel()Returns the label may be set early in the class lifecycle, or upon completion of the future provided byresolve(ITextViewer, IProgressMonitor)operation.The returned label can have several values: - nullwhen mining is not resolved
- nullwhen 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.
 
- 
resolveReturns the future to resolve the content of mining, orCompletableFuture.completedFuture(Object)if no such resolution is necessary (in which case {#isResolved()} is expected to returntrue).- 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 returntrue).
 
- 
isResolvedboolean 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.
 
- 
drawDraw 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.
 
- 
getActionConsumer<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.
 
- 
getMouseHoverReturns a consumer which is called when mouse is hovered over the code mining. If set, the implementor needs to take care of setting the cursor if wanted.- Since:
- 3.27
 
- 
getMouseOutReturns a consumer which is called when mouse is moved out of code mining. If set, the implementor needs to take care of resetting the cursor.- Since:
- 3.27
 
- 
getMouseMoveReturns a consumer which is called when mouse is moved inside the code mining.- Since:
- 3.27
 
- 
disposevoid dispose()Dispose the mining. Typically shuts down or cancels all related asynchronous operations.
 
-