Executing actionPerformed from a non-menu context
Hi,
While working on my plugin gitflow4idea I ran into the following issue:
I'm trying to run the git merge tool for conflicted files whenever a feature/release branch is finished.
For that I need to run the actionPerformed method of GitResolveConflictsAction, which extends git4idea.actions.GitAction .
The problem is that the signature of actionPerformed has the argument of @NotNull AnActionEvent event
Since I'm not calling this method from a menu context, but rather after parsing the git flow command line output , I don't have any AnActionEvent event.
I tried constructing a dummy event:
AnActionEvent e = new AnActionEvent(null, DataManager.getInstance().getDataContext(), ActionPlaces.UNKNOWN, new Presentation(), null, 0);
but it fails with:
Access is allowed from event dispatch thread only.
Details: Current thread: Thread[ApplicationImpl pooled thread 45,4,Idea Thread Group] 258089001
Our dispatch thread:Thread[AWT-EventQueue-1 13.0#IC-132.947, eap:true,6,Idea Thread Group] 569230622
SystemEventQueueThread: Thread[AWT-EventQueue-1 13.0#IC-132.947, eap:true,6,Idea Thread Group] 569230622
Is there a way to get around this, or a better way to invoke actionPerformed method? (The method doesn't use the AnActionEvent argument at all)
Thanks!
Please sign in to leave a comment.
Maybe this issue might help you:
http://devnet.jetbrains.com/message/5193848
Markus
This is the correct way to invoke actionPerformed(), but you do have to invoke it from the event dispatch thread.
Great, thanks! :)