test discovery: don't show filtering actions in pinned mode

This commit is contained in:
Dmitry Batkovich
2018-05-14 15:11:58 +03:00
parent 96f8a35b81
commit 91bed9ee8c
2 changed files with 13 additions and 6 deletions
@@ -175,7 +175,13 @@ public class ShowDiscoveredTestsAction extends AnAction {
ActiveComponent runButton = createButton(RUN_ALL_ACTION_TEXT, AllIcons.Actions.Execute, () -> runAllDiscoveredTests(project, tree, ref, context, initTitle));
Runnable pinActionListener = () -> {
UsageView view = FindUtil.showInUsageView(null, tree.getTestMethods(), param -> new TestMethodUsage(param), initTitle, project);
UsageView view = FindUtil.showInUsageView(null, tree.getTestMethods(), param -> new TestMethodUsage(param), initTitle, p -> {
p.setCodeUsages(false); // don't show r/w, imports filtering actions
p.setUsagesWord("test");
p.setMergeDupLinesAvailable(false);
p.setUsageTypeFilteringAvailable(false);
p.setExcludeAvailable(false);
}, project);
if (view != null) {
view.addButtonToLowerPane(new AbstractAction(RUN_ALL_ACTION_TEXT, AllIcons.Actions.Execute) {
@Override
@@ -183,10 +189,6 @@ public class ShowDiscoveredTestsAction extends AnAction {
runAllDiscoveredTests(project, tree, ref, context, initTitle);
}
});
view.getPresentation().setUsagesWord("test");
view.getPresentation().setMergeDupLinesAvailable(false);
view.getPresentation().setUsageTypeFilteringAvailable(false);
view.getPresentation().setExcludeAvailable(false);
}
JBPopup popup = ref.get();
if (popup != null) {
@@ -62,6 +62,7 @@ import com.intellij.ui.LightweightHint;
import com.intellij.usageView.UsageInfo;
import com.intellij.usages.*;
import com.intellij.usages.impl.UsageViewImpl;
import com.intellij.util.Consumer;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
@@ -909,12 +910,16 @@ public class FindUtil {
@NotNull T[] targets,
@NotNull Function<? super T, ? extends Usage> usageConverter,
@NotNull String title,
@Nullable Consumer<? super UsageViewPresentation> presentationSetup,
@NotNull final Project project) {
if (targets.length == 0) return null;
final UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setCodeUsagesString(title);
presentation.setTabName(title);
presentation.setTabText(title);
if (presentationSetup != null) {
presentationSetup.consume(presentation);
}
UsageTarget[] usageTargets = sourceElement == null ? UsageTarget.EMPTY_ARRAY : new UsageTarget[]{new PsiElement2UsageTargetAdapter(sourceElement)};
UsageView view = UsageViewManager.getInstance(project).showUsages(usageTargets, Usage.EMPTY_ARRAY, presentation);
@@ -953,7 +958,7 @@ public class FindUtil {
return showInUsageView(sourceElement, pointers, p -> {
PsiElement element = p.getElement();
return element == null ? null : UsageInfoToUsageConverter.convert(primary, new UsageInfo(element));
}, title, project);
}, title, null, project);
}
/**