Bug 208081 - Node's Action Popup Menu does never show icon
Node's Action Popup Menu does never show icon
Status: REOPENED
Product: platform
Classification: Unclassified
Component: Nodes
7.1
PC Windows 7
: P3 (vote)
: 7.1
Assigned To: Jan Peska
issues@platform
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-06 10:57 UTC by anchialos
Modified: 2014-03-17 17:32 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
:


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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo