void () { ApplicationManager.getApplication().assertIsNonDispatchThread(); int usageCount = myUsageCountWithoutDefinition.get(); if (usageCount == 0) { if (myProcessPresentation.isShowNotFoundMessage()) { ApplicationManager.getApplication().invokeLater(() -> { if (myProcessPresentation.isCanceled()) { notifyByFindBalloon(null, MessageType.WARNING, Collections.singletonList(UsageViewBundle.message("message.usage.search.was.canceled"))); } else { List<String> lines = new ArrayList<>(); lines.add(StringUtil.escapeXmlEntities(myPresentation.getSearchString())); lines.add(UsageViewBundle.message("search.result.nothing.in.0", StringUtil.escapeXmlEntities(myPresentation.getScopeText()))); if (myOutOfScopeUsages.get() != 0) { lines.add(UsageViewManagerImpl.outOfScopeMessage(myOutOfScopeUsages.get(), mySearchScopeToWarnOfFallingOutOf)); } if (myProcessPresentation.isShowFindOptionsPrompt()) { lines.add(createOptionsHtml(mySearchFor)); } MessageType type = myOutOfScopeUsages.get() == 0 ? MessageType.INFO : MessageType.WARNING; notifyByFindBalloon(createGotToOptionsListener(mySearchFor), type, lines); } }, ModalityState.nonModal(), myProject.getDisposed()); } } else if (usageCount == 1 && !myProcessPresentation.isShowPanelIfOnlyOneUsage()) { ApplicationManager.getApplication().invokeLater(() -> { Usage usage = myFirstUsage.get(); if (usage.canNavigate()) { usage.navigate(true); flashUsageScriptaculously(usage); } List<String> lines = new ArrayList<>(); lines.add(UsageViewBundle.message("message.only.one.usage.found")); if (myOutOfScopeUsages.get() != 0) { lines.add(UsageViewManagerImpl.outOfScopeMessage(myOutOfScopeUsages.get(), mySearchScopeToWarnOfFallingOutOf)); } lines.add(createOptionsHtml(mySearchFor)); MessageType type = myOutOfScopeUsages.get() == 0 ? MessageType.INFO : MessageType.WARNING; notifyByFindBalloon(createGotToOptionsListener(mySearchFor), type, lines); }, ModalityState.nonModal(), myProject.getDisposed()); } else { UsageViewEx usageView = myUsageViewRef.get(); usageView.searchFinished(); List<String> lines; HyperlinkListener hyperlinkListener; if (myOutOfScopeUsages.get() == 0 || getPsiElement(mySearchFor)==null) { lines = Collections.emptyList(); hyperlinkListener = null; } else { lines = Arrays.asList(UsageViewManagerImpl.outOfScopeMessage(myOutOfScopeUsages.get(), mySearchScopeToWarnOfFallingOutOf), createSearchInProjectHtml()); hyperlinkListener = createSearchInProjectListener(); } if (!myProcessPresentation.getLargeFiles().isEmpty() || myOutOfScopeUsages.get() != 0 || myProcessPresentation.searchIncludingProjectFileUsages() != null || !getUnloadedModulesBelongingToScope().isEmpty()) { ApplicationManager.getApplication().invokeLater(() -> { MessageType type = myOutOfScopeUsages.get() == 0 ? MessageType.INFO : MessageType.WARNING; notifyByFindBalloon(hyperlinkListener, type, lines); }, ModalityState.nonModal(), myProject.getDisposed()); } } UsageViewEx usageView = myUsageViewRef.get(); if (usageView != null) { usageView.waitForUpdateRequestsCompletion(); } if (myListener != null) { myListener.findingUsagesFinished(usageView); } }