void (@NotNull String pattern, @NotNull ProgressIndicator progressIndicator, @NotNull Processor<? super FoundItemDescriptor<Object>> consumer) { if (myProject == null) { return; //nothing to search } String searchString = filterControlSymbols(pattern); boolean preferStartMatches = !searchString.startsWith("*"); MinusculeMatcher matcher = createMatcher(searchString, preferStartMatches); List<VirtualFile> opened = Arrays.asList(FileEditorManager.getInstance(myProject).getSelectedFiles()); List<VirtualFile> history = Lists.reverse(EditorHistoryManager.getInstance(myProject).getFileList()); List<FoundItemDescriptor<Object>> res = new ArrayList<>(); ProgressIndicatorUtils.yieldToPendingWriteActions(); ProgressIndicatorUtils.runInReadActionWithWriteActionPriority( () -> { PsiManager psiManager = PsiManager.getInstance(myProject); StreamEx<VirtualFile> stream = StreamEx.of(history); if (!StringUtil.isEmptyOrSpaces(searchString)) { stream = stream.filter(file -> matcher.matches(file.getName())); } Comparator<FoundItemDescriptor<?>> comparator = Comparator.comparing(it -> it.getWeight()); stream.filter(vf -> !opened.contains(vf) && vf.isValid()) .distinct() .map(vf -> { PsiFile f = psiManager.findFile(vf); String name = vf.getName(); return f == null ? null : new FoundItemDescriptor<Object>(f, matcher.matchingDegree(name)); }) .nonNull() .sorted(comparator.reversed()) .into(res); ContainerUtil.process(res, consumer); }, progressIndicator); }