From 03eec82f388a44d8bbcf7f23042b07af1c46a5f1 Mon Sep 17 00:00:00 2001 From: Anna Bulenkova Date: Mon, 8 Dec 2014 09:45:57 +0100 Subject: [PATCH] [md] Explanation for DefaultActionGroup added http://bit.ly/1A7Nr5K --- tutorials/action_system.md | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tutorials/action_system.md b/tutorials/action_system.md index 95865a216..5e96903b5 100644 --- a/tutorials/action_system.md +++ b/tutorials/action_system.md @@ -102,7 +102,26 @@ If some part of the functionality requires to implement several actions or actio they can be joined into groups. In this case the group will be available as a top-level menu item, action will be represented as drop-down menu items. Grouping can be done by placing attribute into [plugin.xml] (https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/plugin_sample/META-INF/plugin.xml) -file. +file. In most of the cases you simply need to leave "class" attribute of the undefined; in this case an instance of +[DefaultActionGroup] (https://github.com/JetBrains/intellij-community/blob/master/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java) +will be created and filled with actions defined within it. + + + + +See +[GroupedToDefaultAction.java] (https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/plugin_sample/src/org/jetbrains/plugins/sample/actions/GroupedToDefaultAction.java) + +If set of actions, which need to be put into a group, is defined dynamically depending on the context, +a custom action group can be created by setting *class* attribute. The class itself, like +[DummyActionGroup] (https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/plugin_sample/src/org/jetbrains/plugins/sample/DummyActionGroup.java) +in this example, should be derived from +[ActionGroup] (https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionGroup.java) +and its +[getChildren()](https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/plugin_sample/src/org/jetbrains/plugins/sample/DummyActionGroup.java) +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.