Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 428211

Summary: Readonly file widget: need to render checked branch/component in the selector's drop down.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mamacdon
Version: 5.0Flags: mamacdon: review+
Target Milestone: 5.0 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2014-02-14 11:20:07 EST
Currently in the branch/component selector's drop down, there is no no checked mark for the current selected branch/component. We need to add the check mark for better UX.
Comment 1 libing wang CLA 2014-02-14 11:23:41 EST
Proposed fix patch. The patch only affects the widget itself. As the checked item drop down support was already in. The widget just consumes the feature.

diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/fileBrowser.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/fileBrowser.js
index 4d4acf8..0272474 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/fileBrowser.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/fileBrowser.js
@@ -159,7 +159,9 @@
 					this.refresh(new URITemplate("{,resource}").expand({resource:currentComponentLocation}));
 				}
 			}
-			this._componentSelector.activeResourceName = this._componentSelector.getActiveResource(currentComponentLocation).Name;
+			var activeComp = this._componentSelector.getActiveResource(currentComponentLocation);
+			this._componentSelector.activeResourceName = activeComp.Name;
+			this._componentSelector.activeResourceLocation = activeComp.Location;
 			this._componentSelector.refresh();
 		}.bind(this)); 
 		this._init(options);
@@ -256,6 +258,7 @@
 						this._activeBranchLocation = this._activeBranchLocation || this._branches[0].Location;
 					}
 					this._branchSelector.activeResourceName = activeBranchName;
+					this._branchSelector.activeResourceLocation = this._activeBranchLocation;
 					
 					if(this._showComponent) {
 						this._branchSelector.setActiveResource({resource: this._branchSelector.getActiveResource(this._activeBranchLocation), changeHash: metadata.Parents,  defaultChild: this._activeComponentLocation});
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/resourceSelector.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/resourceSelector.js
index 02af8ed..e63948a 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/resourceSelector.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/browse/resourceSelector.js
@@ -40,6 +40,7 @@
 		this.dropDownTooltip = params.dropDownTooltip;
 		this.allItems = params.allItems;
 		this.activeResourceName = params.activeResourceName;
+		this.activeResourceLocation = params.activeResourceLocation;
 		this.labelHeader = params.labelHeader;
 		this.parentNode = params.parentNode;
 		this.listener = function(event) {
@@ -83,6 +84,7 @@
 			return this.allItems.map(function(resource) { //$NON-NLS-0$
 				return {
 					name: resource.Name,
+					checked: resource.Location === _self.activeResourceLocation,
 					callback: _self.setActiveResource.bind(_self, {resource: resource, changeHash: true})
 				};
 			});
@@ -134,6 +136,7 @@
 		 */
 		setActiveResource: function(params) {
 			this.activeResourceName = params.resource.Name;
+			this.activeResourceLocation = params.resource.Location;
 			if(this.fetchChildren) {//Lazy fetch
 				if(params.resource.selectorAllItems){
 					if(this.resourceChangeDispatcher) {