Merge branch 'master' of ssh://git.eclipse.org/gitroot/e4/org.eclipse.orion.client
diff --git a/bundles/org.eclipse.orion.client.core/static/js/compare/compare-container.js b/bundles/org.eclipse.orion.client.core/static/js/compare/compare-container.js
index 43ce9ef..8035c9c 100644
--- a/bundles/org.eclipse.orion.client.core/static/js/compare/compare-container.js
+++ b/bundles/org.eclipse.orion.client.core/static/js/compare/compare-container.js
@@ -24,7 +24,7 @@
 			return delim;
 		},
 		
-		getFileDiffGit: function(diffURI , callBack){
+		getFileDiffGit: function(diffURI , callBack , errorCallBack){
 			var self = this;
 			if(diffURI === null || diffURI === undefined){
 				self.setEditor("" ,self.fileContent);
@@ -46,14 +46,15 @@
 						callBack();
 				},
 				error: function(response, ioArgs) {
-					console.error("HTTP status code: ", ioArgs.xhr.status);
+					if(errorCallBack)
+						errorCallBack(response,ioArgs);
 					handleGetAuthenticationError(this, ioArgs);
 					return response;
 				}
 			});
 		},
 		
-		getFileContent: function(diffURI ,fileURI , callBack){
+		getFileContent: function(diffURI ,fileURI , callBack, errorCallBack){
 			var self = this;
 			dojo.xhrGet({
 				url: fileURI, 
@@ -64,10 +65,11 @@
 				timeout: 15000,
 				load: function(jsonData, ioArgs) {
 					self.fileContent = jsonData;
-					self.getFileDiffGit(diffURI , callBack);
+					self.getFileDiffGit(diffURI , callBack , errorCallBack);
 				},
 				error: function(response, ioArgs) {
-					console.error("HTTP status code: ", ioArgs.xhr.status);
+					if(errorCallBack)
+						errorCallBack(response,ioArgs);
 					handleGetAuthenticationError(this, ioArgs);
 					return response;
 				}
@@ -84,8 +86,8 @@
 			return {delim:delim , mapper:result.mapper , output:result.outPutFile ,diffArray:diffArray};
 		},
 		
-		resolveDiff: function(diffURI ,fileURI , callBack){
-			this.getFileContent(diffURI ,fileURI , callBack);
+		resolveDiff: function(diffURI ,fileURI , callBack , errorCallBack){
+			this.getFileContent(diffURI ,fileURI , callBack , errorCallBack);
 		},
 				
 		_initDiffPosition: function(editor){
diff --git a/bundles/org.eclipse.orion.client.core/static/js/compare/compare-glue.js b/bundles/org.eclipse.orion.client.core/static/js/compare/compare-glue.js
index 16a0504..93dcec6 100644
--- a/bundles/org.eclipse.orion.client.core/static/js/compare/compare-glue.js
+++ b/bundles/org.eclipse.orion.client.core/static/js/compare/compare-glue.js
@@ -14,7 +14,7 @@
 	var searcher = new eclipse.Searcher({serviceRegistry: serviceRegistry});

 

 	eclipse.globalCommandUtils.generateBanner("toolbar", commandService, preferenceService, searcher);

-	var sBSCompareContainerEditor = new orion.SBSCompareContainer("left-viewer" , "right-viewer");

+	var sBSCompareContainer = new orion.SBSCompareContainer("left-viewer" , "right-viewer");

 	var splitted = window.location.href.split('#');

 	if(splitted.length > 1){

 		var hash = splitted[1];

@@ -28,14 +28,20 @@
 			diffURI = params[0];

 		}

 		

-		sBSCompareContainerEditor.resolveDiff(diffURI, 

+		sBSCompareContainer.resolveDiff(diffURI, 

 											  fileURI,

 				  function(){

-					var leftTH = document.getElementById("left-viewer-title");

-					var rightTH = document.getElementById("right-viewer-title");

-					leftTH.innerHTML = "File  : " + fileURI;

-					rightTH.innerHTML = "File On Git : " + fileURI;

-				  });

+					  dojo.place(document.createTextNode("File: " + fileURI), "left-viewer-title", "only");				  

+					  dojo.place(document.createTextNode("File On Git: " + fileURI), "right-viewer-title", "only");				  

+				  },

+				  function(errorResponse , ioArgs){

+					  var message = typeof(errorResponse.message) === "string" ? errorResponse.message : ioArgs.xhr.statusText; 

+					  dojo.place(document.createTextNode(message), "left-viewer-title", "only");				  

+					  dojo.place(document.createTextNode(message), "right-viewer-title", "only");				  

+					  dojo.style("left-viewer-title", "color", "red");

+					  dojo.style("right-viewer-title", "color", "red");

+				  }

+		);

 	}

 	

 });

diff --git a/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js b/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js
index 91851be..34ee9b4 100644
--- a/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js
+++ b/bundles/org.eclipse.orion.client.core/static/js/git-status/git-status-table.js
@@ -239,7 +239,7 @@
 			var progressMessage = document.createElement('h2');
 			dojo.place(document.createTextNode(message), progressMessage, "only");
 			progressDiv.appendChild(progressMessage);
-			
+			return progressMessage;
 		},
 		
 		_createProgressDivCenter: function(progressParentId , progressId,message){
@@ -372,7 +372,11 @@
 					                                function(){					
 														dojo.place(document.createTextNode(message), "fileNameInViewer", "only");
 														self.cursorClear();
-													});
+													},
+													function(response, ioArgs){
+														self.handleServerErrors(response , ioArgs);
+													}
+			);
 		},
 		
 		openSBSViewer: function(itemModel){
@@ -388,6 +392,17 @@
 				this.stage(eclipse.util.makeRelative(location));
 		},
 		
+		handleServerErrors: function(errorResponse , ioArgs){
+		  	this._inlineCompareContainer.destroyEditor();
+			dojo.place(document.createTextNode("Compare..."), "fileNameInViewer", "only");
+			this.removeProgressDiv("inline-compare-viewer"  , "compareIndicatorId");
+			var message = typeof(errorResponse.message) === "string" ? errorResponse.message : ioArgs.xhr.statusText; 
+			var errorDiv = this.createProgressDiv("inline-compare-viewer"  , "compareIndicatorId" , message);
+			dojo.style(errorDiv, "color", "red");
+			this.cursorClear();
+		},
+		
+		
 		getGitStatus: function(url){
 			this.cursorWait();
 			var self = this;
@@ -403,7 +418,7 @@
 					self.loadStatus(jsonData);
 				},
 				error: function(response, ioArgs) {
-					console.error("HTTP status code: ", ioArgs.xhr.status);
+					self.handleServerErrors(response, ioArgs);
 					handleGetAuthenticationError(this, ioArgs);
 					return response;
 				}
@@ -421,11 +436,10 @@
 				handleAs: "json",
 				timeout: 5000,
 				load: function(jsonData, ioArgs) {
-					//console.log(JSON.stringify(jsonData));
-					self.getGitStatus(self._url);;
+					self.getGitStatus(self._url);
 				},
 				error: function(response, ioArgs) {
-					console.error("HTTP status code: ", ioArgs.xhr.status);
+					self.handleServerErrors(response, ioArgs);
 					handleGetAuthenticationError(this, ioArgs);
 					return response;
 				}
@@ -434,8 +448,13 @@
 		
 		stageAll: function(){
 			var start = this._url.indexOf("/file/");
-			if(start != -1)
-				this.stage(this._url.substring(start));
+			if(start != -1){
+				var sub = this._url.substring(start);
+				var subSlitted = sub.split("/");
+				if(subSlitted.length > 2){
+					this.stage([subSlitted[0] , subSlitted[1] , subSlitted[2]].join("/") );
+				}
+			}
 		},
 		
 		unstage: function(location){
@@ -454,7 +473,7 @@
 					self.getGitStatus(self._url);;
 				},
 				error: function(response, ioArgs) {
-					console.error("HTTP status code: ", ioArgs.xhr.status);
+					self.handleServerErrors(response, ioArgs);
 					handleGetAuthenticationError(this, ioArgs);
 					return response;
 				}
@@ -479,11 +498,10 @@
 				timeout: 5000,
 				postData: body,
 				load: function(jsonData, ioArgs) {
-					//console.log(JSON.stringify(jsonData));
 					self.getGitStatus(self._url);;
 				},
 				error: function(response, ioArgs) {
-					console.error("HTTP status code: ", ioArgs.xhr.status);
+					self.handleServerErrors(response, ioArgs);
 					handleGetAuthenticationError(this, ioArgs);
 					return response;
 				}