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)); } } } }
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(); setIcon(icon); if (myPresentation.getDisabledIcon() != null) { setDisabledIcon(myPresentation.getDisabledIcon()); } else { setDisabledIcon(IconLoader.getDisabledIcon(icon)); } } } }
@Override public void setUI(final MenuItemUI ui) { final MenuItemUI newUi = UIUtil.isUnderGTKLookAndFeel() && GtkMenuItemUI.isUiAcceptable(ui) ? new GtkMenuItemUI(ui) : ui; super.setUI(newUi); }