public abstract class CompletionResultSet extends java.lang.Object implements Consumer<LookupElement>
CompletionResultSet
s feed on LookupElement
s,
match them against specified
PrefixMatcher
and give them to special Consumer
for further processing, which usually means
they will sooner or later appear in completion list. If they don't, there must be some CompletionContributor
up the invocation stack that filters them out.
If you want to change the matching prefix, use withPrefixMatcher(PrefixMatcher)
or withPrefixMatcher(String)
to obtain another CompletionResultSet
and give your lookup elements to that one.Modifier and Type | Field and Description |
---|---|
protected CompletionService |
myCompletionService |
protected CompletionContributor |
myContributor |
EMPTY_CONSUMER
Modifier | Constructor and Description |
---|---|
protected |
CompletionResultSet(PrefixMatcher prefixMatcher,
Consumer<? super CompletionResult> consumer,
CompletionContributor contributor) |
Modifier and Type | Method and Description |
---|---|
void |
addAllElements(java.lang.Iterable<? extends LookupElement> elements)
Adds all elements from the given collection that match the prefix for further processing.
|
abstract void |
addElement(LookupElement element)
If a given element matches the prefix, give it for further processing (which may eventually result in its appearing in the completion list).
|
abstract void |
addLookupAdvertisement(java.lang.String text) |
abstract CompletionResultSet |
caseInsensitive() |
void |
consume(LookupElement element) |
void |
endBatch() |
protected Consumer<? super CompletionResult> |
getConsumer() |
PrefixMatcher |
getPrefixMatcher() |
boolean |
isStopped() |
void |
passResult(CompletionResult result) |
void |
restartCompletionOnAnyPrefixChange()
Request that the completion contributors be run again when the user changes the prefix in any way.
|
abstract void |
restartCompletionOnPrefixChange(ElementPattern<java.lang.String> prefixCondition)
Request that the completion contributors be run again when the user changes the prefix in a way satisfied by the given condition.
|
void |
restartCompletionOnPrefixChange(java.lang.String prefix)
Request that the completion contributors be run again when the user changes the prefix so that it becomes equal to the one given.
|
abstract void |
restartCompletionWhenNothingMatches()
Request that the completion contributors be run again when the user types something into the editor so that no existing lookup elements match that prefix anymore.
|
java.util.LinkedHashSet<CompletionResult> |
runRemainingContributors(CompletionParameters parameters,
boolean passResult) |
void |
runRemainingContributors(CompletionParameters parameters,
Consumer<? super CompletionResult> consumer) |
void |
runRemainingContributors(CompletionParameters parameters,
Consumer<CompletionResult> consumer,
boolean stop) |
void |
runRemainingContributors(CompletionParameters parameters,
Consumer<CompletionResult> consumer,
boolean stop,
CompletionSorter customSorter) |
void |
startBatch() |
void |
stopHere() |
abstract CompletionResultSet |
withPrefixMatcher(PrefixMatcher matcher) |
abstract CompletionResultSet |
withPrefixMatcher(java.lang.String prefix)
Creates a default camel-hump prefix matcher based on given prefix
|
abstract CompletionResultSet |
withRelevanceSorter(CompletionSorter sorter) |
protected final CompletionService myCompletionService
protected final CompletionContributor myContributor
protected CompletionResultSet(PrefixMatcher prefixMatcher, Consumer<? super CompletionResult> consumer, CompletionContributor contributor)
protected Consumer<? super CompletionResult> getConsumer()
public void consume(LookupElement element)
consume
in interface Consumer<LookupElement>
element
- consequently takes value of each element of the set this processor is passed to for processing.
t is supposed to be a not-null value. If you need to pass null
s to the consumer use NullableConsumer
insteadpublic abstract void addElement(LookupElement element)
addAllElements(Iterable)
public void passResult(CompletionResult result)
public void startBatch()
public void endBatch()
public void addAllElements(java.lang.Iterable<? extends LookupElement> elements)
addAllElements
instead of addElement(LookupElement)
helps to avoid that.public abstract CompletionResultSet withPrefixMatcher(PrefixMatcher matcher)
public abstract CompletionResultSet withPrefixMatcher(java.lang.String prefix)
public abstract CompletionResultSet withRelevanceSorter(CompletionSorter sorter)
public abstract void addLookupAdvertisement(java.lang.String text)
public abstract CompletionResultSet caseInsensitive()
public PrefixMatcher getPrefixMatcher()
public boolean isStopped()
public void stopHere()
public java.util.LinkedHashSet<CompletionResult> runRemainingContributors(CompletionParameters parameters, boolean passResult)
public void runRemainingContributors(CompletionParameters parameters, Consumer<? super CompletionResult> consumer)
public void runRemainingContributors(CompletionParameters parameters, Consumer<CompletionResult> consumer, boolean stop)
public void runRemainingContributors(CompletionParameters parameters, Consumer<CompletionResult> consumer, boolean stop, CompletionSorter customSorter)
public void restartCompletionOnPrefixChange(java.lang.String prefix)
public abstract void restartCompletionOnPrefixChange(ElementPattern<java.lang.String> prefixCondition)
public void restartCompletionOnAnyPrefixChange()
public abstract void restartCompletionWhenNothingMatches()