How do I invoke an action from another?
I want to invoke an action from the end of the .actionPerformed() method in my AnAction derived action.
Specifically, I want to invoke the action related to the Code -> Override Methods... menu entry (com.intellij.ide.hierarchy.method.OverrideMethodAction, I believe).
Please sign in to leave a comment.
Get an action class instance using ActionManager.getAction and invoke 'actionPerformed' on it.
Would I pass the same AnActionEvent from my calling action to the new action's actionPerformed()? I tried that and traced it through the debugger. It's using the event's context to determine the editor, which comes up null. I want to be able to open the overrides dialog based on the currently active editor.
If your action is not executed in editor context, you'll need to provide a different AnActionEvent with editor's data context (you can get it using EditorEx.getDataContext() for the specific editor instance).