void (final @NotNull Processor<? super Usage> processor, @NotNull Project project) { final Ref<UsageInfo[]> refUsages = new Ref<>(); final Ref<Boolean> dumbModeOccurred = new Ref<>(); ApplicationManager.getApplication().runReadAction(() -> { try { refUsages.set(findUsages()); } catch (IndexNotReadyException e) { dumbModeOccurred.set(true); } }); if (!dumbModeOccurred.isNull()) { DumbService.getInstance(project).showDumbModeNotificationForFunctionality( UsageViewBundle.message("notification.usage.search.is.not.available.until.indices.are.ready"), DumbModeBlockedFunctionality.UsageInfoSearcherAdapter); return; } final Usage[] usages = ReadAction.compute(() -> UsageInfo2UsageAdapter.convert(refUsages.get())); for (final Usage usage : usages) { ApplicationManager.getApplication().runReadAction(() -> { processor.process(usage); }); } }