| author | Malgorzata Janczarska | 2011-05-25 10:14:54 (EDT) |
|---|---|---|
| committer | Malgorzata Janczarska | 2011-05-25 10:14:54 (EDT) |
| commit | 4e93ce43dc07a0fbb5b014528db4bf94d6f711cd (patch) (side-by-side diff) | |
| tree | b97252ec5b7b173108174b2758ee99549c422b9b | |
| parent | 979f64ba72a0489df2dc32bd69c7e39d372eb7b4 (diff) | |
| download | org.eclipse.orion.client-4e93ce43dc07a0fbb5b014528db4bf94d6f711cd.zip org.eclipse.orion.client-4e93ce43dc07a0fbb5b014528db4bf94d6f711cd.tar.gz org.eclipse.orion.client-4e93ce43dc07a0fbb5b014528db4bf94d6f711cd.tar.bz2 | |
Bug 346972 - [client] Do not collapse the clone tree after
adding/checking a branch
Change-Id: I8d2e6c9a9f4f12d332dcc677422ba2a78dc5d6de
3 files changed, 34 insertions, 15 deletions
diff --git a/bundles/org.eclipse.orion.client.core/static/js/treetable.js b/bundles/org.eclipse.orion.client.core/static/js/treetable.js index a294e85..4dcb6cc 100644 --- a/bundles/org.eclipse.orion.client.core/static/js/treetable.js +++ b/bundles/org.eclipse.orion.client.core/static/js/treetable.js @@ -138,10 +138,18 @@ eclipse.TableTree = (function() { if (row && (forceExpand || row._expanded)) { row._expanded = true; this._removeChildRows(parentId); - this._generateChildren(children, row._depth+1, row, "after"); - this._rowsChanged(); - if (imgName && imageSrc) { - document.images[imgName].src=imageSrc; + if(children){ + this._generateChildren(children, row._depth+1, row, "after"); + this._rowsChanged(); + if (imgName && imageSrc) { + document.images[imgName].src=imageSrc; + } + } else { + tree = this; + children = this._treeModel.getChildren(row._item, function(children) { + tree._generateChildren(children, row._depth+1, row, "after"); + tree._rowsChanged(); + }); } } } else { 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 d206598..3100183 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 @@ -102,6 +102,9 @@ eclipse.GitClonesModel = (function() { GitClonesModel.prototype.getChildren = function(/* dojo.data.Item */ parentItem, /* function(items) */ onComplete){
// the parent already has the children fetched
if (parentItem.Children) {
+ for(var i=0; i<parentItem.Children.length; i++){
+ parentItem.Children[i].parent = parentItem;
+ }
onComplete(parentItem.Children);
}
else if (parentItem.BranchLocation || parentItem.RemoteLocation){
@@ -110,6 +113,9 @@ eclipse.GitClonesModel = (function() { else if (parentItem.GroupNode){
this.gitClient.getGitBranch(parentItem.Location).then(
dojo.hitch(this, function(children) {
+ for(var i=0; i<children.Children.length; i++){
+ children.Children[i].parent = parentItem;
+ }
onComplete(children.Children);
})
);
@@ -117,6 +123,9 @@ eclipse.GitClonesModel = (function() { else if (parentItem.Type === "Remote"){
this.gitClient.getGitBranch(parentItem.Location).then(
dojo.hitch(this, function(children) {
+ for(var i=0; i<children.Children.length; i++){
+ children.Children[i].parent = parentItem;
+ }
onComplete(children.Children);
})
);
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 2a70ce5..2aab650 100644 --- a/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js +++ b/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js @@ -240,14 +240,15 @@ dojo.require("widgets.GitCredentialsDialog"); callback: function(item) {
serviceRegistry.getService("IGitService").then(
function(service) {
- service.checkoutBranch(item.CloneLocation, item.Name);
- // TODO: we need a nicer way to refresh clones' list and show the new active branch
- explorer.redisplayClonesList();
+ service.checkoutBranch(item.CloneLocation, item.Name).then(
+ function(){
+ dojo.hitch(explorer, explorer.changedItem)(item.parent);
+ });
}
);
},
visibleWhen: function(item) {
- return item.Type === "Branch";
+ return item.Type === "Branch" && !item.Current;
}}
);
commandService.addCommand(checkoutBranchCommand, "object");
@@ -260,9 +261,9 @@ dojo.require("widgets.GitCredentialsDialog"); var branchName = prompt("Enter branch name");
serviceRegistry.getService("IGitService").then(
function(service) {
- service.addBranch(item.Location, branchName);
- // TODO: we need a nicer way to refresh clones' list and show the new active branch
- explorer.redisplayClonesList();
+ service.addBranch(item.Location, branchName).then(function(){
+ dojo.hitch(explorer, explorer.changedItem)(item);
+ });
}
);
},
@@ -279,14 +280,15 @@ dojo.require("widgets.GitCredentialsDialog"); callback: function(item) {
serviceRegistry.getService("IGitService").then(
function(service) {
- service.removeBranch(item.Location);
- // TODO: we need a nicer way to refresh clones' list and show the new active branch
- explorer.redisplayClonesList();
+ service.removeBranch(item.Location).then(
+ function(){
+ dojo.hitch(explorer, explorer.changedItem)(item.parent);
+ });
}
);
},
visibleWhen: function(item) {
- return item.Type === "Branch";
+ return item.Type === "Branch" && !item.Current;
}}
);
commandService.addCommand(removeBranchCommand, "object");
|

