How can I list the action names for the right-click EditorPopupMenu?
I have added an action to the menu brought up when I right-click inside a source file. The action currently sits at the bottom of the menu. I now, instead of having the action appear as the last item, want to position it immediately below the "Create '...'" action that creates a run configuration. But I can't figure out what name to put in my add-to-group element:
<add-to-group group-id="EditorPopupMenu" anchor="after" relative-to-action="(what goes here?)"/>
For situations like this, where I want to learn the names of the actions and groups in a menu so that I can position a new action with respect to some existing action, how can I dump the complete list of action and group names that currently exist in a menu?
请先登录再写评论。
Hi Brandon,
you can use `com.intellij.openapi.actionSystem.ActionManager#getId` to get the id of the action. You can ask com.intellij.openapi.actionSystem.ActionManager#getAction(PopupMenuId) to get top level action in the menu and then call getChildren to get actions in the menu.
Hope this helps,
Anna
Thank you, Anna! Your advice was perfect; I was able to find what I needed with:
ActionManager.getInstance().getAction("EditorPopupMenu").getChildren(null)