Giving status information via RGB keyboard illumination

Hi,

I've been wondering about the possibility of using a programmable RGB keyboard, like the Corsair K series or the Das 5Q, to give status information in the editor. I've been going through the Platform documentation and would like to clarify a few points of possible.

* The Corsair K series SDK is provided as Windows DLLs. There is an existing Java binding for them which uses the JNA classloader. Is this acceptable in a plugin and can it be set up to use that classloader? Another problem is that the plugin would not work on the Mac because there is no Corsair support for it, are plugins required to be platform independent? (The 5Q currently uses local network requests so there is no problem, although that might change)

* Part of the status information displayed would depend on the location of the primary caret, so needs to be updated whenever the document is changed or it moves. The choice for this seems to be TypedActionHandler, but according to the tutorial a plugin TypedActionHandler is responsible for calling the previous TypedActionHandler once it is done. It's not clear how I get the previous TypedActionHandler to do this, and the tutorial example doesn't seem to actually do this. There's a reference to a TypedActionDelegate for newer versions of IDEA, but not a lot of detail about it. In addition, the primary caret can also be moved by clicking the mouse, which presumably isn't a "typed" action. Is there a standard way of doing this?

* I would also like to consider using an area of the keyboard to indicate active progress bars. Presumably this is some kind of listener for progress bar based notifications but it seems that plugins do not get to set up their own listeners, they just declare extensions and let the setup system do it for them. Is there an appropriate hook for this?

5 comments

As for the caret location, you can use either

editor.getCaretModel().addCaretListener(...) - to add caret listener to a specific editor, or

EditorFactory.getInstance().getEventMulticaster().addCaretListener(...) - to be notified on caret movement in any editor.

 

0

Where in a plugin would I put that, though? It seems that plugins don't get an "init" model to call listeners, they just have to attach to extension points - what's the right extension point to use for adding listeners?

0

Hi Mark,

it is possible to use native libraries from a plugin, our classloader will load them from the plugin's 'lib' directory. Currently it isn't possible to specify that a plugin is os-dependent, but you can write about this in the plugin description and show an error notification from the plugin's code if it's started on unsupported OS.

0

Your plugin can define application or project components, you can put your initialization logic to 'initComponent()' method of those components.

0

For tracking user-visible progresses, you can subscribe to com.intellij.openapi.progress.util.ProgressWindow#TOPIC on application.messageBus.

0

Please sign in to leave a comment.