Add new Main menu option for plugin

I would like to add a new menu option for my Plugin to then add my new menu options with

add-to-group. I can't find any documentation on how to do this.

Any suggestions?

MArkee

10 comments

Hi,

The plugin-dev-package ( idea6913-dev.zip or something like that ) which must be downloaded separately, contains an example on how to create new menus and how to add actions to them. See examples/actions.
Note: menus are called ActionsGroups and defined by group-tags in plugin.xml and menu items are Actions and are defined by action-tags in plugin.xml

Besides that, the plugins directory of the said package contains many plugin sources and most of them provide actions in some menus.

Or maybe I misunderstood you. In that case: Can you be a bit more specific what exactly you want to achieve.

Cheers,
Robert

0

Thanks for the link.

The Intellij helppage http://www.jetbrains.com/idea/plugins/action_system.html contains details on how to an existing menu but not how to add a new main menu.

MArkee

0

Main menu is just a regular existing menu with id="MainMenu", which you may want to add new group to.

0

So if I have the actions fooOpen and fooClose and want to add them to the new main menu option foo as menu items, how do I do this?

MArkee

0

The tutorial at link supplied shows how to register an action via plugin.xml.
Search for 'add-to-group group-id="ToolsMenu"' there and just replace "ToolsMenu" with "MainMenu". Anchor information like "after" attribute must also change accordigly.

0

Example in IDEA examples showed how to do this. I have not realised Text is the main menu entry.

I've been writing aa plugin for Eclipse as well - its nice to be back in IDEA ;)

MArkee

0

Hi !

I'm facing the same issue, able to add to existing menu but not creating a new one ..  . following is the xml content

<actions>
<group class="actions.CustomMenuGroup" id="CustomMenuGroup" text="Custom Menu" description="Group with test actions"  popup="true">
    <action id="VssIntegration.TestAction" class="actions.TestAction" text="My Test Action" description="My test action"/>
     <separator/>

  <add-to-group group-id="MainMenu" relative-to-action="HelpMenu" anchor="before"/>
</group>
</actions>

while    
     <action id="reader" class="actions.reader" text="reader">

<add-to-group group-id="ToolsMenu" anchor="first"/>
    </action>

and
   <action id="SWTinAWTPlug" class="SWTinAWTPlug" text="SWTinAWTPlug" description="SWTinAWTPlug">
        <add-to-group group-id="OtherMenu" anchor="last"/>
      </actionwork >

works fine..

Would appreciate the help

1

Why are you setting popup="true" for your group? Try removing it.


0

i did set it to false but it does'nt reflect any changes.

0

Dimitry, Thank you

Resolved the issue, was assigning a class for the group which was not needed.

0

Please sign in to leave a comment.