diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt index 2664e3ab3f42..b17a5e4053f7 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/EventDispatcher.kt @@ -97,7 +97,7 @@ object EventDispatcher { } else { val actionManager = ActionManager.getInstance() val mainActions = (actionManager.getAction(IdeActions.GROUP_MAIN_MENU) as ActionGroup).getFlatIdList() - if (mainActions.contains(actionManager.getId(action))) ScriptGenerator.processMainMenuActionEvent(action) + if (mainActions.contains(actionManager.getId(action))) ScriptGenerator.processMainMenuActionEvent(action, event) } } diff --git a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt index a891ae0094e0..e6ac07bbc761 100644 --- a/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt +++ b/platform/testGuiFramework/src/com/intellij/testGuiFramework/recorder/ScriptGenerator.kt @@ -65,11 +65,12 @@ object ScriptGenerator { addToScript(code) } - fun processMainMenuActionEvent(action: AnAction) { + fun processMainMenuActionEvent(action: AnAction, event: AnActionEvent) { val actionId: String? = ActionManager.getInstance().getId(action) if (actionId == null) { addToScript("//called action (${action.templatePresentation.text}) from main menu with null actionId"); return } + if (event.place != "MainMenu") return addToScript(Templates.invokeMainMenuAction(actionId)) }