diff -r 7b229a1a40d0 core.windows/src/org/netbeans/core/windows/actions/ActionUtils.java --- a/core.windows/src/org/netbeans/core/windows/actions/ActionUtils.java Tue Jun 07 08:44:55 2011 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/ActionUtils.java Tue Jun 07 10:59:57 2011 +0200 @@ -57,6 +57,7 @@ import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.actions.SaveAction; +import org.openide.awt.Actions; import org.openide.cookies.SaveCookie; import org.openide.util.*; import org.openide.util.actions.Presenter; @@ -182,7 +183,8 @@ private JCheckBoxMenuItem getMenuItem() { if (menuItem == null) { - menuItem = new JCheckBoxMenuItem((String)getValue(Action.NAME), state); + menuItem = new JCheckBoxMenuItem("", state); + Actions.setMenuText(menuItem, (String)getValue(Action.NAME), false); //#45940 - hardwiring the shortcut UI since the actual shortcut processignb is also // hardwired in AbstractTabViewDisplayerUI class. // later this should be probably made customizable? diff -r 7b229a1a40d0 core.windows/src/org/netbeans/core/windows/actions/Bundle.properties --- a/core.windows/src/org/netbeans/core/windows/actions/Bundle.properties Tue Jun 07 08:44:55 2011 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/Bundle.properties Tue Jun 07 10:59:57 2011 +0200 @@ -55,23 +55,19 @@ CTL_UndockWindowAction_Dock=Doc&k Window # ActionUtils.CloseAllDocumentsAction -LBL_CloseAllDocumentsAction=Close All Documents +LBL_CloseAllDocumentsAction=Close &All Documents # ActionUtils.AutoHideWindowAction -LBL_AutoHideWindowAction=Minimize Window -# ActionUtils.CloseWindowAction -LBL_CloseWindowAction=Close Window -# ActionUtils.CloseAllButThisAction -LBL_CloseAllButThisAction=Close Other Documents +LBL_AutoHideWindowAction=M&inimize Window # ActionUtils.SaveDocumentAction -LBL_SaveDocumentAction=Save Document +LBL_SaveDocumentAction=&Save Document # ActionUtils.CloneDocumentAction -LBL_CloneDocumentAction=Clone Document +LBL_CloneDocumentAction=C&lone Document # CloseAllButThisAction CTL_CloseAllButThisAction=Close Other Docu&ments # MaximizeWindowAction CTL_MaximizeWindowAction=Maximi&ze Window -CTL_UnmaximizeWindowAction=Restore Window +CTL_UnmaximizeWindowAction=&Restore Window # DocumentsAction CTL_DocumentsAction=&Documents... @@ -90,7 +86,7 @@ CTL_ResetWindows=Reset &Windows CTL_ReloadWindows=Reload Windows -LBL_ToggleWindowTransparencyAction=Transparent Window +LBL_ToggleWindowTransparencyAction=&Transparent Window LBL_WindowTransparencyHint=Press and hold [Ctrl+NumPad 0] key to make minimized window transparent. # Properties diff -r 7b229a1a40d0 core.windows/src/org/netbeans/core/windows/actions/CloseAllButThisAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/CloseAllButThisAction.java Tue Jun 07 08:44:55 2011 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/CloseAllButThisAction.java Tue Jun 07 10:59:57 2011 +0200 @@ -89,8 +89,8 @@ this.isContext = isContext; //Include the name in the label for the popup menu - it may be clicked over //a component that is not selected - putValue(Action.NAME, NbBundle.getMessage(ActionUtils.class, - "LBL_CloseAllButThisAction")); //NOI18N + putValue(Action.NAME, NbBundle.getMessage(CloseAllButThisAction.class, + "CTL_CloseAllButThisAction")); //NOI18N } diff -r 7b229a1a40d0 core.windows/src/org/netbeans/core/windows/actions/CloseWindowAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/CloseWindowAction.java Tue Jun 07 08:44:55 2011 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/CloseWindowAction.java Tue Jun 07 10:59:57 2011 +0200 @@ -86,8 +86,7 @@ tc = topcomp; //Include the name in the label for the popup menu - it may be clicked over //a component that is not selected - putValue(Action.NAME, NbBundle.getMessage(ActionUtils.class, - "LBL_CloseWindowAction")); //NOI18N + putValue(Action.NAME, NbBundle.getMessage(CloseWindowAction.class, "CTL_CloseWindowAction")); //NOI18N if( WindowManagerImpl.getInstance().isEditorTopComponent(tc) ) { setEnabled(Switches.isEditorTopComponentClosingEnabled() && Switches.isClosingEnabled(tc)); } else { diff -r 7b229a1a40d0 core.windows/src/org/netbeans/core/windows/actions/MaximizeWindowAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/MaximizeWindowAction.java Tue Jun 07 08:44:55 2011 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/MaximizeWindowAction.java Tue Jun 07 10:59:57 2011 +0200 @@ -171,7 +171,7 @@ ModeImpl activeMode = (ModeImpl)wm.findMode(active); if (activeMode == null || !Switches.isTopComponentMaximizationEnabled() || !Switches.isMaximizationEnabled(active)) { String label = NbBundle.getMessage(MaximizeWindowAction.class, "CTL_MaximizeWindowAction"); //NOI18N - putValue(Action.NAME, (isPopup ? Actions.cutAmpersand(label) : label)); + putValue(Action.NAME, label); setEnabled(false); return; } @@ -192,7 +192,7 @@ } else { label = NbBundle.getMessage(MaximizeWindowAction.class, "CTL_UnmaximizeWindowAction"); } - putValue(Action.NAME, (isPopup ? Actions.cutAmpersand(label) : label)); + putValue(Action.NAME, label); setEnabled(activeMode != null /*&& activeMode.getKind() != Constants.MODE_KIND_SLIDING*/); } diff -r 7b229a1a40d0 openide.awt/apichanges.xml --- a/openide.awt/apichanges.xml Tue Jun 07 08:44:55 2011 +0200 +++ b/openide.awt/apichanges.xml Tue Jun 07 10:59:57 2011 +0200 @@ -50,6 +50,22 @@ AWT API + + + Turn on Mnemonics in Popup Menus + + + + + +

+ New branding key for applications built on top of NetBeans + Platform to + turn mnemonics in popup menus on. +

+
+ +
New attributes (popupText, menuText) in @ActionRegistration annotation diff -r 7b229a1a40d0 openide.awt/arch.xml --- a/openide.awt/arch.xml Tue Jun 07 08:44:55 2011 +0200 +++ b/openide.awt/arch.xml Tue Jun 07 10:59:57 2011 +0200 @@ -468,6 +468,16 @@
  • +
  • + + There is a way to enable mnemonics in popup menu items created via + Actions factory methods + in your own application build on top of NetBeans Platform. + Just provide branding for org/openide/awt/Bundle.properties + file and modify USE_MNEMONICS=always. Other possible values + of this key include default, never or always. + +
  • diff -r 7b229a1a40d0 openide.awt/manifest.mf --- a/openide.awt/manifest.mf Tue Jun 07 08:44:55 2011 +0200 +++ b/openide.awt/manifest.mf Tue Jun 07 10:59:57 2011 +0200 @@ -2,5 +2,5 @@ OpenIDE-Module: org.openide.awt OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties AutoUpdate-Essential-Module: true -OpenIDE-Module-Specification-Version: 7.35 +OpenIDE-Module-Specification-Version: 7.37 diff -r 7b229a1a40d0 openide.awt/src/org/openide/awt/Actions.java --- a/openide.awt/src/org/openide/awt/Actions.java Tue Jun 07 08:44:55 2011 +0200 +++ b/openide.awt/src/org/openide/awt/Actions.java Tue Jun 07 10:59:57 2011 +0200 @@ -273,6 +273,14 @@ */ @Deprecated public static void setMenuText(AbstractButton item, String text, boolean useMnemonic) { + String msg = NbBundle.getMessage(Actions.class, "USE_MNEMONICS"); // NOI18N + if ("always".equals(msg)) { // NOI18N + useMnemonic = true; + } else if ("never".equals(msg)) { // NOI18N + useMnemonic = false; + } else { + assert "default".equals(msg); // NOI18N + } if (useMnemonic) { Mnemonics.setLocalizedText(item, text); } else { diff -r 7b229a1a40d0 openide.awt/src/org/openide/awt/Bundle.properties --- a/openide.awt/src/org/openide/awt/Bundle.properties Tue Jun 07 08:44:55 2011 +0200 +++ b/openide.awt/src/org/openide/awt/Bundle.properties Tue Jun 07 10:59:57 2011 +0200 @@ -120,3 +120,7 @@ Print=&Print... View=View Close=Close + + +# either: default, never or always +USE_MNEMONICS=default