[gui-test] fix for invokeMainMenuAction() on each ActionButton click

This commit is contained in:
Sergey Karashevich
2017-08-14 14:26:08 +03:00
parent 037b743809
commit bb3acc128b
2 changed files with 3 additions and 2 deletions
@@ -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)
}
}
@@ -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))
}