You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by cowwoc <co...@bbs.darktech.org> on 2018/02/26 14:11:00 UTC
Platform API: Context-sensitive keyboard accelerators
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: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: AW: Platform API: Context-sensitive keyboard accelerators
Posted by cowwoc <co...@bbs.darktech.org>.
On 2018-03-06 1:22 PM, Neil C Smith wrote:
> Historically maybe, but that would appear to not be an issue, because as I
> said, it now conflicts with Profile, but that doesn't cause problems?
True.
> This no longer appears to be a valid issue (if it ever was) - there are
> lots of context-sensitive mnemonics all over the place. Or do they not
> work reliably cross-platform?
>
> So, surely a PR to change the message for Replace All to move the ampersand
> back in front of the A would be all that's needed?
Filed https://issues.apache.org/jira/browse/NETBEANS-448
Thanks,
Gili
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: AW: Platform API: Context-sensitive keyboard accelerators
Posted by Neil C Smith <ne...@apache.org>.
On Tue, 6 Mar 2018 at 17:58 cowwoc <co...@bbs.darktech.org> wrote:
> The trigger used to be ALT+A. It was changed to ALT+P because of
> conflict with the Refactor pulldown menu.
>
Historically maybe, but that would appear to not be an issue, because as I
said, it now conflicts with Profile, but that doesn't cause problems?
...
On Mon, 26 Feb 2018 at 14:11 cowwoc <co...@bbs.darktech.org> wrote:
> Netbeans has an extremely long (and getting longer) list of keyboard
> shortcuts.
>
But, we're talking mnemonics not shortcuts here.
> The platform API does not
> allow mapping the same keyboard accelerator to different UI actions
> depending on the context.
This no longer appears to be a valid issue (if it ever was) - there are
lots of context-sensitive mnemonics all over the place. Or do they not
work reliably cross-platform?
So, surely a PR to change the message for Replace All to move the ampersand
back in front of the A would be all that's needed?
Of course, if Jaroslav let me get
https://issues.apache.org/jira/browse/NETBEANS-427 in, you could write a
plugin to customize them! ;-)
Best wishes,
Neil
--
Neil C Smith
Artist & Technologist
www.neilcsmith.net
Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Re: AW: Platform API: Context-sensitive keyboard accelerators
Posted by cowwoc <co...@bbs.darktech.org>.
The trigger used to be ALT+A. It was changed to ALT+P because of
conflict with the Refactor pulldown menu. See
https://netbeans.org/bugzilla/show_bug.cgi?id=222400 for the historical
discussion.
Gili
On 2018-03-06 6:46 AM, Neil C Smith wrote:
> On Tue, 27 Feb 2018 at 19:44 cowwoc <co...@bbs.darktech.org> wrote:
>
>> Unfortunately, I'm not too familiar with the internals. I filed
>> https://issues.apache.org/jira/browse/NETBEANS-432
>>
> I'm confused by that bug - why would Alt-A trigger replace all? The
> underline is on the p. And for me Alt-P works - it doesn't open the
> Profile menu.
>
> ... not sure why it's Alt-P mind you?
>
> Best wishes,
>
> Neil
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: AW: Platform API: Context-sensitive keyboard accelerators
Posted by Neil C Smith <ne...@apache.org>.
On Tue, 27 Feb 2018 at 19:44 cowwoc <co...@bbs.darktech.org> wrote:
> Unfortunately, I'm not too familiar with the internals. I filed
> https://issues.apache.org/jira/browse/NETBEANS-432
>
I'm confused by that bug - why would Alt-A trigger replace all? The
underline is on the p. And for me Alt-P works - it doesn't open the
Profile menu.
... not sure why it's Alt-P mind you?
Best wishes,
Neil
--
Neil C Smith
Artist & Technologist
www.neilcsmith.net
Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Re: AW: Platform API: Context-sensitive keyboard accelerators
Posted by cowwoc <co...@bbs.darktech.org>.
Unfortunately, I'm not too familiar with the internals. I filed
https://issues.apache.org/jira/browse/NETBEANS-432 with a high-level
overview of what a user expects. Hopefully someone who is familiar with
this codebase can flesh out what this entails.
Thank you,
Gili
On 2018-02-27 12:49 PM, Tim Boudreau wrote:
> I'd say file an RFE, but best to get as specific as possible about what
> mechanism needs to be changed and how. I.e. Exactly the desired behavior,
> what blocks it, and where the change would need to be.
>
> -Tim
>
> On Tue, Feb 27, 2018 at 11:00 AM cowwoc <co...@bbs.darktech.org> wrote:
>
>> Is it okay if I file a RFE for this, or do you feel it should stew a bit
>> longer in the mailing list?
>>
>> Gili
>>
>> On 2018-02-26 3:47 PM, Christian Lenz wrote:
>>> I figured out that problem too, but I don’t know whether this is window
>> specific or not.
>>> Sure I think you can add a shortcut to your Code, which is already
>> taken. You got a warning after NetBeans started that says: „there is a
>> duplicate“.
>>> Maybe it overrides it or not, I don’t know atm. But if not and you
>> created an Action, where you can Change the shortcut via KeyMap Options,
>> you sometimes overrides existing ones (Which Shows you a warning or error
>> that another one has the same etc.), but yes they should work context
>> sensitve, and some are still working context sensitive, afaik.
>>> I set ctrl + b to Show the git browser for branches etc. This shortcut
>> only Woks, when I select a Project. If I’m in the Editor, it will set a
>> bookmark or open the bookmark window. So there is smth like a context
>> sensitive way to implement shortcuts but I don’t know the logic at all.
>>> My 2 cents
>>>
>>>
>>> Cheers
>>>
>>> Chris
>>>
>>> Von: Tim Boudreau
>>> Gesendet: Montag, 26. Februar 2018 19:59
>>> An: dev@netbeans.incubator.apache.org
>>> Betreff: Re: Platform API: Context-sensitive keyboard accelerators
>>>
>>> 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 <co...@bbs.darktech.org> 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: dev-unsubscribe@netbeans.incubator.apache.org
>>>> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>>>>
>>>> For further information about the NetBeans mailing lists, visit:
>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>>
>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
>> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>
>>
>> --
> http://timboudreau.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: AW: Platform API: Context-sensitive keyboard accelerators
Posted by Tim Boudreau <ni...@gmail.com>.
I'd say file an RFE, but best to get as specific as possible about what
mechanism needs to be changed and how. I.e. Exactly the desired behavior,
what blocks it, and where the change would need to be.
-Tim
On Tue, Feb 27, 2018 at 11:00 AM cowwoc <co...@bbs.darktech.org> wrote:
> Is it okay if I file a RFE for this, or do you feel it should stew a bit
> longer in the mailing list?
>
> Gili
>
> On 2018-02-26 3:47 PM, Christian Lenz wrote:
> > I figured out that problem too, but I don’t know whether this is window
> specific or not.
> > Sure I think you can add a shortcut to your Code, which is already
> taken. You got a warning after NetBeans started that says: „there is a
> duplicate“.
> > Maybe it overrides it or not, I don’t know atm. But if not and you
> created an Action, where you can Change the shortcut via KeyMap Options,
> you sometimes overrides existing ones (Which Shows you a warning or error
> that another one has the same etc.), but yes they should work context
> sensitve, and some are still working context sensitive, afaik.
> >
> > I set ctrl + b to Show the git browser for branches etc. This shortcut
> only Woks, when I select a Project. If I’m in the Editor, it will set a
> bookmark or open the bookmark window. So there is smth like a context
> sensitive way to implement shortcuts but I don’t know the logic at all.
> >
> > My 2 cents
> >
> >
> > Cheers
> >
> > Chris
> >
> > Von: Tim Boudreau
> > Gesendet: Montag, 26. Februar 2018 19:59
> > An: dev@netbeans.incubator.apache.org
> > Betreff: Re: Platform API: Context-sensitive keyboard accelerators
> >
> > 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 <co...@bbs.darktech.org> 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: dev-unsubscribe@netbeans.incubator.apache.org
> >> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
> >>
> >> For further information about the NetBeans mailing lists, visit:
> >> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> >>
> >>
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
> --
http://timboudreau.com
Re: AW: Platform API: Context-sensitive keyboard accelerators
Posted by cowwoc <co...@bbs.darktech.org>.
Is it okay if I file a RFE for this, or do you feel it should stew a bit
longer in the mailing list?
Gili
On 2018-02-26 3:47 PM, Christian Lenz wrote:
> I figured out that problem too, but I don’t know whether this is window specific or not.
> Sure I think you can add a shortcut to your Code, which is already taken. You got a warning after NetBeans started that says: „there is a duplicate“.
> Maybe it overrides it or not, I don’t know atm. But if not and you created an Action, where you can Change the shortcut via KeyMap Options, you sometimes overrides existing ones (Which Shows you a warning or error that another one has the same etc.), but yes they should work context sensitve, and some are still working context sensitive, afaik.
>
> I set ctrl + b to Show the git browser for branches etc. This shortcut only Woks, when I select a Project. If I’m in the Editor, it will set a bookmark or open the bookmark window. So there is smth like a context sensitive way to implement shortcuts but I don’t know the logic at all.
>
> My 2 cents
>
>
> Cheers
>
> Chris
>
> Von: Tim Boudreau
> Gesendet: Montag, 26. Februar 2018 19:59
> An: dev@netbeans.incubator.apache.org
> Betreff: Re: Platform API: Context-sensitive keyboard accelerators
>
> 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 <co...@bbs.darktech.org> 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: dev-unsubscribe@netbeans.incubator.apache.org
>> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.incubator.apache.org
For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
AW: Platform API: Context-sensitive keyboard accelerators
Posted by Christian Lenz <ch...@gmx.net>.
I figured out that problem too, but I don’t know whether this is window specific or not.
Sure I think you can add a shortcut to your Code, which is already taken. You got a warning after NetBeans started that says: „there is a duplicate“.
Maybe it overrides it or not, I don’t know atm. But if not and you created an Action, where you can Change the shortcut via KeyMap Options, you sometimes overrides existing ones (Which Shows you a warning or error that another one has the same etc.), but yes they should work context sensitve, and some are still working context sensitive, afaik.
I set ctrl + b to Show the git browser for branches etc. This shortcut only Woks, when I select a Project. If I’m in the Editor, it will set a bookmark or open the bookmark window. So there is smth like a context sensitive way to implement shortcuts but I don’t know the logic at all.
My 2 cents
Cheers
Chris
Von: Tim Boudreau
Gesendet: Montag, 26. Februar 2018 19:59
An: dev@netbeans.incubator.apache.org
Betreff: Re: Platform API: Context-sensitive keyboard accelerators
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 <co...@bbs.darktech.org> 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: dev-unsubscribe@netbeans.incubator.apache.org
> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>
--
http://timboudreau.com
Re: Platform API: Context-sensitive keyboard accelerators
Posted by Tim Boudreau <ni...@gmail.com>.
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 <co...@bbs.darktech.org> 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: dev-unsubscribe@netbeans.incubator.apache.org
> For additional commands, e-mail: dev-help@netbeans.incubator.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>
--
http://timboudreau.com