ActionPopupMenu icons are not displayed?


I created a bunch of actions and added them to my ActionPopupMenu. Everything works fine except icons I created the actions with are not displayed in the popup menu. Is it designed to be this way or is there a way to get them displayed? For example,

DefaultActionGroup group = new DefaultActionGroup();
for (Scenario scenario : scenarios) {
boolean isChecked = currentScenario != null && currentScenario.getName().equals(scenario.getName());
group.add(new AnAction(scenario.getPresentableText(), scenario.getLocationString(), isChecked ? AllIcons.Actions.Checked : null) {
public void actionPerformed(AnActionEvent e) {
//Do something here
final ActionPopupMenu popupMenu =
((ActionManagerImpl) ActionManager.getInstance())
.createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, group, new MenuItemPresentationFactory(true));
//Show menu here

The code above works just fine, the actions are displayed as menu items and selecting them triggers the right actions, but I don't see any icons being displayed.


Comment actions Permalink

Does it work when you pass in false in MenuItemPresentationFactory() ctor?

Comment actions Permalink

Ah, bingo, that was it! Thank you!


Comment actions Permalink

Great, see com.intellij.openapi.actionSystem.impl.MenuItemPresentationFactory#processPresentation condition


Please sign in to leave a comment.