Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370751 - Renaming a file attempts to traverse into it
Summary: Renaming a file attempts to traverse into it
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.4   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 0.4 RC1   Edit
Assignee: libing wang CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 13:35 EST by John Arthorne CLA
Modified: 2012-02-13 14:23 EST (History)
2 users (show)

See Also:
john.arthorne: review+


Attachments
patch file (2.28 KB, patch)
2012-02-13 13:26 EST, libing wang CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2012-02-06 13:35:50 EST
This bug introduced by new keybinding traversal in the Navigator..

1) Next to a file, select "Rename"
2) Type a new name and hit Enter to confirm

-> The rename occurs, but it attempts to traverse into the link to the old file name. You end up after the rename on a 404 page.
Comment 1 libing wang CLA 2012-02-13 10:17:19 EST
I think the key event is bubbled up to the parent div. I need to check for bubbled event.
Comment 2 libing wang CLA 2012-02-13 13:09:32 EST
I've got a patch here, better to put it into RC1 if possible.

diff --git a/bundles/org.eclipse.orion.client.core/web/orion/explorer-table.js b/bundles/org.eclipse.orion.client.core/web/orion/explorer-table.js
index 3cb489f..da0f56a 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/explorer-table.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/explorer-table.js
@@ -237,6 +237,10 @@
 		var self = this;
 		this.fileClient.fetchChildren(parent.ChildrenLocation).then(function(children) {
 			mUtil.processNavigatorParent(parent, children);
+			//If a key board navigator is hooked up, we need to sync up the model
+			if(self.navHandler){
+				self.navHandler.refreshModel(self.model);
+			}
 			dojo.hitch(self.myTree, self.myTree.refreshAndExpand)(parent, children, self.renderer.expandCollapseImageId(self.model.getId(parent)), self.renderer._expandImageClass, self.renderer._collapseImageClass);
 		});
 	};
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/explorerNavHandler.js b/bundles/org.eclipse.orion.client.core/web/orion/explorerNavHandler.js
index dcaf689..5c22449 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/explorerNavHandler.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/explorerNavHandler.js
@@ -51,6 +51,15 @@
 	    var parentDiv = this._getEventListeningDiv();
 	    parentDiv.focus();
 		var keyListener = dojo.connect(parentDiv, "onkeydown", dojo.hitch(this, function (e) {
+            if (e.target) {// Firefox,  Chrome and Safari
+                if(e.target !== parentDiv){
+    				return true;
+    			}
+            } else if (e.srcElement){// Internet Explorer
+                if(e.srcElement !== parentDiv){
+    				return true;
+    			}
+            }
 			if(this.explorer.preventDefaultFunc && this.explorer.preventDefaultFunc(e, this._modelIterator.cursor())){
 				return true;
 			}
@@ -136,8 +145,6 @@
 		},
 		
 		refreshModel: function(model, noReset){
-		    var parentDiv = this._getEventListeningDiv();
-		    parentDiv.focus();
 			this.topIterationNodes = [];
 			this.model = model;
 			if(this.model.getTopIterationNodes){
Comment 3 libing wang CLA 2012-02-13 13:11:06 EST
BTW, there was an existing bug 364725 targeted for 0.5 , which has nothing to do with the fix.
Comment 4 libing wang CLA 2012-02-13 13:26:06 EST
Created attachment 210931 [details]
patch file

patch
Comment 5 John Arthorne CLA 2012-02-13 14:00:07 EST
Tested the fix self-hosting on orion.eclipse.org and it looks good.
Comment 6 Susan McCourt CLA 2012-02-13 14:04:15 EST
Just to be clear.  The bug has different symptoms depending on where you are.
When I tried to rename a file/folder that is in an expanded node in the hierarchy, the rename takes me to some "random" place (another project in the respository).   If I do the rename at the root level, it takes me to the "not found."
Comment 7 Susan McCourt CLA 2012-02-13 14:06:04 EST
tested both cases, fix looks good.