Merge remote-tracking branch 'origin/master'
diff --git a/bundles/org.eclipse.orion.client.git/static/git-log.html b/bundles/org.eclipse.orion.client.git/static/git-log.html
index 3772e52..349391a 100644
--- a/bundles/org.eclipse.orion.client.git/static/git-log.html
+++ b/bundles/org.eclipse.orion.client.git/static/git-log.html
@@ -27,6 +27,7 @@
 	dojo.require("dijit.form.CheckBox");

 	dojo.require("widgets.OpenResourceDialog");

  	dojo.require("widgets.eWebBorderContainer");

+	dojo.require("widgets.NewItemDialog");

  	</script>    	

 	

     <script type="text/javascript" src="/openajax/release/all/OpenAjaxManagedHub-all.js"></script>

diff --git a/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clone.js b/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clone.js
index bd662b5..1a064dc 100644
--- a/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clone.js
+++ b/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clone.js
@@ -24,7 +24,6 @@
 	new eclipse.UserService(serviceRegistry);

 	var selection = new orion.Selection(serviceRegistry);

 	new eclipse.SshService(serviceRegistry);

-	var fileClient = new eclipse.FileClient(serviceRegistry, pluginRegistry);

 	var preferenceService = new eclipse.PreferencesService(serviceRegistry, "/prefs/user");

 	var commandService = new eclipse.CommandService({serviceRegistry: serviceRegistry});

 	

@@ -51,26 +50,72 @@
 	commandService.registerCommandContribution("eclipse.orion.git.merge", 2);

 	commandService.registerCommandContribution("eclipse.orion.git.push", 2);

 	

-	serviceRegistry.getService("orion.core.file").then(function(fileService){

-	fileService.loadWorkspace().then(

-		function(workspace){

-			var explorer = new eclipse.git.GitClonesExplorer(serviceRegistry, selection, workspace.Location, "clonesList", "pageActions", "selectionTools");

+	var explorer = new eclipse.git.GitClonesExplorer(serviceRegistry, selection, "clonesList", "pageActions", "selectionTools");

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

 	

-			// global commands

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

-			eclipse.gitCommandUtils.createFileCommands(serviceRegistry, commandService, explorer, "pageActions", "selectionTools");

-			eclipse.gitCommandUtils.createGitClonesCommands(serviceRegistry, commandService, explorer, "pageActions", "selectionTools");

 	

-			eclipse.gitCommandUtils.updateNavTools(serviceRegistry, explorer, "pageActions", "selectionTools", {});

+	var fileServices = serviceRegistry.getServiceReferences("orion.core.file");

 	

-			explorer.displayClonesList(dojo.hash());

-				

-			//every time the user manually changes the hash, we need to load the workspace with that name

-			dojo.subscribe("/dojo/hashchange", explorer, function() {

-			   explorer.displayClonesList(dojo.hash());

-			});

+	function emptyArray() {

+		var d = new dojo.Deferred();

+		d.callback([]);

+		return d;

+	}

+	function emptyObject() {

+		var d = new dojo.Deferred();

+		d.callback({});

+		return d;

+	}

+	var topLevelFileService = {

+		fetchChildren: emptyArray,

+		createWorkspace: emptyObject,

+		loadWorkspaces: emptyArray,

+		loadWorkspace: function(location) {

+			var d = new dojo.Deferred();

+			d.callback({Children: topLevel});

+			return d;

+		},

+		createProject: emptyObject,

+		createFolder: emptyObject,

+		createFile: emptyObject,

+		deleteFile: emptyObject,

+		moveFile: emptyObject,

+		copyFile: emptyObject,

+		read: emptyObject,

+		write: emptyObject

+	};

 

-		}

-	);

+	var fileClient = new eclipse.FileClient(topLevelFileService);

+	

+	var deferred;

+	if (fileServices[0]) {

+		deferred = serviceRegistry.getService(fileServices[0]);

+	} else {

+		deferred = { then: function(callback) { callback(topLevelFileService); } };

+	}

+	deferred.then(function(fileService) {

+		fileClient.setFileService(fileService);

+		fileClient.loadWorkspace().then(

+				function(workspace){

+					explorer.setDefaultPath(workspace.Location);

+			

+					// global commands

+					eclipse.gitCommandUtils.createFileCommands(serviceRegistry, commandService, explorer, "pageActions", "selectionTools");

+					eclipse.gitCommandUtils.createGitClonesCommands(serviceRegistry, commandService, explorer, "pageActions", "selectionTools");

+			

+					eclipse.gitCommandUtils.updateNavTools(serviceRegistry, explorer, "pageActions", "selectionTools", {});

+			

+					explorer.displayClonesList(dojo.hash());

+						

+					//every time the user manually changes the hash, we need to load the workspace with that name

+					dojo.subscribe("/dojo/hashchange", explorer, function() {

+					   explorer.displayClonesList(dojo.hash());

+					});

+

+				}

+			);

+		

 	});

+	

+	

 });

diff --git a/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clones-explorer.js b/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clones-explorer.js
index 727d88a..709cb55 100644
--- a/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clones-explorer.js
+++ b/bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clones-explorer.js
@@ -15,13 +15,12 @@
 

 eclipse.git.GitClonesExplorer = (function() {

 	

-	function GitClonesExplorer(registry, selection, defaultPath, parentId, toolbarId, selectionToolsId){

+	function GitClonesExplorer(registry, selection, parentId, toolbarId, selectionToolsId){

 		this.parentId = parentId;

 		this.registry = registry;

 		this.selection = selection;

 		this.toolbarId = toolbarId;

 		this.selectionToolsId = selectionToolsId;

-		this.defaultPath = defaultPath;

 		this.renderer = new eclipse.git.GitClonesRenderer({checkbox: this.checkbox}, this);

 		

 	}

@@ -31,6 +30,10 @@
 		return "/git/clone/"+eclipse.util.makeRelative(path);

 	};

 	

+	GitClonesExplorer.prototype.setDefaultPath = function(defaultPath){

+		this.defaultPath = defaultPath;

+	};

+	

 	GitClonesExplorer.prototype.displayClonesList = function(path){

 		

 			var self = this;

@@ -182,7 +185,7 @@
 				dojo.place(document.createTextNode(item.Name), link, "only");

 			} else if (item.Type === "Branch"){

 				col = document.createElement('td');

-				div = dojo.create("div", null, col, "only");

+				div = dojo.create("div", {style: "margin-left: 10px"}, col, "only");

 				

 				link = dojo.create("a", {innerHTML: item.Name, className: "navlinkonpage"}, div, "last");

 				if (item.Current)

@@ -201,7 +204,7 @@
 				dojo.place(document.createTextNode(item.Name), link, "only");

 			} else if (item.Type === "RemoteTrackingBranch"){

 				col = document.createElement('td');

-				div = dojo.create("div", null, col, "only");

+				div = dojo.create("div", {style: "margin-left: 10px"}, col, "only");

 								

 				link = dojo.create("a", {innerHTML: item.Name, className: "navlinkonpage"}, div, "last");

 								

diff --git a/bundles/org.eclipse.orion.client.git/static/js/git-commit-details.js b/bundles/org.eclipse.orion.client.git/static/js/git-commit-details.js
index 0f2fc8f..037be9a 100644
--- a/bundles/org.eclipse.orion.client.git/static/js/git-commit-details.js
+++ b/bundles/org.eclipse.orion.client.git/static/js/git-commit-details.js
@@ -39,7 +39,7 @@
 			image: "images/compare-sbs.gif",
 			id: "eclipse.showDiff",
 			hrefCallback: function(item) {
-				return "/compare/compare.html?readonly#" + item.object.DiffLocation;
+				return "/compare/compare.html?readonly#" + item.DiffLocation;
 			},
 			visibleWhen: function(item) {
 				return item.dom == "commitDiffsTable";
diff --git a/bundles/org.eclipse.orion.client.git/static/js/git-commit-navigator.js b/bundles/org.eclipse.orion.client.git/static/js/git-commit-navigator.js
index a0fee22..4cc4a82 100644
--- a/bundles/org.eclipse.orion.client.git/static/js/git-commit-navigator.js
+++ b/bundles/org.eclipse.orion.client.git/static/js/git-commit-navigator.js
@@ -169,7 +169,8 @@
 			return dojo.create("td", {style: "padding-left: 5px; padding-right: 5px", innerHTML: dojo.date.locale.format(new Date(item.Time), {formatLength: "short"})});
 			break;
 		case 3:
-			var actionsColumn = this.getActionsColumn({dom: "explorer-tree", object: item}, tableRow);
+			item.dom = "explorer-tree";
+			var actionsColumn = this.getActionsColumn(item, tableRow);
 			dojo.style(actionsColumn, "padding-left", "5px");
 			dojo.style(actionsColumn, "padding-right", "5px");
 			return actionsColumn;
diff --git a/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js b/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js
index 2580cf7..1d1982a 100644
--- a/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js
+++ b/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js
@@ -392,7 +392,7 @@
 			image : "/images/compare-sbs.gif",

 			id : "eclipse.compareWithWorkingTree",

 			hrefCallback : function(item) {

-				return "/compare/compare.html#" + item.object.DiffLocation;

+				return "/compare/compare.html#" + item.DiffLocation;

 			},

 			visibleWhen : function(item) {

 				// show only for commits in the git log list

@@ -407,11 +407,11 @@
 			image : "/images/find.gif",

 			id : "eclipse.openGitCommit",

 			hrefCallback: function(item) {

-				return "/edit/edit.html#" + item.object.ContentLocation;

+				return "/edit/edit.html#" + item.ContentLocation;

 			},

 			visibleWhen : function(item) {

 				// show only for commits in the git log list

-				return item.dom === "explorer-tree" && item.object.ContentLocation != null && !explorer.isDirectory;

+				return item.dom === "explorer-tree" && item.ContentLocation != null && !explorer.isDirectory;

 			}

 		});

 	

@@ -567,17 +567,28 @@
 			id : "eclipse.orion.git.addTag",

 			callback : function(item) {

 				var clientDeferred = new dojo.Deferred();

-				var tagName = prompt("Enter tage name");

-				serviceRegistry.getService("orion.git.provider").then(

-						function(service) {

-							service.doAddTag(item.object.Location, tagName,

-								function(jsonData, secondArg) {

-									var trId = jsonData.Location.replace(/[^\.\:\-\_0-9A-Za-z]/g, "");

-									var tr = dojo.byId(trId);

-									dojo.place(document.createTextNode(tagName), dojo.create("p", {style: "margin: 5px"}, tr.children[2] /* tags column */, "last"), "only");

+				

+				var dialog = new widgets.NewItemDialog({

+					title: "Tag",

+					label: "Tag name:",

+					func:  function(tagName){

+						serviceRegistry.getService("orion.git.provider").then(

+								function(service) {

+									service.doAddTag(item.Location, tagName,

+										function(jsonData, secondArg) {

+											var trId = jsonData.Location.replace(/[^\.\:\-\_0-9A-Za-z]/g, "");

+											var tr = dojo.byId(trId);

+											dojo.place(document.createTextNode(tagName), dojo.create("p", {style: "margin: 5px"}, tr.children[5] /* tags column */, "last"), "only");

+										});

 								});

-						});

-				return clientDeferred;

+						return clientDeferred;

+					},

+					advanced: false

+				});

+				dialog.startup();

+				dialog.show();

+				

+

 			},

 			visibleWhen : function(item) {

 				// show only for commits in the git log list