It's been a long time since I worked on the code involved, so my recollection may be a little fuzzy, but this may help point you in a direction or two:
There is a general problem that NetBeans supports, or at least used to support, both single window pseudo-SDI mode and a multiple windows mode. And keyboard shortcuts propagate down to the InputMap/KeyMap of the window in question. My recollection is that this was originally handled with an AWTEventListener, because that was the one way to guarantee shortcuts worked globally, no matter the windowing layout. I *think* we migrated that to something using InputMap/KeyMap around 2003 or so, but there may still be workarounds to ensure things work globally. What I'd suggest to try is an experiment - create a dialog with the dialogs API and try binding a key you know is bound as a global shortcut. Use InputMap/KeyMap and attach it to, most likely, the root pane of the dialog. If it works, then it's just a matter of implementing shortcuts in the right places (make sure to call consume() on the event to stop it propagating further). If it doesn't, then some more fundamental work that's likely to touch how key bindings work globally may be needed. Also bear in mind that key bindings are different for different platforms - on Mac OS, the alt key is a compose key for international characters and cannot have shortcuts bound to it (ctrl is used instead), and some keybindings are mapped to different keys for consistency with other Mac OS apps (there's a syntax for defining keybindings in OS-neutral ways, for declarative bindings). HTH, Tim On Mon, Feb 26, 2018 at 9:11 AM, cowwoc <[email protected]> wrote: > Hi, > > Netbeans has an extremely long (and getting longer) list of keyboard > shortcuts. Part of the problem is that (for the most part) keyboard > shortcuts are not context-sensitive nor are they able to be > context-sensitive. I'll give you a simple example I raised a few years back: > > When the editor Find & Replace dialog is focused, we have "Replace" and > "Replace All" buttons. It would be nice if we could map ALT+A to "Replace > All" as many other applications do. Unfortunately, ALT+A is already mapped > to the Refactor pulldown menu. The platform API does not allow mapping the > same keyboard accelerator to different UI actions depending on the context. > As a result, we end up with akward combinations like ALT+P for Replace All. > > Please see https://netbeans.org/bugzilla/show_bug.cgi?id=222843 for > additional context. > > Is anyone else interested in this issue? Is anyone interested in working > on it? > > Thank you, > Gili > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > For further information about the NetBeans mailing lists, visit: > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > > > > -- http://timboudreau.com
