Is there a way to add a dynamic action in idea OpenAPI?

I mean adding an action defined at run time without having entry for it in the plugin.xml
file.

3 comments
Comment actions Permalink

Yes. A number of existing plugins do this. For an example, see the
initComponent() method in the WorkspacesConfigurable class used in the
Workspaces plugin
(http://www.intellij.org/twiki/bin/view/Main/WorkspacesPlugin). Actually,
none of the actions used by the Workspaces plugin are defined in plugin.xml.

There are essentially two steps:

1) Adding your action to a menu/toolbar/etc to make it visible to the user
2) Registering the action with the ActionManager

Note that you aren't required to do both. If you do 1 but not 2, you'll
have an action that's only accessible via the UI. If you do 2 and not 1,
your action will be accessible via a key mapping, but not via the UI.


"dimiter" <dimiter@blue-edge.bg> wrote in message
news:arr6mf$sdh$2@is.intellij.net...

I mean adding an action defined at run time without having entry for it in

the plugin.xml

file.

>


0
Comment actions Permalink

Thanks for the suggestion, I tried it and it almost works :)...

I see that the action is registered in the action manager, but what I really need is to
see it in the Keymap dialog. From the Workspaces plugin I see only the static actions -
"close all", "close all non workspace" and "create new". I.e. I can't make a keyboard
shortcut for "Toggle Pin".

I also want to specify the presentation (accelerator key, caption, icon, etc.) for the new
actions.
And I prefer not to be forced to add them to visual container such as toolbar or menu.

Thanks in advance,
Dimiter



PS I'd be very very happy if somebody writes something about the action system in the wiki...

Especially:
- Action groups (what are the default action groups, how to use them)
- Action place (see above)
- ActionEvent (what's in the data context for the different actions)
- Presentation (how to associate presentation with action)
- ShortcutSet
- DataProvider

0
Comment actions Permalink

It's recommended to discuss Open API related stuff in
jetbrains.intellij.openapi group instead of this general one.

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"

"dimiter" <dimiter@blue-edge.bg> wrote in message
news:arr6mf$sdh$2@is.intellij.net...

I mean adding an action defined at run time without having entry for it in

the plugin.xml

file.

>


0

Please sign in to leave a comment.