Jump to: navigation, search

FAQ How do I add menus to the main menu?

Revision as of 15:26, 14 March 2006 by Claffra (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Menus and submenus are added to the main menu by using the org.eclipse.ui.actionSets extension point. Here is an example of a top-level menu defined by the FAQ Examples plug-in:

   <menu
      label="FA&Q Examples"
      id="exampleMenu">
      <separator name="exampleGroup"/>
   </menu>

Each menu contains one or more separator elements that define groups within that menu. The menu ID, along with the separator name, is used by actions contributing to that menu. If you want to create a submenu, you also need to define a path attribute that specifies what menu and group your menu should appear under. This path attribute has the same syntax as the menubarPath attribute on action definitions. To add a submenu to the menu defined earlier, you would add the following attribute:

   path="exampleMenu/exampleGroup"

To add a submenu to the File menu after the New submenu, the path would be:

   path="file/new.ext"

The syntax of menu paths is described in more detail in FAQ 223.


See Also:

FAQ_What_is_an_action_set?

FAQ_How_do_I_add_actions_to_the_main_menu?

FAQ_Where_can_I_find_a_list_of_existing_action_group_names?


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.