source: action group with one action and comments

This commit is contained in:
Anna Bulenkova 2014-12-05 15:22:00 +01:00
parent 5300e85b5c
commit fe14eeeb09
3 changed files with 149 additions and 94 deletions

View File

@ -73,7 +73,8 @@
The optional "use-shortcut-of" attribute specifies the ID of the action whose keyboard shortcut this action will use.
The optional "description" attribute specifies the text which is displayed in the status bar when the action is focused.
The optional "icon" attribute specifies the icon which is displayed on the toolbar button or next to the menu item. -->
<action id="PluginSample.DummyAction" class="org.jetbrains.plugins.sample.SimpleAction" text="Dummy Action" description="Illustrates how to plug an action in">
<action id="PluginSample.DummyAction" class="org.jetbrains.plugins.sample.SimpleAction" text="Dummy Action"
description="Illustrates how to plug an action in">
<!-- The <keyboard-shortcut> node specifies the keyboard shortcut for the action. An action can have several keyboard shortcuts.
The mandatory "first-keystroke" attribute specifies the first keystroke of the action. The key strokes are specified according to the regular Swing rules.
The optional "second-keystroke" attribute specifies the second keystroke of the action.
@ -96,6 +97,28 @@
the current action is inserted. -->
<add-to-group group-id="ToolsMenu" anchor="after"/>
</action>
<!-- The <group> element defines an action group. <action>, <group> and <separator> elements defined within it are automatically included in the group.
The mandatory "id" attribute specifies an unique identifier for the action.
The optional "class" attribute specifies the full-qualified name of the class implementing the group. If not specified,
com.intellij.openapi.actionSystem.DefaultActionGroup is used.
The optional "text" attribute specifies the text of the group (text for the menu item showing the submenu).
The optional "description" attribute specifies the text which is displayed in the status bar when the group is focused.
The optional "icon" attribute specifies the icon which is displayed on the toolbar button or next to the group.
The optional "popup" attribute specifies how the group is presented in the menu. If a group has popup="true", actions in it
are placed in a submenu; for popup="false", actions are displayed as a section of the same menu delimited by separators. -->
<group class="org.jetbrains.plugins.sample.DummyActionGroup" id="DummyActionGroup" text="Action Group"
description="Illustration of an action group"
icon="icons/testgroup.png" popup="true">
<action id="PluginSample.GroupedAction" class="org.jetbrains.plugins.sample.GroupedAction"
text="Grouped Action" description="An action in the group"/>
<!-- The <separator> element defines a separator between actions. It can also have an <add-to-group> child element. -->
<separator/>
<group id="ActionSubGroup"/>
<!-- The <reference> element allows to add an existing action to the group. The mandatory "ref" attribute specifies the ID of the action to add. -->
<reference ref="EditorCopy"/>
<add-to-group group-id="MainMenu" relative-to-action="HelpMenu" anchor="before"/>
</group>
</actions>
<!-- Extension points defined by the plugin. Extension points are registered by a plugin so that other plugins can provide this plugin

View File

@ -0,0 +1,17 @@
package org.jetbrains.plugins.sample;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import org.jetbrains.annotations.NotNull;
/**
* @author Anna Bulenkova
*/
public class DummyActionGroup extends ActionGroup {
@NotNull
@Override
public AnAction[] getChildren(AnActionEvent anActionEvent) {
return new GroupedAction[0];
}
}

View File

@ -0,0 +1,15 @@
package org.jetbrains.plugins.sample;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import org.jetbrains.annotations.NotNull;
/**
* @author Anna Bulenkova
*/
public class GroupedAction extends AnAction {
@Override
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
}
}