Out of curiosity (as I may still be living in the past), here is one of the
documents I have written when attempting to (re)design the NetBeans action
system:
https://openide.netbeans.org/proposals/actions/index.html
In general my intention was to use [Action.callback](
http://bits.netbeans.org/8.2/javadoc/org-openide-awt/org/openide/awt/Actions.html#callback-java.lang.String-javax.swing.Action-boolean-java.lang.String-java.lang.String-boolean-)
actions to register a generic placeholder with a shortcut that can then do
whatever each component wants.
-jt
2018-02-27 20:44 GMT+01:00 cowwoc :
> 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 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