public class JavaCompletionContributor extends CompletionContributor
Modifier and Type | Field and Description |
---|---|
static ElementPattern<PsiElement> |
IN_SWITCH_LABEL |
EP
Constructor and Description |
---|
JavaCompletionContributor() |
Modifier and Type | Method and Description |
---|---|
static void |
addAllClasses(CompletionParameters parameters,
CompletionResultSet result,
JavaCompletionSession session) |
java.lang.String |
advertise(CompletionParameters parameters) |
static void |
advertiseSecondCompletion(Project project,
CompletionResultSet result) |
static ElementFilter |
applyScopeFilter(ElementFilter filter,
PsiElement position) |
void |
beforeCompletion(CompletionInitializationContext context)
Invoked before completion is started.
|
void |
fillCompletionVariants(CompletionParameters parameters,
CompletionResultSet _result)
The main contributor method that is supposed to provide completion variants to result, based on completion parameters.
|
static ElementFilter |
getReferenceFilter(PsiElement position) |
java.lang.String |
handleEmptyLookup(CompletionParameters parameters,
Editor editor) |
boolean |
invokeAutoPopup(PsiElement position,
char typeChar) |
static boolean |
isInJavaContext(PsiElement position) |
static boolean |
mayStartClassName(CompletionResultSet result) |
static boolean |
semicolonNeeded(Editor editor,
PsiFile file,
int startOffset) |
duringCompletion, extend, forLanguage, forLanguageHonorDumbness, forParameters, handleAutoCompletionPossibility
public static final ElementPattern<PsiElement> IN_SWITCH_LABEL
public static ElementFilter getReferenceFilter(PsiElement position)
public static ElementFilter applyScopeFilter(ElementFilter filter, PsiElement position)
public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet _result)
CompletionContributor
CompletionProvider
s you could register by
invoking CompletionContributor.extend(CompletionType, ElementPattern, CompletionProvider)
from your contributor constructor,
matches the desired completion type and ElementPattern
with actual ones, and, depending on it, invokes those
completion providers.
If you want to implement this functionality directly by overriding this method, the following is for you.
Always check that parameters match your situation, and that completion type (CompletionParameters.getCompletionType()
is of your favourite kind. This method is run inside a read action. If you do any long activity non-related to PSI in it, please
ensure you call ProgressManager.checkCanceled()
often enough so that the completion process
can be cancelled smoothly when the user begins to type in the editor.
fillCompletionVariants
in class CompletionContributor
public static boolean isInJavaContext(PsiElement position)
public static void addAllClasses(CompletionParameters parameters, CompletionResultSet result, JavaCompletionSession session)
public static void advertiseSecondCompletion(Project project, CompletionResultSet result)
public static boolean mayStartClassName(CompletionResultSet result)
public java.lang.String advertise(CompletionParameters parameters)
advertise
in class CompletionContributor
public java.lang.String handleEmptyLookup(CompletionParameters parameters, Editor editor)
handleEmptyLookup
in class CompletionContributor
public boolean invokeAutoPopup(PsiElement position, char typeChar)
invokeAutoPopup
in class CompletionContributor
public void beforeCompletion(CompletionInitializationContext context)
CompletionContributor
beforeCompletion
in class CompletionContributor