Global Key Interceptor [message #1852412] |
Sat, 14 May 2022 21:20 |
Mirko Raner Messages: 125 Registered: July 2009 Location: New York City, NY |
Senior Member |
|
|
Most developers make extensive use of keyboard shortcuts, and the ongoing activities may sometimes be hard to follow for others during a pair programming session or presentation (as viewers typically won't be able to see which keys are being typed). Learning about new keyboard shortcuts is an important aspect of pair programming (and watching coding presentations), and I would like to facilitate this experience for the folks who are not in the driver's seat and just watching the screen.
I've been thinking about an Eclipse plugin that, in a separate view, logs all keyboard strokes that trigger commands/actions. For example, when I press Ctrl+Shift+O, an entry should appear that says something like "Ctrl+Shift+O - Organize Imports", or when I press Ctrl+1 it should show "Ctrl+1 - Quick Fix". Ideally, this should work in any view, not just in a particular editor or view. That is, for example, during a debug session, this new view would log things like "F5 - Step Into" and "F8 - Resume" to make it easier for an onlooker to follow the activities on the screen.
I've looked at Eclipse's Command and Action framework, but that seems to be more for registering new actions with particular views and editors. I'm looking for a global "hook" (so to speak) that allows me to intercept any and all special key presses and gives me access to the current command context so I can look up and log the corresponding action names.
Can someone give me some pointers to how I would go about for such a plugin? Is there some sort of global key interceptor API?
|
|
|
Re: Global Key Interceptor [message #1852427 is a reply to message #1852412] |
Mon, 16 May 2022 07:57 |
Rolf Theunissen Messages: 260 Registered: April 2012 |
Senior Member |
|
|
Eclipse has already some functionality like this, it doesn't show in a separate window but as on overlay on the screen. This is also useful for screen casts.
Go to Preferences > General > Keys, then in the bottom 'Show key bindings when command is involved' choose 'Through keyboard' and/or 'Through mouse click'
This is implemented in org.eclipse.ui.internal.keys.show.ShowKeysListener and org.eclipse.ui.internal.keys.showShowKeysUI
It makes us of the org.eclipse.core.commands.IExecutionListener API
[Updated on: Mon, 16 May 2022 08:02] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02664 seconds