diff --git a/tutorials/action_system/action_system.md b/tutorials/action_system/action_system.md index 4bd13af07..769aaa988 100644 --- a/tutorials/action_system/action_system.md +++ b/tutorials/action_system/action_system.md @@ -183,41 +183,55 @@ If some part of the functionality requires to implement several actions or actio In this case the group will be available as a top-level menu item, action will be represented as drop-down menu items. ##Creating custom action groups. -Grouping can be done by extending -[ActionGroup.java]() -class. - - public class SimpleGroup extends ActionGroup { - @NotNull - @Override - public AnAction[] getChildren(AnActionEvent anActionEvent) { - return new AnAction[0]; - } - } - -##Registering action groups. -IntelliJ IDEA has embedded inspection an quick fix for registering groups of actions. -After the group has been created it's declaration should be highlighted. Place caret on group's class name declaration and press -***Alt + Enter*** -to register it: - -![Register action group](img/register_group.png) - -In this sample our custom action group will be available in the editor popup menu: - -![Register action group](img/editor_popup_menu.png) - -After filling the "New Action" form and applying the changes ** section of the +Grouping can be done by extending adding ** attribute to ** [plugin.xml]() -file will look like this: +file. - - + +##Binding action groups to UI component. +The following sample shows how to place a custom action group on top of the editor popup menu: + + + + + + + +##Adding actions to the group. +To create an action we need to extend +[AnAction.java]() +class: + + public class GroupedAction extends AnAction { + @Override + public void update(AnActionEvent event) { + event.getPresentation().setEnabledAndVisible(true); + } + + @Override + public void actionPerformed(AnActionEvent event) { + //Does nothing + } + } + +And then the actions needs to be registered in the newly created group: + + + + + + + + + +After performing the steps described above the action group nad it's content will be available in the editor popup menu: + +![Custom Action Group](img/grouped_action.png) ------------- @@ -246,27 +260,6 @@ method should return an array of [actions] (https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/plugin_sample/src/org/jetbrains/plugins/sample/GroupedAction.java) belonging to this group. - - - - - - - - - - -------------- diff --git a/tutorials/action_system/img/grouped_action.png b/tutorials/action_system/img/grouped_action.png new file mode 100644 index 000000000..78ef8914c Binary files /dev/null and b/tutorials/action_system/img/grouped_action.png differ