This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The node's action context popup menu does not display icons. The involved DefaultAWTBridge#createPopupPresenter(Action) is creating the popup menu items by new Actions.MenuItem(action, false); and its constructor is calling Actions.connect(this, aAction, true); The subsequent call to Actions$MenuBridge#updateState(String) will not invoke updateButtonIcon() since popup == true. There is Workaround (implementing an own ActionPresenterProvider with patched createPopupPresenter(Action) implementation) but I think this should be fixed in the NB classes!
Imho you can use the branding as available in 7.1: http://bits.netbeans.org/dev/javadoc/org-openide-awt/architecture-summary.html#property-USE_MNEMONICS The description of the API was miscategorized, so I fixed that in core-main#85ed663a706d Also I added link to the API from Actions javadoc: core-main#1ce19028a675
Here's my blog entry on this: http://blogs.oracle.com/geertjan/entry/binding_mnemonics_to_node_actions But I didn't know this had anything to do with icons. Why/how should it have anything to do with icons?
I see. This has obviously nothing to do with icons, only mnemonics. I am not sure what I was thinking about! > There is Workaround (implementing an own ActionPresenterProvider with patched > createPopupPresenter(Action) implementation) but I think this should be fixed > in the NB classes! Sure, in such case a patch donation is welcomed.
I am still waiting for the patch.
I am still waiting. Meanwhile closing as won'tfix to get this out of my bug statistic. Reopen when the patch is ready.
org.openide.awt.Actions$MenuBridge.updateState(String) contains the code: if (!popup) { if ((changedProperty == null) || changedProperty.equals(SystemAction.PROP_ICON) || changedProperty.equals(Action.SMALL_ICON) || changedProperty.equals("iconBase")) { // NOI18N updateButtonIcon(); } } This generally disables icons in context popup menus. An easy fix that doesn't change the old behavior but allows users to globally switch to context popup menus with icons would be to introduce a boolean system property 'hideIconInPopup=true' and change if (!popup) { to if (!(popup && hideIconInPopup)) { On the other hand popular programs like Windows Explorer or OpenOffice also use icons in context menus, so this behavior is quite common. So simply removing the first if statement might also be an option.
I'd rather use the branding approach, similar to http://bits.netbeans.org/dev/javadoc/org-openide-awt/architecture-summary.html#property-USE_MNEMONICS I am still waiting for real patch, with test, and changes to arch.xml file.
Created attachment 121131 [details] patch / tests / changes to arch.xml Here is the patch using the branding approach - I made everything similar to the mnemonics stuff you mentioned. Some notes: - I did not change the Api changes document - I added this feature with stability "stable", since I couldn't imagine anything being changed (if this patch is applied). Is that correct? Is there an easy way to provide branding for NetBeans IDE without building it?
I forget to mention, the testTooltipsContainAccelerator test failed already before the patch
https://benkiew.wordpress.com/2012/12/28/netbeans-how-to-create-a-context-aware-action-with-an-icon-for-the-context-menu/ has a work around for this issue