void (@NotNull final Project project, final Module module) { final Config settings = XPathAppComponent.getInstance().getConfig(); final XPathProjectComponent projectComponent = XPathProjectComponent.getInstance(project); final FindByExpressionDialog dlg = new FindByExpressionDialog(project, settings, projectComponent.getFindHistory(), module); if (!dlg.show(null)) { return; } final SearchScope scope = dlg.getScope(); settings.MATCH_RECURSIVELY = dlg.isMatchRecursively(); settings.SEARCH_SCOPE = dlg.getScope(); final InputExpressionDialog.Context context = dlg.getContext(); projectComponent.addFindHistory(context.input); final String expression = context.input.expression; if (!validateExpression(project, expression)) { return; } final UsageViewPresentation presentation = new UsageViewPresentation(); presentation.setTargetsNodeText(settings.MATCH_RECURSIVELY ? XPathBundle.message("list.item.xpath.pattern") : XPathBundle.message("list.item.xpath.expression")); presentation.setCodeUsages(false); presentation.setCodeUsagesString(XPathBundle.message("list.item.found.matches.in", scope.getName())); presentation.setNonCodeUsagesString(XPathBundle.message("list.item.result")); presentation.setUsagesString(XPathBundle.message("results.matching.0", expression)); presentation.setTabText(StringUtil.shortenTextWithEllipsis(XPathBundle.message("tab.title.xpath", expression), 60, 0, true)); presentation.setScopeText(scope.getName()); presentation.setOpenInNewTab(FindSettings.getInstance().isShowResultsInSeparateView()); final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation); processPresentation.setShowPanelIfOnlyOneUsage(true); processPresentation.setShowNotFoundMessage(true); final XPathEvalAction.MyUsageTarget usageTarget = new XPathEvalAction.MyUsageTarget(context.input.expression, null); final UsageTarget[] usageTargets = new UsageTarget[]{ usageTarget }; final Factory<UsageSearcher> searcherFactory = () -> new XPathUsageSearcher(project, context.input, scope, settings.MATCH_RECURSIVELY); final UsageViewManager.UsageViewStateListener stateListener = new UsageViewManager.UsageViewStateListener() { @Override public void usageViewCreated(@NotNull UsageView usageView) { usageView.addButtonToLowerPane(new MyEditExpressionAction(project, module), XPathBundle.message("button.edit.expression.with.mnemonic")); } @Override public void findingUsagesFinished(UsageView usageView) { } }; UsageViewManager.getInstance(project).searchAndShowUsages( usageTargets, searcherFactory, processPresentation, presentation, stateListener); }