Instantiating a plugin's action

hi,

i would like from my plugin get hold of an action of another plugin that i depend on (scala). my naive approach was this:

   val am = ActionManager.getInstance
   val actionRunConsole = am.getAction( "org.jetbrains.plugins.scala.console.RunConsoleAction" )

but this doesn't get me the action. i guess it needs to be "loaded" somehow. how would i load this action?

and then, how do i invoke it. here is my guess:

         val callBack = am.tryToExecute( actionRunConsole, origin.getInputEvent, null, origin.getPlace, true )
         callBack.doWhenDone {
            inform( "console opened" )
            doSomethingElse
         }
         callBack.doWhenProcessed { inform( "console processed" )} // what does that mean, actually?
         callBack.doWhenRejected { inform( "console rejected" )}



correct?

2 comments
Comment actions Permalink

Hi Hanns,

Action lookup uses the action ID (not necessary the class name). For org.jetbrains.plugins.scala.console.RunConsoleAction the ID is "Scala.RunConsole".

When unsure of which actions are actually loaded you could iterate all actions returned from ActionManager.getActions and print their getClass and getId. This could be done from, for example onProjectOpened().

0
Comment actions Permalink

thanks ronnie, that actually was the mistake. look-up with "Scala.RunConsole" does work.

0

Please sign in to leave a comment.