From b634b8a50d078c178f3a0873910a4a0dfb594ec7 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 2 Oct 2014 14:56:45 +0200 Subject: [PATCH] XPath search results textual improvements --- .../intellij/plugins/xpathView/XPathEvalAction.java | 13 ++++++++++--- .../plugins/xpathView/search/FindByXPathAction.java | 9 +++++---- .../plugins/xpathView/search/SearchScope.java | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java index 3d3b8dcc87cc..09f2b71cd3f2 100644 --- a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java +++ b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathEvalAction.java @@ -299,13 +299,20 @@ public class XPathEvalAction extends XPathAction { public static void showUsageView(@NotNull final Project project, MyUsageTarget usageTarget, Factory searcherFactory, final EditExpressionAction editAction) { final UsageViewPresentation presentation = new UsageViewPresentation(); - presentation.setTargetsNodeText("Expression"); + presentation.setTargetsNodeText("XPath Expression"); presentation.setCodeUsages(false); - presentation.setCodeUsagesString("Result"); + presentation.setCodeUsagesString("Found Matches"); presentation.setNonCodeUsagesString("Result"); presentation.setUsagesString("XPath Result"); presentation.setUsagesWord("match"); - presentation.setTabText("XPath"); + final ItemPresentation targetPresentation = usageTarget.getPresentation(); + if (targetPresentation != null) { + presentation + .setTabText(StringUtil.shortenTextWithEllipsis("XPath '" + targetPresentation.getPresentableText() + '\'', 60, 0, true)); + } + else { + presentation.setTabText("XPath"); + } presentation.setScopeText("XML Files"); presentation.setOpenInNewTab(XPathAppComponent.getInstance().getConfig().OPEN_NEW_TAB); diff --git a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/FindByXPathAction.java b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/FindByXPathAction.java index 6384e04f1f99..68e2dca7aec8 100644 --- a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/FindByXPathAction.java +++ b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/FindByXPathAction.java @@ -25,6 +25,7 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Factory; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.usages.*; import org.intellij.plugins.xpathView.Config; import org.intellij.plugins.xpathView.XPathAppComponent; @@ -78,13 +79,13 @@ public class FindByXPathAction extends AnAction { } final UsageViewPresentation presentation = new UsageViewPresentation(); - presentation.setTargetsNodeText(settings.MATCH_RECURSIVELY ? "Pattern" : "Expression"); + presentation.setTargetsNodeText(settings.MATCH_RECURSIVELY ? "XPath Pattern" : "XPath Expression"); presentation.setCodeUsages(false); - presentation.setCodeUsagesString("Result"); + presentation.setCodeUsagesString("Found Matches in " + scope.getName()); presentation.setNonCodeUsagesString("Result"); - presentation.setUsagesString("XPath Result"); + presentation.setUsagesString("results matching '" + expression + '\''); presentation.setUsagesWord("match"); - presentation.setTabText("XPath"); + presentation.setTabText(StringUtil.shortenTextWithEllipsis("XPath '" + expression + '\'', 60, 0, true)); presentation.setScopeText(scope.getName()); presentation.setOpenInNewTab(settings.OPEN_NEW_TAB); diff --git a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/SearchScope.java b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/SearchScope.java index 3f65cedd1641..46b484a239d7 100644 --- a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/SearchScope.java +++ b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/search/SearchScope.java @@ -92,7 +92,7 @@ public final class SearchScope { case DIRECTORY: return "Directory '" + getPath() + "'"; case CUSTOM: - return "Scope '" + getScopeName() + "'"; + return getScopeName(); } assert false; return null;