void (PsiElement @NotNull [] primaryElements, PsiElement @NotNull [] secondaryElements, @NotNull FindUsagesHandler handler, @NotNull PsiFile scopeFile, @NotNull FileSearchScope direction, @NotNull FindUsagesOptions findUsagesOptions, @NotNull Editor editor) { ThreadingAssertions.assertEventDispatchThread(); initLastSearchElement(findUsagesOptions, primaryElements, secondaryElements); clearStatusBar(); PsiElement2UsageTargetAdapter[] primaryTargets = PsiElement2UsageTargetAdapter.convert(primaryElements, false); PsiElement2UsageTargetAdapter[] secondaryTargets = PsiElement2UsageTargetAdapter.convert(primaryElements, false); UsageSearcher usageSearcher = createUsageSearcher(primaryTargets, secondaryTargets, handler, findUsagesOptions, scopeFile); AtomicBoolean usagesWereFound = new AtomicBoolean(); int startOffset = editor.getCaretModel().getOffset(); new Task.Backgroundable(myProject, FindBundle.message("find.progress.searching.message", "editor")){ private Usage myUsage; @Override public void run(@NotNull ProgressIndicator indicator) { myUsage = findSiblingUsage(usageSearcher, direction, startOffset, usagesWereFound, editor); } @Override public void onFinished() { if (FindUsagesManager.this.myProject.isDisposed() || editor.isDisposed()) return; if (myUsage != null) { myUsage.navigate(true); myUsage.selectInEditor(); } else if (!usagesWereFound.get()) { String message = getNoUsagesFoundMessage(primaryElements[0], scopeFile.getName()); showEditorHint(message, editor); } else { editor.putUserData(KEY_START_USAGE_AGAIN, VALUE_START_USAGE_AGAIN); showEditorHint(getSearchAgainMessage(primaryElements[0], direction), editor); } } }.queue(); }