如何在intellij插件中创建子菜单项

时间:2016-10-03 14:22:15

标签: intellij-idea intellij-14 intellij-plugin

我在主菜单下创建了一个菜单项,但我想创建一个子菜单项,如此图像enter image description here

我在plugin.xml中使用了这个xml标签。我想创建一个子菜单,如图像上的红色标记。

<actions>
    <!-- Add your actions here -->
    <group id="MyPlugin.test" text="_" description="test">
        <add-to-group group-id="MainMenu" anchor="last"  />
        <!--<action id="Myplugin.Textboxes" class="Mypackage.TextBoxes" text="Text _Boxes" description="A  menu item" />
        <action id="Myplugin.Dialogs" class="Mypackage.MyShowDialog" text="Show _Dialog" description="A  menu item" />-->
        <action id="testAndroidPlugin.MyAction" class="com.test.bijesh.MyActionClass" text="Create String"
                description="The action implemented by MyActionClass class">
            <!--<add-to-group group-id="MainMenu" anchor="after" relative-to-action="WindowMenu"/>-->
            <keyboard-shortcut keymap="$default" first-keystroke="ctrl alt S"/>
        </action>
        <action id="testAndroidPlugin.ManageResources" class="com.test.bijesh.actions.ColorActions" text="Create Color"
                description="The action implemented by ColorAction class">
            <!--<add-to-group group-id="MainMenu" anchor="after" relative-to-action="WindowMenu"/>-->
            <keyboard-shortcut keymap="$default" first-keystroke="ctrl alt C"/>
        </action>
    </group>
</actions>

1 个答案:

答案 0 :(得分:1)

以下是我们在Ceylon IDE中的表现方式:

<actions>
    <group text="Ceylon" icon="/icons/ceylon.png" popup="true">
        <action> ...</action>
        <add-to-group group-id="ToolsMenu" anchor="last"/>
    </group>
</actions>

这导致Tools > Ceylon > ...。我认为您的版本不起作用,因为text="_"生成一个空文本(_用于键盘快捷键)。