mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
When "display icons in menu items" == false then no checks shown in inspections filter fixed. Part of IDEA-130323
This commit is contained in:
+52
-52
@@ -56,11 +56,11 @@ public class ActionMenuItem extends JCheckBoxMenuItem {
|
||||
private final Presentation myPresentation;
|
||||
private final String myPlace;
|
||||
private final boolean myInsideCheckedGroup;
|
||||
private final boolean myEnableMnemonics;
|
||||
private final boolean myToggleable;
|
||||
private DataContext myContext;
|
||||
private AnActionEvent myEvent;
|
||||
private MenuItemSynchronizer myMenuItemSynchronizer;
|
||||
private final boolean myEnableMnemonics;
|
||||
private final boolean myToggleable;
|
||||
private boolean myToggled;
|
||||
|
||||
public ActionMenuItem(final AnAction action,
|
||||
@@ -92,6 +92,10 @@ public class ActionMenuItem extends JCheckBoxMenuItem {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEnterKeyStroke(KeyStroke keyStroke) {
|
||||
return keyStroke.getKeyCode() == KeyEvent.VK_ENTER && keyStroke.getModifiers() == 0;
|
||||
}
|
||||
|
||||
public void prepare() {
|
||||
init();
|
||||
installSynchronizer();
|
||||
@@ -170,10 +174,6 @@ public class ActionMenuItem extends JCheckBoxMenuItem {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEnterKeyStroke(KeyStroke keyStroke) {
|
||||
return keyStroke.getKeyCode() == KeyEvent.VK_ENTER && keyStroke.getModifiers() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
if (UIUtil.isStandardMenuLAF()) {
|
||||
@@ -208,6 +208,52 @@ public class ActionMenuItem extends JCheckBoxMenuItem {
|
||||
myEvent = new AnActionEvent(null, context, myPlace, myPresentation, ActionManager.getInstance(), 0);
|
||||
}
|
||||
|
||||
private void updateIcon(AnAction action) {
|
||||
if (isToggleable() && (myPresentation.getIcon() == null || myInsideCheckedGroup || !UISettings.getInstance().SHOW_ICONS_IN_MENUS)) {
|
||||
action.update(myEvent);
|
||||
myToggled = Boolean.TRUE.equals(myEvent.getPresentation().getClientProperty(Toggleable.SELECTED_PROPERTY));
|
||||
if (ActionPlaces.MAIN_MENU.equals(myPlace) && SystemInfo.isMacSystemMenu ||
|
||||
UIUtil.isUnderNimbusLookAndFeel() ||
|
||||
UIUtil.isUnderWindowsLookAndFeel() && SystemInfo.isWin7OrNewer) {
|
||||
setState(myToggled);
|
||||
}
|
||||
else if (!(getUI() instanceof GtkMenuItemUI)) {
|
||||
if (myToggled) {
|
||||
setIcon(ourCheckedIcon);
|
||||
setDisabledIcon(IconLoader.getDisabledIcon(ourCheckedIcon));
|
||||
}
|
||||
else {
|
||||
setIcon(ourUncheckedIcon);
|
||||
setDisabledIcon(IconLoader.getDisabledIcon(ourUncheckedIcon));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (UISettings.getInstance().SHOW_ICONS_IN_MENUS) {
|
||||
Icon icon = myPresentation.getIcon();
|
||||
if (action instanceof ToggleAction && ((ToggleAction)action).isSelected(myEvent)) {
|
||||
icon = new PoppedIcon(icon, 16, 16);
|
||||
}
|
||||
setIcon(icon);
|
||||
if (myPresentation.getDisabledIcon() != null) {
|
||||
setDisabledIcon(myPresentation.getDisabledIcon());
|
||||
}
|
||||
else {
|
||||
setDisabledIcon(IconLoader.getDisabledIcon(icon));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isToggleable() {
|
||||
return myToggleable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return myToggled;
|
||||
}
|
||||
|
||||
private final class ActionTransmitter implements ActionListener {
|
||||
/**
|
||||
* @param component component
|
||||
@@ -274,52 +320,6 @@ public class ActionMenuItem extends JCheckBoxMenuItem {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateIcon(AnAction action) {
|
||||
if (isToggleable() && (myPresentation.getIcon() == null || myInsideCheckedGroup)) {
|
||||
action.update(myEvent);
|
||||
myToggled = Boolean.TRUE.equals(myEvent.getPresentation().getClientProperty(Toggleable.SELECTED_PROPERTY));
|
||||
if (ActionPlaces.MAIN_MENU.equals(myPlace) && SystemInfo.isMacSystemMenu ||
|
||||
UIUtil.isUnderNimbusLookAndFeel() ||
|
||||
UIUtil.isUnderWindowsLookAndFeel() && SystemInfo.isWin7OrNewer) {
|
||||
setState(myToggled);
|
||||
}
|
||||
else if (!(getUI() instanceof GtkMenuItemUI)) {
|
||||
if (myToggled) {
|
||||
setIcon(ourCheckedIcon);
|
||||
setDisabledIcon(IconLoader.getDisabledIcon(ourCheckedIcon));
|
||||
}
|
||||
else {
|
||||
setIcon(ourUncheckedIcon);
|
||||
setDisabledIcon(IconLoader.getDisabledIcon(ourUncheckedIcon));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (UISettings.getInstance().SHOW_ICONS_IN_MENUS) {
|
||||
Icon icon = myPresentation.getIcon();
|
||||
if (action instanceof ToggleAction && ((ToggleAction)action).isSelected(myEvent)) {
|
||||
icon = new PoppedIcon(icon, 16, 16);
|
||||
}
|
||||
setIcon(icon);
|
||||
if (myPresentation.getDisabledIcon() != null) {
|
||||
setDisabledIcon(myPresentation.getDisabledIcon());
|
||||
}
|
||||
else {
|
||||
setDisabledIcon(IconLoader.getDisabledIcon(icon));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isToggleable() {
|
||||
return myToggleable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return myToggled;
|
||||
}
|
||||
|
||||
private final class MenuItemSynchronizer implements PropertyChangeListener, Disposable {
|
||||
@NonNls private static final String SELECTED = "selected";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user