use of com.intellij.ide.SearchTopHitProvider in project intellij-community by JetBrains.
the class GotoActionItemProvider method processTopHits.
private static boolean processTopHits(String pattern, Processor<MatchedValue> consumer, DataContext dataContext) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
final CollectConsumer<Object> collector = new CollectConsumer<>();
for (SearchTopHitProvider provider : SearchTopHitProvider.EP_NAME.getExtensions()) {
if (provider instanceof OptionsTopHitProvider.CoveredByToggleActions)
continue;
if (provider instanceof OptionsTopHitProvider && !((OptionsTopHitProvider) provider).isEnabled(project))
continue;
if (provider instanceof OptionsTopHitProvider && !StringUtil.startsWith(pattern, "#")) {
String prefix = "#" + ((OptionsTopHitProvider) provider).getId() + " ";
provider.consumeTopHits(prefix + pattern, collector, project);
}
provider.consumeTopHits(pattern, collector, project);
}
Collection<Object> result = collector.getResult();
return processItems(pattern, JBIterable.from(result).filter(Comparable.class), consumer);
}
Aggregations