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 Summary
Modifier and TypeMethodDescriptionvoid
dispose()
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.Returns the line position where code mining must be displayed in the line spacing area.Returns the owner provider which has created this mining.boolean
Returns 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
-
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 byresolve(ITextViewer, IProgressMonitor)
operation.The returned label can have several values:
null
when mining is not resolvednull
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
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
).- 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
).
-
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
Draw the code mining.- Parameters:
gc
- the graphics contexttextWidget
- the text widget to draw oncolor
- the color of the linex
- the x position of the annotationy
- 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.
-