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.

View | Details | Raw Unified | Return to bug 30209
Collapse All | Expand All

(-)openide/src/org/openide/awt/Actions.java (-1 / +25 lines)
Lines 26-31 Link Here
26
import org.openide.util.Mutex;
26
import org.openide.util.Mutex;
27
import org.openide.util.actions.*;
27
import org.openide.util.actions.*;
28
import org.openide.util.HelpCtx;
28
import org.openide.util.HelpCtx;
29
import org.openide.util.NbBundle;
29
30
30
/** Supporting class for manipulation with menu and toolbar presenters.
31
/** Supporting class for manipulation with menu and toolbar presenters.
31
*
32
*
Lines 721-728 Link Here
721
                    HelpCtx help = model.getHelpCtx (0);
722
                    HelpCtx help = model.getHelpCtx (0);
722
                    associateHelp (menu, help == null ? findHelp (action) : help);
723
                    associateHelp (menu, help == null ? findHelp (action) : help);
723
                } else {
724
                } else {
724
                    boolean addSeparator = false;
725
                    int count = model.getCount();
725
                    int count = model.getCount();
726
                    // For submenus with 5 or more items, if there are no existing mnemonics,
727
                    // automatically add some (numbered, lettered, etc.).
728
                    boolean autoMnemonic = (count > 4);
729
                    if (autoMnemonic) {
730
                        for (int i = 0; i < count; i++) {
731
                            String label = model.getLabel(i);
732
                            if (label != null && label.indexOf('&') != -1) { // NOI18N
733
                                autoMnemonic = false;
734
                                break;
735
                            }
736
                        }
737
                    }
738
                    String autoMnemonicText = autoMnemonic ? NbBundle.getMessage(Actions.class, "MNEM_submenu_items") : null;
739
                    int autoMnemonicIndex = 0;
740
                    boolean addSeparator = false;
726
                    for (int i = 0; i < count; i++) {
741
                    for (int i = 0; i < count; i++) {
727
                        String label = model.getLabel(i);
742
                        String label = model.getLabel(i);
728
                        //          MenuShortcut shortcut = support.getMenuShortcut(i);
743
                        //          MenuShortcut shortcut = support.getMenuShortcut(i);
Lines 732-737 Link Here
732
                            if(addSeparator) {
747
                            if(addSeparator) {
733
                                menu.addSeparator();
748
                                menu.addSeparator();
734
                                addSeparator = false;
749
                                addSeparator = false;
750
                            }
751
                            if (autoMnemonic) {
752
                                if (autoMnemonicIndex >= autoMnemonicText.length()) {
753
                                    // Past the end, skip it - but pad text a bit.
754
                                    // (Padding is approximate since the font is probably proportional anyway.)
755
                                    label = "   " + label; // NOI18N
756
                                } else {
757
                                    label = "&" + autoMnemonicText.charAt(autoMnemonicIndex++) + ' ' + label; // NOI18N
758
                                }
735
                            }
759
                            }
736
                            //       if (shortcut == null)
760
                            //       if (shortcut == null)
737
                            // (Dafe) changed to support mnemonics in item labels
761
                            // (Dafe) changed to support mnemonics in item labels
(-)openide/src/org/openide/awt/Bundle.properties (+5 lines)
Lines 60-62 Link Here
60
60
61
# SwingBrowserImpl
61
# SwingBrowserImpl
62
ACS_SwingBrowserImpl_SwingBrowser=N/A
62
ACS_SwingBrowserImpl_SwingBrowser=N/A
63
64
# Actions
65
# Might be localized e.g. in Russian to use Cyrillic keys, if desired.
66
# Should be a list of single-char mnemonics (usually alphanumerics):
67
MNEM_submenu_items=1234567890abcdefghijklmnopqrstuvwxyz

Return to bug 30209