Adding a keyboard shortcut to a custom toolwindow

Hi,

I've recently developed a plugin and all is going smoothly.

However, I wondered if it's possible to add a custom key-binding to the ToolWindow that my plugin provides, which pops up the ToolWindow (just like pressing Alt+1 displays the Project ToolWindow, for example)?

Ideally, this key-binding would be editable, but that's not a big priority.

It's probably something very simple, but I just can't seem to figure it out; I did a search on this forum but came up blank.

Many thanks,

- Nils

2 comments
Comment actions Permalink

Hello Nils,

For every registered toolwindow, the action to activate it is automatically
registered. The ID of the action is "Activate" + your tool window ID + "ToolWindow".
You can register a shortcut for such an action using the Keymap.addShortcut()
method.

I've recently developed a plugin and all is going smoothly.

However, I wondered if it's possible to add a custom key-binding to
the ToolWindow that my plugin provides, which pops up the ToolWindow
(just like pressing Alt+1 displays the Project ToolWindow, for
example)?

Ideally, this key-binding would be editable, but that's not a big
priority.

It's probably something very simple, but I just can't seem to figure
it out; I did a search on this forum but came up blank.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

That's even simpler than I thought it would be!

Thanks,

- Nils

0

Please sign in to leave a comment.