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 30209 - Automatically add generated mnemonics for large submenus without them
Summary: Automatically add generated mnemonics for large submenus without them
Status: REOPENED
Alias: None
Product: platform
Classification: Unclassified
Component: Actions (show other bugs)
Version: 3.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jan Peska
URL:
Keywords: A11Y, API, UI
: 136749 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-01-17 17:31 UTC by Jesse Glick
Modified: 2013-08-31 00:01 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Suggested patch (3.47 KB, patch)
2003-01-17 17:31 UTC, Jesse Glick
Details | Diff
Corrected patch (3.57 KB, patch)
2003-01-17 19:26 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2003-01-17 17:31:20 UTC
The patch refines the behavior of Actions.SubMenu
a bit. If it has >=5 items, and none of them
define a specific mnemonic, it generates them
automatically:

_1_ First item
_2_ Second item
etc.

No API change necessary. Helpful for large
sublists. E.g.:

- View | Documentation Indices (when you have many
mounts: try apisupport/apidocs)

- create an XML layer (w/ apisupport), make folder
Menu/Foo, select Foo, right-click and choose
Install... (lets you pick existing menus to
install between)

Maxym: the mnemonics are localizable so they could
be switched for Russian to use Cyrillic rather
than Latin characters. The first ten are digits
anyway.
Comment 1 Jesse Glick 2003-01-17 17:31:56 UTC
Created attachment 8613 [details]
Suggested patch
Comment 2 Jesse Glick 2003-01-17 17:32:53 UTC
Adding A11Y keyword only because it speeds up KB navigability, but
this might not be enough reason.
Comment 3 Jesse Glick 2003-01-17 19:21:57 UTC
Correction to patch: the whole block

if (autoMnemonicIndex >= autoMnemonicText.length()) {
    // Past the end, skip it - but pad text a bit.
    // (Padding is approximate since the font is probably proportional
anyway.)
    label = "   " + label; // NOI18N
} else {
    label = "&" + autoMnemonicText.charAt(autoMnemonicIndex++) + ' ' +
label; // NOI18N
}

should be enclosed in:

if (autoMnemonic) {
    // as before...
}
Comment 4 Jesse Glick 2003-01-17 19:26:03 UTC
Created attachment 8616 [details]
Corrected patch
Comment 5 Jesse Glick 2003-01-17 19:26:36 UTC
Try clicking nbbuild/build.xml and select Run Target... - that gets
mnemonics too.
Comment 6 _ mihmax 2003-01-19 21:56:02 UTC
Jesse, you wanted to know my opinion, you get it:
                       Perfect.
Comment 7 Jesse Glick 2003-01-20 02:29:40 UTC
To Maxym: actually I was CCing you in case you wanted to check whether
a Cyrillic version of MNEM_submenu_items would make sense for
Bundle_ru.properties, or whether it should better use the Latin
accelerator keys. Depends on whether Russian-language users would
typically have a Cyrillic keyboard configuration; I remember you
dealing with this question w.r.t. menu mnemonics.

But thanks for the evaluation too. :-)
Comment 8 David Simonek 2004-03-11 12:35:08 UTC
Hmm, I'm not so sure if this patch is suitable for users. For users it
will seem that mnemonics appear "magically", they will IMO have
troubles to understand conditions under which mnemonics are
automatically generated --> user confusion and feeling "not in control".
Please consider consulting with HIE and/or show me that I'm wrong. Thx.
Comment 9 Jiri Rechtacek 2004-04-23 10:49:55 UTC
Assigned to new owner.
Comment 10 Jaroslav Tulach 2010-10-07 18:21:36 UTC
Jesse, if you want to move this forward, write some test and integrate it yourself.
Comment 11 Jesse Glick 2010-10-07 19:33:07 UTC
Would still be useful in Set Main Project, Open Recent File, Open Recent Project, Project Group, and Javadoc References submenus. But better to activate on demand only, using some kind of utility, e.g.

JMenu menu = new JMenu("Set Main Project");
menu.add(new JMenuItem("&None"));
menu.addSeparator();
for (Project p : ...) {
  Actions.addToLongMenu(menu, new JMenuItem(p.displayName)));
}

where the utility method would append the menu item to the menu; assign it the next available mnemonic in sequence (in this example skipping over 'N' since it is already in use); and in case the menu grows too long to display comfortably, creates a new cascading submenu (mnemonic '.' perhaps) to hold subsequent items, as in the Insert Unicode action, also serving as a possible replacement for hacks like the "More Javadoc..." item under "Javadoc References".
Comment 12 Jesse Glick 2010-10-15 20:43:18 UTC
*** Bug 136749 has been marked as a duplicate of this bug. ***