void (@NotNull Map<SearchRequestCollector, Processor<? super PsiReference>> collectors, @NotNull Set<RequestWithProcessor> locals, @NotNull Map<TextIndexQuery, Collection<RequestWithProcessor>> globals, @NotNull List<? super Computable<Boolean>> customs, @NotNull Map<RequestWithProcessor, Processor<? super PsiElement>> localProcessors) { for (Map.Entry<SearchRequestCollector, Processor<? super PsiReference>> entry : collectors.entrySet()) { ProgressManager.checkCanceled(); Processor<? super PsiReference> processor = entry.getValue(); SearchRequestCollector collector = entry.getKey(); for (PsiSearchRequest primitive : collector.takeSearchRequests()) { ProgressManager.checkCanceled(); SearchScope scope = primitive.searchScope; if (scope instanceof LocalSearchScope) { registerRequest(locals, primitive, processor); } else { TextIndexQuery key = TextIndexQuery.fromWord(primitive.word, primitive.caseSensitive, null); registerRequest(globals.computeIfAbsent(key, __ -> new SmartList<>()), primitive, processor); } } for (Processor<? super Processor<? super PsiReference>> customAction : collector.takeCustomSearchActions()) { ProgressManager.checkCanceled(); customs.add((Computable<Boolean>)() -> customAction.process(processor)); } } for (Map.Entry<TextIndexQuery, Collection<RequestWithProcessor>> entry : globals.entrySet()) { ProgressManager.checkCanceled(); for (RequestWithProcessor singleRequest : entry.getValue()) { ProgressManager.checkCanceled(); PsiSearchRequest primitive = singleRequest.request; StringSearcher searcher = new StringSearcher(primitive.word, primitive.caseSensitive, true, false); BulkOccurrenceProcessor adapted = adaptProcessor(primitive, singleRequest.refProcessor); Processor<PsiElement> localProcessor = localProcessor(searcher, adapted); Processor<? super PsiElement> old = localProcessors.put(singleRequest, localProcessor); assert old == null : old + ";" + localProcessor +"; singleRequest="+singleRequest; } } }