// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ui.popup;
+import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.impl.MenuItemPresentationFactory;
import com.intellij.openapi.actionSystem.impl.PresentationFactory;
}
private void appendActionsFromGroup(@NotNull ActionGroup actionGroup) {
+ boolean multiChoicePopup = actionGroup.getTemplatePresentation().isMultipleChoice() ||
+ actionGroup.getTemplatePresentation().getIcon() == AllIcons.Actions.GroupBy ||
+ actionGroup.getTemplatePresentation().getIcon() == AllIcons.Actions.Show;
List<AnAction> newVisibleActions = Utils.expandActionGroup(
actionGroup, myPresentationFactory, myDataContext, myActionPlace);
List<AnAction> filtered = myShowDisabled ? newVisibleActions : ContainerUtil.filter(
mySeparatorText = ((Separator)action).getText();
}
else {
- appendAction(action);
+ Presentation presentation = myPresentationFactory.getPresentation(action);
+ if (multiChoicePopup && action instanceof Toggleable) {
+ presentation.setMultipleChoice(true);
+ }
+ appendAction(action, presentation);
}
}
}
- private void appendAction(@NotNull AnAction action) {
- Presentation presentation = myPresentationFactory.getPresentation(action);
+ private void appendAction(@NotNull AnAction action, @NotNull Presentation presentation) {
Character mnemonic = null;
if (myShowNumbers) {
if (myCurrentNumber < 9) {
myIsEnabled = presentation.isEnabled();
myIsPerformGroup = myAction instanceof ActionGroup && presentation.isPerformGroup();
myIsSubstepSuppressed = myAction instanceof ActionGroup && Utils.isSubmenuSuppressed(presentation);
- myIsKeepPopupOpen = myAction instanceof KeepingPopupOpenAction || presentation.isMultipleChoice();
+ myIsKeepPopupOpen = myIsKeepPopupOpen || myAction instanceof KeepingPopupOpenAction || presentation.isMultipleChoice();
Couple<Icon> icons = ActionStepBuilder.calcRawIcons(myAction, presentation);
Icon icon = icons.first;
group.getTemplatePresentation().setIcon(AllIcons.Actions.GroupBy);
group.getTemplatePresentation().setText(UsageViewBundle.messagePointer("action.group.by.title"));
group.getTemplatePresentation().setDescription(UsageViewBundle.messagePointer("action.group.by.title"));
- group.getTemplatePresentation().setMultipleChoice(true);
AnAction[] groupingActions = createGroupingActions();
- for (AnAction a : groupingActions) {
- a.getTemplatePresentation().setMultipleChoice(true);
- }
if (groupingActions.length > 0) {
group.add(new Separator(UsageViewBundle.message("action.group.by.title")));
group.addAll(groupingActions);