T
- completion element type.public class ValuesCompletionProvider<T> extends java.lang.Object implements TextCompletionProvider
ValuesCompletionProvider.ValuesCompletionProviderDumbAware
for dumb aware version.
Completion elements and their presentation (represented with TextCompletionValueDescriptor
) are provided in constructor.
Use TextFieldWithCompletion
to create a text field component with completion.
Completion is done via TextFieldCompletionProvider
.
Modifier and Type | Class and Description |
---|---|
class |
ValuesCompletionProvider.CompletionCharInsertHandler |
static class |
ValuesCompletionProvider.ValuesCompletionProviderDumbAware<T> |
Modifier and Type | Field and Description |
---|---|
protected TextCompletionValueDescriptor<T> |
myDescriptor |
protected java.util.Collection<? extends T> |
myValues |
Constructor and Description |
---|
ValuesCompletionProvider(TextCompletionValueDescriptor<T> presentation,
java.util.Collection<? extends T> values)
Creates a completion provider for selecting single value from a list of values.
|
ValuesCompletionProvider(TextCompletionValueDescriptor<T> descriptor,
java.util.List<java.lang.Character> separators,
java.util.Collection<? extends T> values,
boolean caseSensitive)
Create a completion provider.
|
Modifier and Type | Method and Description |
---|---|
CharFilter.Result |
acceptChar(char c) |
CompletionResultSet |
applyPrefixMatcher(CompletionResultSet result,
java.lang.String prefix) |
void |
fillCompletionVariants(CompletionParameters parameters,
java.lang.String prefix,
CompletionResultSet result) |
java.lang.String |
getAdvertisement() |
java.lang.String |
getPrefix(java.lang.String text,
int offset) |
protected static java.lang.String |
getPrefix(java.lang.String text,
int offset,
java.util.Collection<java.lang.Character> separators) |
protected java.util.Collection<? extends T> |
getValues(java.lang.String prefix,
CompletionResultSet result) |
protected LookupElement |
installInsertHandler(LookupElementBuilder builder) |
protected final TextCompletionValueDescriptor<T> myDescriptor
protected final java.util.Collection<? extends T> myValues
public ValuesCompletionProvider(TextCompletionValueDescriptor<T> descriptor, java.util.List<java.lang.Character> separators, java.util.Collection<? extends T> values, boolean caseSensitive)
descriptor
- descriptor for completion values (text, icons, etc).separators
- characters that separate values in the editor (like new line or space). If user is supposed to choose only one value this list should be empty.values
- values to show in completion.caseSensitive
- is completion case-sensitive.public ValuesCompletionProvider(TextCompletionValueDescriptor<T> presentation, java.util.Collection<? extends T> values)
presentation
- descriptor for completion values.values
- list of values.public java.lang.String getAdvertisement()
getAdvertisement
in interface TextCompletionProvider
public java.lang.String getPrefix(java.lang.String text, int offset)
getPrefix
in interface TextCompletionProvider
protected static java.lang.String getPrefix(java.lang.String text, int offset, java.util.Collection<java.lang.Character> separators)
public CompletionResultSet applyPrefixMatcher(CompletionResultSet result, java.lang.String prefix)
applyPrefixMatcher
in interface TextCompletionProvider
public CharFilter.Result acceptChar(char c)
acceptChar
in interface TextCompletionProvider
public void fillCompletionVariants(CompletionParameters parameters, java.lang.String prefix, CompletionResultSet result)
fillCompletionVariants
in interface TextCompletionProvider
protected LookupElement installInsertHandler(LookupElementBuilder builder)
protected java.util.Collection<? extends T> getValues(java.lang.String prefix, CompletionResultSet result)