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.

Bug 208081 - Node's Action Popup Menu does never show icon
Summary: Node's Action Popup Menu does never show icon
Status: REOPENED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 7.1
Hardware: PC Windows 7
: P3 normal with 3 votes (vote)
Assignee: Jan Peska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 10:57 UTC by anchialos
Modified: 2018-04-04 20:36 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
patch / tests / changes to arch.xml (9.10 KB, patch)
2012-06-21 01:37 UTC, ramis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description anchialos 2012-02-06 10:57:43 UTC
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!
Comment 1 Jaroslav Tulach 2012-02-09 10:24:49 UTC
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
Comment 2 Geertjan Wielenga 2012-02-09 10:38:58 UTC
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?
Comment 3 Jaroslav Tulach 2012-02-09 17:39:56 UTC
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.
Comment 4 Jaroslav Tulach 2012-02-24 15:25:12 UTC
I am still waiting for the patch.
Comment 5 Jaroslav Tulach 2012-03-05 09:28:50 UTC
I am still waiting. Meanwhile closing as won'tfix to get this out of my bug statistic. Reopen when the patch is ready.
Comment 6 ramis 2012-06-09 10:24:47 UTC
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.
Comment 7 Jaroslav Tulach 2012-06-14 11:55:26 UTC
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.
Comment 8 ramis 2012-06-21 01:37:00 UTC
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?
Comment 9 ramis 2012-06-21 02:03:17 UTC
I forget to mention, the testTooltipsContainAccelerator test failed already before the patch