private void endSearchForUsages() { int usageCount = myUsageCountWithoutDefinition.get(); if (usageCount == 0 && myProcessPresentation.isShowNotFoundMessage()) { ApplicationManager.getApplication() .invokeLater( new Runnable() { public void run() { final List<Action> notFoundActions = myProcessPresentation.getNotFoundActions(); final String message = UsageViewBundle.message( "dialog.no.usages.found.in", StringUtil.decapitalize(myPresentation.getUsagesString()), myPresentation.getScopeText()); if (notFoundActions == null || notFoundActions.isEmpty()) { ToolWindowManager.getInstance(myProject) .notifyByBalloon( ToolWindowId.FIND, MessageType.INFO, XmlStringUtil.escapeString(message), IconLoader.getIcon("/actions/find.png"), null); } else { List<String> titles = new ArrayList<String>(notFoundActions.size() + 1); titles.add(UsageViewBundle.message("dialog.button.ok")); for (Action action : notFoundActions) { Object value = action.getValue(FindUsagesProcessPresentation.NAME_WITH_MNEMONIC_KEY); if (value == null) value = action.getValue(Action.NAME); titles.add((String) value); } int option = Messages.showDialog( myProject, message, UsageViewBundle.message("dialog.title.information"), titles.toArray(new String[titles.size()]), 0, Messages.getInformationIcon()); if (option > 0) { notFoundActions .get(option - 1) .actionPerformed(new ActionEvent(this, 0, titles.get(option))); } } } }, ModalityState.NON_MODAL, myProject.getDisposed()); } else if (usageCount == 1 && !myProcessPresentation.isShowPanelIfOnlyOneUsage()) { SwingUtilities.invokeLater( new Runnable() { public void run() { Usage usage = myFirstUsage.get(); if (usage.canNavigate()) { usage.navigate(true); flashUsageScriptaculously(usage); } } }); } else { final UsageViewImpl usageView = myUsageViewRef.get(); if (usageView != null) usageView.setSearchInProgress(false); } if (myListener != null) { myListener.findingUsagesFinished(myUsageViewRef.get()); } }