Adding a menu

You can add a menu and its associated menu items to the Application or Navigation bars.

The SampleExtensionMenuQuicklinks.zip sample extension adds a menu and six menu items. Part of the spec.json file is shown here.

{
	"name":"Sample_Menu_Quicklinks",
	"schemaVersion": "1.0",
	"extensions": [
	{
		"perspective": "common",
		"comment": "There is a special meta perspective called COMMON. Adding contributions
         to this perspective will cause the extension to be applied to All perspectives.",
		"features": [{
			"id": "sample.common.menu.openMulipleItems",
			"toolItems": [
			{
				"comment": "This code adds a custom menu item to the App Bar in the trailing group.",
				"id":"custom.appbar.trailingGroup.menu",
				"containerId": "com.ibm.bi.glass.appbarTrailingGroup",
				"type": "Menu",
				"label": "Quick links",
				"icon": "images/debug.svg",
				"weight": 650
			},
			{
				"comment": "This code adds a submenu item to the custom menu created above.",
				"id": "custom.appbar.trailingGroup.menuItem1",
				"containerId" : "custom.appbar.trailingGroup.menu",
				"comment": "The containerId is the ID of the parent menu.",
				"type": "MenuItem",
				"actionController": "v1/ext/Sample_Menu_Quicklinks/js/controllers/SampleMenuQuicklinks",
				"comment": "The actionController determines the actions for the menu item.",
				"label": "Home",
				"icon": "common-home",
				"weight":900
			},
			{
				"comment": "This code adds a submenu item to the custom menu created above.",
				"id": "custom.appbar.trailingGroup.menuItem2",
				"containerId" : "custom.appbar.trailingGroup.menu",
				"comment": "The containerId is the ID of the parent menu.",
				"label": "Line dashboard",
				"type": "MenuItem",
				"icon": "common-dashboard",
				"weight":800,
				"actionController": "bi/glass/api/DashboardOpener",
				"comment": "The actionController determines the actions for the menu item.",
				"options": {"path": ".public_folders/Samples/Extensions/Line dashboard"}
			},...			
			]
		}]
	}]}

In this example, the menu is located in the Application bar trailing group.