@MimeLocation(subfolderName="CompletionProviders") public interface CompletionProvider
Editors/<mime-type>
folder. The registered implementation will then be used
for documents that are of the specified mime-type
.
Related documentation
Modifier and Type | Field and Description |
---|---|
static int |
COMPLETION_ALL_QUERY_TYPE
The
int value representing the query for an all code completion. |
static int |
COMPLETION_QUERY_TYPE
The
int value representing the query for a code completion. |
static int |
DOCUMENTATION_QUERY_TYPE
The
int value representing the query for a documentation. |
static int |
TOOLTIP_QUERY_TYPE
The
int value representing the query for a tooltip hint. |
Modifier and Type | Method and Description |
---|---|
CompletionTask |
createTask(int queryType,
JTextComponent component)
Creates a task that performs a query of the given type on the given component.
|
int |
getAutoQueryTypes(JTextComponent component,
String typedText)
Determines whether text typed in a document should automatically pop up the code completion
window.
|
static final int COMPLETION_QUERY_TYPE
int
value representing the query for a code completion.static final int DOCUMENTATION_QUERY_TYPE
int
value representing the query for a documentation.static final int TOOLTIP_QUERY_TYPE
int
value representing the query for a tooltip hint.static final int COMPLETION_ALL_QUERY_TYPE
int
value representing the query for an all code completion.CompletionTask createTask(int queryType, JTextComponent component)
This method is invoked in AWT thread only and the returned task
may either be synchronous (if it's not complex)
or it may be asynchronous
(see AsyncCompletionTask
).
The task usually inspects the component's document, the text up to the caret position and returns the appropriate result.
queryType
- Type of the query. It can be one of the CompletionProvider.COMPLETION_QUERY_TYPE
,
CompletionProvider.COMPLETION_ALL_QUERY_TYPE
, CompletionProvider.DOCUMENTATION_QUERY_TYPE
,
or CompletionProvider.TOOLTIP_QUERY_TYPE
(but not their combination).component
- A text component where the query should be performed.int getAutoQueryTypes(JTextComponent component, String typedText)
An implementation of this method can return any combination of the query type constants
available in this interface to tell the infrastructure that it should call CompletionProvider.createTask(int, JTextComponent)
and show the code completion window. Or it can return zero if the typed text does not trigger
popping up the code completion window.
Please note that there could be multiple CompletionProvider
s registered for
the same mime type and this method is called for all of them. This means that even if a particular
implementation does not want the code completion window to pop up for the typed text (ie. returns zero
from this method) there could be others that recognize the text as a trigger and will return non-zero.
If at least one of the registered CompletionProvider
s returns
non-zero from this method the infrastructure will call createTask
in all the registered
implementations asking them to provide completion items for the requested query type.
component
- A component in which the text was typed.typedText
- Typed text.CompletionProvider.COMPLETION_QUERY_TYPE
, CompletionProvider.COMPLETION_ALL_QUERY_TYPE
,
CompletionProvider.DOCUMENTATION_QUERY_TYPE
, and CompletionProvider.TOOLTIP_QUERY_TYPE
values, or zero if no query should be automatically invoked.