Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Global Key Interceptor
Global Key Interceptor [message #1852412] Sat, 14 May 2022 21:20 Go to next message
Mirko Raner is currently offline Mirko RanerFriend
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 Go to previous messageGo to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
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

Re: Global Key Interceptor [message #1852451 is a reply to message #1852427] Mon, 16 May 2022 20:12 Go to previous message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 125
Registered: July 2009
Location: New York City, NY
Senior Member
Thanks, Rolf. I'm aware of this feature but I wanted to create something more persistent. The overlays are easy to miss if there is a lot of other stuff going on in the workbench. I will have a look at the IExecutionListener API, it seems to be exactly what I need.
Previous Topic:Nested target does not resolve
Next Topic:How to create update site without rebuilding all features?
Goto Forum:
  


Current Time: Fri Mar 29 09:02:29 GMT 2024

Powered by FUDForum. Page generated in 0.02517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top