All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ide-core.services.menu.js Maven / Gradle / Ivy

/*
 * Copyright (c) 2010-2019 SAP and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   SAP - initial API and implementation
 */
var extensions = require('core/v3/extensions');
var response = require('http/v3/response');

var mainmenu = [];
var menuExtensions = extensions.getExtensions('ide-menu');

for (var i = 0; i < menuExtensions.length; i++) {
    var module = menuExtensions[i];
    try {
    	menuExtension = require(module);
    	var menu = menuExtension.getMenu();
    	mainmenu.push(menu);	
    } catch(error) {
    	console.error('Error occured while loading metadata for the menu: ' + module);
    	console.error(error);
    }
}

mainmenu.sort(function(p, n) {
	return (parseInt(p.order) - parseInt(n.order));
});

response.println(JSON.stringify(mainmenu));




© 2015 - 2025 Weber Informatics LLC | Privacy Policy