From 94b60ae68a3b858f378208ec2bcefc297c3bb584 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Wed, 13 Apr 2016 10:18:57 +0300 Subject: [PATCH] inspection tool window: use compact action group --- .../codeInspection/ui/QuickFixPreviewDecorator.java | 2 +- .../ui/actions/InspectionViewActionBase.java | 11 +---------- .../ui/actions/SuppressActionWrapper.java | 7 +------ platform/platform-resources/src/idea/LangActions.xml | 2 +- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewDecorator.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewDecorator.java index b576d4c848a1..72ec034701a2 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewDecorator.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewDecorator.java @@ -154,7 +154,7 @@ public class QuickFixPreviewDecorator extends JPanel implements InspectionTreeLo @NotNull @Override protected DefaultActionGroup createPopupActionGroup(JComponent button) { - DefaultActionGroup group = new DefaultActionGroup(); + DefaultActionGroup group = new DefaultCompactActionGroup(); group.addAll(suppressors); return group; } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InspectionViewActionBase.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InspectionViewActionBase.java index 6139b7f5219d..d95cb42c2414 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InspectionViewActionBase.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/InspectionViewActionBase.java @@ -41,22 +41,13 @@ public abstract class InspectionViewActionBase extends AnAction { final InspectionResultsView view = getView(e); final boolean enabled = view != null && isEnabled(view); final Presentation presentation = e.getPresentation(); - if (hideIfDisabled()) { - presentation.setEnabledAndVisible(enabled); - } - else { - presentation.setEnabled(enabled); - } + presentation.setEnabled(enabled); } protected boolean isEnabled(@NotNull InspectionResultsView view) { return true; } - protected boolean hideIfDisabled() { - return false; - } - public static InspectionResultsView getView(@Nullable AnActionEvent event) { if (event == null) { return null; diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/SuppressActionWrapper.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/SuppressActionWrapper.java index d8cb876136d0..576bab57e023 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/SuppressActionWrapper.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/SuppressActionWrapper.java @@ -56,7 +56,7 @@ import java.util.Set; import static com.intellij.codeInspection.ui.actions.InspectionViewActionBase.getView; -public class SuppressActionWrapper extends ActionGroup { +public class SuppressActionWrapper extends ActionGroup implements CompactActionGroup { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.actions.SuppressActionWrapper"); public SuppressActionWrapper() { @@ -209,11 +209,6 @@ public class SuppressActionWrapper extends ActionGroup { return false; } - @Override - protected boolean hideIfDisabled() { - return true; - } - public boolean isSuppressAll() { return mySuppressAction.isSuppressAll(); } diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml index 22172ed32733..e71eeef5de21 100644 --- a/platform/platform-resources/src/idea/LangActions.xml +++ b/platform/platform-resources/src/idea/LangActions.xml @@ -994,7 +994,7 @@ > - +