Bug 379811 - Compare widget actions in explorer - grid navigation
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/commands.js b/bundles/org.eclipse.orion.client.core/web/orion/commands.js
index a90b6cb..4bc82be 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/commands.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/commands.js
@@ -922,9 +922,9 @@
 								command._addTool(parent, id, invocation, domNodeWrapperList);	
 							} else if (renderType === "button") {
 								id = "button" + command.id + i;  // using the index ensures unique ids within the DOM when a command repeats for each item
-								command._addButton(parent, id, invocation);	
+								command._addButton(parent, id, invocation, domNodeWrapperList);	
 							} else if (renderType === "menu") {
-								command._addMenuItem(parent, invocation);
+								command._addMenuItem(parent, invocation, domNodeWrapperList);
 							}
 						}
 					} 
@@ -1068,7 +1068,7 @@
 				dojo.addClass(element, "commandMargins");
 			}
 			dojo.place(element, parent, "last");
-			mNavUtils.generateNavGrid(domNodeWrapperList, element);
+			mNavUtils.generateNavGrid(domNodeWrapperList, context.domNode);
 		},
 	
 		/*
@@ -1076,7 +1076,7 @@
 		 *  For href commands, this is just a link.
 		 *  For non-href commands, this is a text button.  If there is no name, use an image.
 		 */
-		_addButton: function(parent, name, context) {
+		_addButton: function(parent, name, context, domNodeWrapperList) {
 			context.handler = context.handler || this;
 			var element;
 			if (this.hrefCallback) {
@@ -1119,8 +1119,9 @@
 				dojo.addClass(element, "commandMargins");
 			}
 			dojo.place(element, parent, "last");
+			mNavUtils.generateNavGrid(domNodeWrapperList, context.domNode);
 		},
-		_addMenuItem: function(parent, context) {
+		_addMenuItem: function(parent, context, domNodeWrapperList) {
 			context.domParent = parent.domNode;
 			var menuitem = new CommandMenuItem({
 				labelType: this.hrefCallback ? "html" : "text",
@@ -1179,7 +1180,7 @@
 				menuitem.iconNode.src = this.image;
 			}
 			context.domNode = menuitem.domNode;
-
+			mNavUtils.generateNavGrid(domNodeWrapperList, context.domNode);
 		},
 		
 		/*
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js b/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js
index 9c19ee2..89a1761 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/compare/compare-container.js
@@ -129,6 +129,7 @@
 				this.options.mapper = options.mapper ? options.mapper : this.options.mapper;
 				
 				this.options.commandSpanId = typeof(options.commandSpanId) === "string" ? options.commandSpanId : this.options.commandSpanId;
+				this.options.navGridHolder = options.navGridHolder || this.options.navGridHolder;
 				this.options.readonly = (options.readonly !== undefined &&  options.readonly !== null) ? options.readonly : this.options.readonly;
 				this.options.wordLevelNav = (options.wordLevelNav !== undefined &&  options.wordLevelNav !== null) ? options.wordLevelNav : this.options.wordLevelNav;
 				this.options.charDiff = (options.charDiff !== undefined &&  options.charDiff !== null) ? options.charDiff : this.options.charDiff;
@@ -282,7 +283,7 @@
 				return;
 			}
 			dojo.empty(commandSpanId);
-			this._commandService.renderCommands(commandSpanId, commandSpanId, this, this, "button");
+			this._commandService.renderCommands(commandSpanId, commandSpanId, this, this, "button", null, this.options.navGridHolder);
 		},
 		
 		generateLink: function(){	
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
index 529ebdd..3857e39 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitStatusExplorer.js
@@ -418,10 +418,11 @@
 							mNavUtils.addNavGrid(this.explorer.getNavDict(), item, div);

 

 							dojo.create( "div", { "id":"diffArea_" + item.diffUri, "style":"height:420px; border:1px solid lightgray; overflow: hidden"}, div);

+							var navGridHolder = this.explorer.getNavDict() ? this.explorer.getNavDict().getGridNavHolder(item.parent, true) : null;

 							window.setTimeout(function(){

 								var diffProvider = new mCompareContainer.DefaultDiffProvider(that.registry);

-								

 								var diffOptions = {

+									navGridHolder: navGridHolder,

 									commandSpanId: "unstaged"+item.parent.name+"compareActionWrapper",

 									diffProvider: diffProvider,

 									hasConflicts: false,

@@ -592,11 +593,12 @@
 							mNavUtils.addNavGrid(this.explorer.getNavDict(), item, div);

 

 							dojo.create( "div", { "id":"diffArea_" + item.diffUri, "style":"height:420px; border:1px solid lightgray; overflow: hidden"}, div);

-

+							var navGridHolder = this.explorer.getNavDict() ? this.explorer.getNavDict().getGridNavHolder(item.parent, true) : null;

 							window.setTimeout(function(){

 								var diffProvider = new mCompareContainer.DefaultDiffProvider(that.registry);

 								

 								var diffOptions = {

+									navGridHolder: navGridHolder,

 									commandSpanId: "staged" + item.parent.name + "compareActionWrapper",

 									diffProvider: diffProvider,

 									hasConflicts: false,

@@ -682,6 +684,7 @@
 			var diffProvider = new mCompareContainer.DefaultDiffProvider(this.registry);

 			

 			var diffOptions = {

+				navGridHolder: (this.getNavDict() ? this.getNavDict().getGridNavHolder(change, true) : null),

 				commandSpanId: diffSection.actionsNode.id,

 				diffProvider: diffProvider,

 				hasConflicts: false,