Bug 393814 - remove remaining uses of dijit.BorderContainer -- last item: added the nested resize handler.
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/compare/compare-container.js b/bundles/org.eclipse.orion.client.ui/web/orion/compare/compare-container.js
index aef0aac..30da082 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/compare/compare-container.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/compare/compare-container.js
@@ -430,6 +430,9 @@
 				if(!this.options.diffContent && !this._mapper){
 					this.options.diffContent = "";//SomeDiffEngine.createPatch(this.options.baseFile.Name, this.options.baseFile.Content, this.options.newFile.Content, "", "") ; //$NON-NLS-0$
 				}
+				if(this._onLoadContents){
+					this._onLoadContents();
+				}
 				this.setEditor(onsave);
 				return true;
 			} else {
@@ -690,6 +693,19 @@
 		this._curveRuler.copyToLeft();
 	};
 	
+	TwoWayCompareContainer.prototype.resizeEditors = function(){	
+		if(this._leftTextView){
+			this._leftTextView.resize();
+		}
+		if(this._rightTextView){
+			this._rightTextView.resize();
+		}
+	};
+	
+	TwoWayCompareContainer.prototype.getSplitter = function(){	
+		return this._uiFactory.getSplitter();
+	};
+	
 	TwoWayCompareContainer.prototype.createEditorContainer = function(content , delim , mapper , columnIndex , parentDiv , statusDiv ,readOnly , createLineStyler , fileObj){
 		var that = this;
 		
@@ -708,7 +724,7 @@
 			if(that.onLoad){
 				that.onLoad();
 			}
-			var splitter = that._uiFactory.getSplitter();
+			var splitter = that.getSplitter();
 			if(splitter){
 				var creatingLeft = (columnIndex === 0);
 				splitter.addResizeListener(function(node) {
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js b/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js
index 57229a9..9b2e83d 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js
@@ -605,6 +605,11 @@
 		};
 	}
 	
+	var mainSplitter = null;
+	
+	function getMainSplitter(){
+		return mainSplitter;
+	}
 	/**
 	 * Generates the banner at the top of a page.
 	 * @name orion.globalCommands#generateBanner
@@ -780,33 +785,33 @@
 		});
 
 		// hook up split behavior - the splitter widget and the associated global command/key bindings.
-		var splitter;
 		var splitNode = lib.$(".split"); //$NON-NLS-0$
 		if (splitNode) {
 			var side = lib.$(".sidePanelLayout"); //$NON-NLS-0$
 			var main = lib.$(".mainPanelLayout"); //$NON-NLS-0$
 			if (side && main) {
-				splitter = new mSplitter.Splitter({node: splitNode, sidePanel: side, mainPanel: main, toggle: true});
+				mainSplitter = {side: side, main: main};
+				mainSplitter.splitter = new mSplitter.Splitter({node: splitNode, sidePanel: side, mainPanel: main, toggle: true});
 				var toggleSidePanelCommand = new mCommands.Command({
 					name: messages["Toggle side panel"],
 					tooltip: messages["Open or close the side panel"],
 					id: "orion.toggleSidePane", //$NON-NLS-0$
 					callback: function() {
-						splitter.toggleSidePanel();}
+						mainSplitter.splitter.toggleSidePanel();}
 				});
 				commandService.addCommand(toggleSidePanelCommand);
 				commandService.registerCommandContribution("pageActions", "orion.toggleSidePane", 1, null, true, new mCommands.CommandKeyBinding('o', true)); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
 
 				// editor behavior if needed
 				if (editor) {
-					splitter.addResizeListener(function(node) {
+					mainSplitter.splitter.addResizeListener(function(node) {
 						if (editor && node === main) {
 							editor.getTextView().resize();
 						}
 					});
 					editor.getTextView().setKeyBinding(new mKeyBinding.KeyBinding("o", true), "toggleOutliner"); //$NON-NLS-1$ //$NON-NLS-0$
 					editor.getTextView().setAction("toggleOutliner", function(){ //$NON-NLS-0$
-						splitter.toggleSidePanel();
+						mainSplitter.splitter.toggleSidePanel();
 						return true;
 					}, {name: messages["Toggle Outliner"]});
 				}
@@ -1092,6 +1097,7 @@
 		addSettings: addSettings,
 		generateBanner: generateBanner,
 		getToolbarElements: getToolbarElements,
+		getMainSplitter: getMainSplitter,
 		layoutToolbarElements: layoutToolbarElements,
 		setPageTarget: setPageTarget,
 		setDirtyIndicator: setDirtyIndicator,
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/globalSearch/search-features.js b/bundles/org.eclipse.orion.client.ui/web/orion/globalSearch/search-features.js
index aae0ee9..9fb7c09 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/globalSearch/search-features.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/globalSearch/search-features.js
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*global window define */
 
-define(['orion/webui/littlelib', 'orion/webui/splitter', 'text!orion/globalSearch/search-features.html'], function(lib, splitter, FeatureTemplate) {
+define(['orion/webui/littlelib', 'orion/webui/splitter', 'orion/globalCommands', 'text!orion/globalSearch/search-features.html'], function(lib, splitter, mGlobalCommands, FeatureTemplate) {
 
 
 var orion = orion || {};
@@ -29,12 +29,33 @@
 			var splitNode = lib.$(".replaceSplitLayout", parent); //$NON-NLS-0$
 			splitNode.id = "replaceSplitter"; //$NON-NLS-0$
 			var split = new splitter.Splitter({node: splitNode, sidePanel: top, mainPanel: bottom, vertical: true});
-			// TODO attach a resize listener here that will resize the compare widgets
+			
+			//Here for the h-splitter we only need to resize both editors in the compare widget at the bottom.
+			split.addResizeListener(function(node) {
+				if(node === bottom && this._compareWidget && this._compareWidget.resizeEditors){
+					this._compareWidget.resizeEditors();
+				}
+			}.bind(this));
+			
+			//Here we need the listener to handle the global splitter resize on the RHS only.
+			//We only want the bottom compare widget to ask its splitter: "hey, your position has changed, please simulate a move as if you are dragged".
+			var mainSplitter = mGlobalCommands.getMainSplitter();
+			if(mainSplitter && mainSplitter.splitter){
+				mainSplitter.splitter.addResizeListener(function(node) {
+					if(node === mainSplitter.main && this._compareWidget && this._compareWidget.getSplitter()){
+						this._compareWidget.getSplitter()._adjustToSplitPosition(true);
+					}
+				}.bind(this));
+			}
 		},
 		
 		destroy: function(){
 		},
 		
+		setCompareWidget: function(compareWidget){
+			this._compareWidget = compareWidget;
+		},
+		
 		getMatchDivID: function(){
 			return "replaceTop"; //$NON-NLS-0$
 		},
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/searchExplorer.js b/bundles/org.eclipse.orion.client.ui/web/orion/searchExplorer.js
index 38c18d1..a1ba0aa 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/searchExplorer.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/searchExplorer.js
@@ -1261,7 +1261,7 @@
 				});
 				that.uiFactoryCompare.buildUI();
 				that.twoWayCompareContainer = new mCompareContainer.TwoWayCompareContainer(that.registry, uiFactory.getCompareDivID(), that.uiFactoryCompare, options);
-				that.twoWayCompareContainer.startup();
+				that.twoWayCompareContainer.startup(false, function(){that._uiFactory.setCompareWidget(that.twoWayCompareContainer);});
 			} else {
 				_empty(that.uiFactoryCompare.getTitleDiv());
 				_place(document.createTextNode(i18nUtil.formatMessage(messages['Replaced File (${0})'], fileItem.name)), that.uiFactoryCompare.getTitleDiv(), "only"); //$NON-NLS-1$