Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

Extend IDE menus and menu items

  • Last UpdatedJul 23, 2024
  • 3 minute read

IDE extensions can extend IDE menu structure by adding a new menu item, a new main menu or a menu separator with respect to an existing IDE menu/submenu. The menu definition is provided in the embedded manifest resource.

In 2023 IDE user interface is modernized to display Ribbonbar like the one used in Microsoft Office. The existing manifest file is compatible to achieve basic appearnace of a Ribbonbar though it does not fully support the customization of the Ribbonbar because the manifest was initially designed for a menu-like interface.

Adding Menu items – The following is an example extract from the sample manifest, emphasizing on how to extend IDE menus by adding new menu items. The first MenuItem tag tries to add a new item just below “Object->Check In” IDE menu and is attached to the “cmdTestCheckin” command whereas, the second one tries to add new item at the bottom of “Object” IDE menu and is attached to the “cmdTestCheckout” command.

<Resources>

<MenuItem Id = "Object/TestCheckin" ParentId="Object"

ReferencedTo="Object/Checkin" ReferencePosition="After">

<CommandId>cmdTestCheckin</CommandId>

<Text>Test Check-in</Text>

</MenuItem>

<MenuItem Id = "Object/TestCheckout" ParentId="Object"

DefaultPosition="Bottom">

<CommandId>cmdTestCheckout</CommandId>

<Text>Test Check-out</Text>

</MenuItem>

</Resources>

In 2023, the menu item is displayed as a button element inside the ribbonbar.

  • MenuItem tag is where new menu item should be provided.

    • Id attribute is the identifier of the menu item. It can be any unique string, but it is recommended to use hierarchical location of the menu in IDE menu structure that would make it more readable.

    • ParentId attribute is the ID of the parent menu this menu item belongs to.

    • ReferencedTo attribute lets user dictate relative to which other menu item this item should be shown. ReferencePosition provides relative position, “Before” or “After”, defaulting to “After”.

    • DefaultPosition attribute in the second MenuItem example dictates whether the menu item should be displayed at the top or bottom amongst its siblings. DefaultPosition attribute can coexist with ReferencedTo and ReferencePosition attributes combination, in which case it will be used as fall back value when the IDE can not resolve references.

  • CommandId tag is the identifier for the command the menu should be attached to. A menu item, which pops up sub-menus, should not be attached to a command. For example, “Import” menu has popup submenus and is enabled if at least one of the sub-menus is enabled.

  • Text tag provides actual text of the menu item should display.

Adding Menus – IDE extensions can add new menus, which display other menu items underneath. In order to achieve this, one should add a Menu tag in the manifest resource. Menu tag does not have any associated command, since a menu is used to pop up its children menu items and not for command invocation. User just provides text for the menu. In order to add a top-level menu, the value of ParentId must be “menubarMain”. The following example shows how to add a menu entry to the Main menu bar.

<Resources>

<Menu Id = "SpecialImport" ParentId=" menubarMain ">

<Text>Special Import</Text>

</Menu>

</Resources>

The following example shows how to add a menu entry to the Main menu bar, and a menu item with a child menu.

<Resources>

<Menu Id = "SpecialImport" ParentId=" menubarMain ">

<Text>Special Import</Text>

</Menu>

<Menu Id = "ParentMenuItem" ParentId="SpecialImport">

<Text>ParentMenuItem</Text>

</Menu>

<MenuItem Id = "ParentMenuItem/ChildMenuItem"
ParentId="ParentMenuItem">

<CommandId>cmdGalaxyConfiguration</CommandId>

<Text>Galaxy Configuration</Text>

</MenuItem>

</Resources>

The following example shows how to add a ribbontab, a buttongroup and a buttonelement to a ribbontab respectively. Note that the buttonelement should always be inside a buttongroup.

<Resources>

<Menu Id = "Home" ParentId=" menubarMain ">

<Text>Home</Text>

</Menu>

<Menu Id = "Home/Edit" ParentId="Home">

<Text>Edit</Text>

</Menu>

<MenuItem Id = "Home/Edit/Tagname" ParentId="Home/Edit">

<CommandId>cmdRename</CommandId>

<Text>Rename</Text>

</MenuItem>

</Resources>

Adding Menu Separators – IDE extensions can also add a separator in the menu structure by adding a Separator tag in the manifest resource. Its ParentId, ReferencedTo and ReferencePosition attributes carry the same meaning as one for MenuItem tag. Separators don’t need any Id attribute. Following is an example of a menu separator.

<Resources>

<Separator ParentId="Object" ReferencedTo="Object/ViewObjViewer"

ReferencePosition="Before"/>

</Resources>

Native IDE Menus – In order to add a menu item to the IDE Menus, the Parent ID must be known. The table below summarizes the ids (for programmatic reference in the ParentId field) of the menus (as viewed in the IDE):

Menu Name

Menu ID

Galaxy

Galaxy

Edit

Edit

View

View

Object

Object

Help

Help

TitleResults for “How to create a CRG?”Also Available in