summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMalgorzata Janczarska2011-05-26 11:02:11 (EDT)
committer Malgorzata Janczarska2011-05-26 11:02:11 (EDT)
commit0ad8f02c08d56f99b2a62d2eb6f9d121d268e9ca (patch)
treeec44982af45f83029317cf7228e78048a508345a
parentadfd1f82afa24a5ead7459197afbe836a0ba58a4 (diff)
downloadorg.eclipse.orion.client-0ad8f02c08d56f99b2a62d2eb6f9d121d268e9ca.zip
org.eclipse.orion.client-0ad8f02c08d56f99b2a62d2eb6f9d121d268e9ca.tar.gz
org.eclipse.orion.client-0ad8f02c08d56f99b2a62d2eb6f9d121d268e9ca.tar.bz2
Bug 347030 - [client] git clone page didn't load when I wasn't logged
in, but didn't ask for login either Change-Id: I5f9e3736e9b6012958cc1f4136faae8cf07068d4
-rw-r--r--bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clone.js81
-rw-r--r--bundles/org.eclipse.orion.client.git/static/js/git-clone/git-clones-explorer.js7
2 files changed, 68 insertions, 20 deletions
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 @@ dojo.addOnLoad(function(){
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 @@ dojo.addOnLoad(function(){
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..cedc420 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 = eclipse.git || {};
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 @@ eclipse.git.GitClonesExplorer = (function() {
return "/git/clone/"+eclipse.util.makeRelative(path);
};
+ GitClonesExplorer.prototype.setDefaultPath = function(defaultPath){
+ this.defaultPath = defaultPath;
+ };
+
GitClonesExplorer.prototype.displayClonesList = function(path){
var self = this;