Fire an event from a plugin

Hi All,

Is there a way to fire an event in IDEA from a plugin? Something like this:
ActionManager.getInstance(project).fireEventById("EditorCopy");

Thanks
Sergiy

0
4 comments
Avatar
Permanently deleted user

Hello Sergiy,

SD> Is there a way to fire an event in IDEA from a plugin? Something
SD> like this:
SD> ActionManager.getInstance(project).fireEventById("EditorCopy");

What exactly do you want to do? "EditorCopy" is not an event.

If you want to execute an action programmatically, you can call ActionManager.getInstance().getAction(id).actionPerformed()
with a correct DataContext.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

What exactly do you want to do? "EditorCopy" is not
an event.

If you want to execute an action programmatically,
you can call
ActionManager.getInstance().getAction(id).actionPerfor
med()
with a correct DataContext.



Sorry, I used word "event" but actually I was talking about "actions".
Thanks for understanding :)

Does this call have to be wrapped somehow? Runnable, CommandProcessor or something else?
Is there easy way to create DataContext?

I would like to trigger Code Completion in certain conditions from my plugin.
I checked StrutsAssist, but as far as I understand it uses a bit different strategy. It uses invoke method, and calls CodeCompletion directly.

Thanks.
-Sergiy

0
Avatar
Permanently deleted user

Hello Sergiy,

>> What exactly do you want to do? "EditorCopy" is not an event.
>>
>> If you want to execute an action programmatically,
>> you can call
>> ActionManager.getInstance().getAction(id).actionPerformed()
>> with a correct DataContext.
SD> Sorry, I used word "event" but actually I was talking about
SD> "actions". Thanks for understanding :)
SD>
SD> Does this call have to be wrapped somehow? Runnable,
SD> CommandProcessor or something else?

No. The action itself will take care of the necessary commands, write actions
etc.

SD> Is there easy way to create DataContext?

DataManager.getDataContext()

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.