bundles/org.eclipse.orion.client.ui/web/orion/commands.js
function(parent, items, handler, userData, commandService) {
			var choices = this.getChoices(items, handler, userData);
			var addCheck = choices.some(function(choice) {
				return choice.checked;
			});
			choices.forEach(function(choice) {
				if (choice.name) {
					var itemNode = document.createElement("li"); //$NON-NLS-0$
					itemNode.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
					parent.appendChild(itemNode);
					var node = document.createElement("span"); //$NON-NLS-0$
					node.tabIndex = -1; 
					node.classList.add("dropdownMenuItem"); //$NON-NLS-0$
					node.style.outline = "none";
					if (addCheck) {
						node.setAttribute("role", "menuitemradio");  //$NON-NLS-1$ //$NON-NLS-0$
						node.setAttribute("aria-checked", choice.checked ? "true" : "false"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
						var check = document.createElement("span"); //$NON-NLS-0$
						check.classList.add("check"); //$NON-NLS-0$
						check.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
						check.setAttribute("aria-hidden", "true");  //$NON-NLS-1$ //$NON-NLS-0$
						check.appendChild(document.createTextNode(choice.checked ? "\u25CF" : "")); //$NON-NLS-1$ //$NON-NLS-0$
						node.appendChild(check);
					} else {
						node.setAttribute("role", "menuitem");  //$NON-NLS-1$ //$NON-NLS-0$
					}
					if (choice.imageClass) {
						var image = document.createElement("span"); //$NON-NLS-0$
						image.classList.add(choice.imageClass);
						node.appendChild(image);
					}
					var span = document.createElement("span"); //$NON-NLS-0$
					var text = document.createTextNode(choice.name);
					span.appendChild(text);
					node.appendChild(span);
					itemNode.appendChild(node);
					node.choice = choice;
					node.addEventListener("click", function(event) { //$NON-NLS-0$
						mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
						choice.callback.call(choice, items);
					}.bind(this), false); 
					node.addEventListener("keydown", function(event) { //$NON-NLS-0$
						if (event.keyCode === lib.KEY.ENTER || event.keyCode === lib.KEY.SPACE) {
							mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-0$
							choice.callback.call(choice, items);
						}
					}.bind(this), false);
				} else {  // anything not named is a separator
					commandService._generateMenuSeparator(parent);
				}
			}.bind(this));
		}
function(parent, items, handler, userData, commandService) {
			var choices = this.getChoices(items, handler, userData);
			var addCheck = choices.some(function(choice) {
				return choice.checked;
			});
			choices.forEach(function(choice) {
				if (choice.name) {
					var itemNode = document.createElement("li"); //$NON-NLS-0$
					itemNode.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
					parent.appendChild(itemNode);
					var node = document.createElement("span"); //$NON-NLS-0$
					node.tabIndex = -1; 
					node.classList.add("dropdownMenuItem"); //$NON-NLS-0$
					node.style.outline = "none";
					if (addCheck) {
						node.setAttribute("role", "menuitemradio");  //$NON-NLS-1$ //$NON-NLS-0$
						node.setAttribute("aria-checked", choice.checked ? "true" : "false"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
						var check = document.createElement("span"); //$NON-NLS-0$
						check.classList.add("check"); //$NON-NLS-0$
						check.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
						check.setAttribute("aria-hidden", "true");  //$NON-NLS-1$ //$NON-NLS-0$
						check.appendChild(document.createTextNode(choice.checked ? "\u25CF" : "")); //$NON-NLS-1$ //$NON-NLS-0$
						node.appendChild(check);
					} else {
						node.setAttribute("role", "menuitem");  //$NON-NLS-1$ //$NON-NLS-0$
					}
					if (choice.imageClass) {
						var image = document.createElement("span"); //$NON-NLS-0$
						image.classList.add(choice.imageClass);
						node.appendChild(image);
					}
					var span = document.createElement("span"); //$NON-NLS-0$
					var text = document.createTextNode(choice.name);
					span.appendChild(text);
					node.appendChild(span);
					itemNode.appendChild(node);
					node.choice = choice;
					node.addEventListener("click", function(event) { //$NON-NLS-0$
						mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
						choice.callback.call(choice, items);
					}.bind(this), false); 
					node.addEventListener("keydown", function(event) { //$NON-NLS-0$
						if (event.keyCode === lib.KEY.ENTER || event.keyCode === lib.KEY.SPACE) {
							mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-0$
							choice.callback.call(choice, items);
						}
					}.bind(this), false);
				} else {  // anything not named is a separator
					commandService._generateMenuSeparator(parent);
				}
			}.bind(this));
		}
function ( parent , items , handler , userData , commandService ) { var choices = this . getChoices ( items , handler , userData ) ; var addCheck = choices . some ( function ( choice ) { return choice . checked ; } ) ; choices . forEach ( function ( choice ) { if ( choice . name ) { var itemNode = document . createElement ( "li" ) ; //$NON-NLS-0$ itemNode . setAttribute ( "role" , "none" ) ; //$NON-NLS-0$ //$NON-NLS-1$ parent . appendChild ( itemNode ) ; var node = document . createElement ( "span" ) ; //$NON-NLS-0$ node . tabIndex = - 1 ; node . classList . add ( "dropdownMenuItem" ) ; //$NON-NLS-0$ node . style . outline = "none" ; if ( addCheck ) { node . setAttribute ( "role" , "menuitemradio" ) ; //$NON-NLS-1$ //$NON-NLS-0$ node . setAttribute ( "aria-checked" , choice . checked ? "true" : "false" ) ; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ var check = document . createElement ( "span" ) ; //$NON-NLS-0$ check . classList . add ( "check" ) ; //$NON-NLS-0$ check . setAttribute ( "role" , "none" ) ; //$NON-NLS-0$ //$NON-NLS-1$ check . setAttribute ( "aria-hidden" , "true" ) ; //$NON-NLS-1$ //$NON-NLS-0$ check . appendChild ( document . createTextNode ( choice . checked ? "\u25CF" : "" ) ) ; //$NON-NLS-1$ //$NON-NLS-0$ node . appendChild ( check ) ; } else { node . setAttribute ( "role" , "menuitem" ) ; //$NON-NLS-1$ //$NON-NLS-0$ } if ( choice . imageClass ) { var image = document . createElement ( "span" ) ; //$NON-NLS-0$ image . classList . add ( choice . imageClass ) ; node . appendChild ( image ) ; } var span = document . createElement ( "span" ) ; //$NON-NLS-0$ var text = document . createTextNode ( choice . name ) ; span . appendChild ( text ) ; node . appendChild ( span ) ; itemNode . appendChild ( node ) ; node . choice = choice ; node . addEventListener ( "click" , function ( event ) { //$NON-NLS-0$ mMetrics . logEvent ( "command" , "invoke" , this . id + ">" + choice . name ) ; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ choice . callback . call ( choice , items ) ; } . bind ( this ) , false ) ; node . addEventListener ( "keydown" , function ( event ) { //$NON-NLS-0$ if ( event . keyCode === lib . KEY . ENTER || event . keyCode === lib . KEY . SPACE ) { mMetrics . logEvent ( "command" , "invoke" , this . id + ">" + choice . name ) ; //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-0$ choice . callback . call ( choice , items ) ; } } . bind ( this ) , false ) ; } else { // anything not named is a separator commandService . _generateMenuSeparator ( parent ) ; } } . bind ( this ) ) ; }
Populate the specified menu with choices using the choiceCallback.
Used internally by the command service.  Not intended to be overridden or called
externally.
Populate the specified menu with choices using the choiceCallback . Used internally by the command service . Not intended to be overridden or called externally .