@MimeLocation(subfolderName="CompletionProviders") public interface CompletionProvider
Editors/<mime-type>folder. The registered implementation will then be used for documents that are of the specified
|Modifier and Type||Field and Description|
|Modifier and Type||Method and Description|
Creates a task that performs a query of the given type on the given component.
Determines whether text typed in a document should automatically pop up the code completion window.
static final int COMPLETION_QUERY_TYPE
intvalue representing the query for a code completion.
static final int DOCUMENTATION_QUERY_TYPE
intvalue representing the query for a documentation.
static final int TOOLTIP_QUERY_TYPE
intvalue representing the query for a tooltip hint.
static final int COMPLETION_ALL_QUERY_TYPE
intvalue 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
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.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
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
CompletionProviders 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
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.TOOLTIP_QUERY_TYPEvalues, or zero if no query should be automatically invoked.