Bug 442507 - Orion Settings modifications should be automatically saved
- Deleted setStorageItem from Checkbox, Select and TextField
- Replaced use of setStorageItem with postChange in callers
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Checkbox.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Checkbox.js
index 8a2f02a..55cded5 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Checkbox.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Checkbox.js
@@ -16,7 +16,6 @@
 		this.node = node || document.createElement('div'); //$NON-NLS-0$

 		this.node.innerHTML = this.templateString;

 		this.checkbox = lib.$('.setting-control', this.node); //$NON-NLS-0$

-		this.postChange = options.postChange;

 	}

 	objects.mixin(Checkbox.prototype, {

 		templateString: '' +  //$NON-NLS-0$

@@ -36,10 +35,6 @@
 				this.checkbox = null;

 			}

 		},

-

-		setStorageItem: function(){

-						

-		},

 		

 		isChecked : function(){

 			return this.checkbox.checked;

@@ -58,10 +53,8 @@
 		},

         

         change: function(){

-            var value = this.checkbox.value;

-            this.setStorageItem( value );

             if (this.postChange) {

-				this.postChange();

+				this.postChange(this.checkbox.value);

 			}

         },

         

diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Select.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Select.js
index 37b3a6c..aeb9b55 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Select.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/Select.js
@@ -19,7 +19,6 @@
 		this.node = node || document.createElement("div"); //$NON-NLS-0$

 		this.node.innerHTML = this.templateString;

 		this.select = lib.$(".setting-control", this.node); //$NON-NLS-0$

-		this.postChange = params.postChange;

 	}

 	objects.mixin(Select.prototype, {

 		templateString: '<select class="setting-control" id="selection"></select>', //$NON-NLS-0$

@@ -49,10 +48,6 @@
 				this.node = this.select = null;

 			}

 		},

-

-		setStorageItem : function(){

-			// to be overridden with a choice of function to store the picked color

-		},

 		

 		getSelected : function(){

 			return this.select.value;

@@ -81,17 +76,8 @@
 		},

 	

 		change : function change(){

-		

-			var value = this.select.value;

-			

-			if( this.category ){

-				this.setStorageItem( this.category, this.item, this.element, value, this.ui );

-			}else{

-				this.setStorageItem( value );

-			}

-			

 			if (this.postChange) {

-				this.postChange();

+				this.postChange(this.select.value);

 			}

 		}

 	});

diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/TextField.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/TextField.js
index f0fe5f4..41336d5 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/TextField.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/input/TextField.js
@@ -15,7 +15,6 @@
 		this.node = node || document.createElement("div"); //$NON-NLS-0$
 		this.node.innerHTML = this.templateString;
 		this.textfield = lib.$(".setting-control", this.node); //$NON-NLS-0$
-		this.postChange = options.postChange;
 	}
 	objects.mixin(TextField.prototype, {
 		 templateString: '<input type="text" class="setting-control" name="myname"/>', //$NON-NLS-0$
@@ -39,10 +38,6 @@
 			}
 		},
 
-		setStorageItem: function(){
-			// to be overridden with a choice of function to store the picked color
-		},
-		
 		width: function( value ){
 			this.textfield.style.width = value ;
 		},
@@ -77,15 +72,12 @@
         },
 		
 		change: function(){
-			var value;
-			if( this.selection && this.selection.value ){
-				value = this.selection.value;
-			}
-		
-			this.setStorageItem( this.category, this.item, this.element, value, this.ui );
-			
 			if (this.postChange) {
-				this.postChange();
+				var value;
+				if( this.selection && this.selection.value ){
+					value = this.selection.value;
+				}
+				this.postChange(value);
 			}
 		}
 	});
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/settings/EditorSettings.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/settings/EditorSettings.js
index 4e3a0f7..0581cbc 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/settings/EditorSettings.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/settings/EditorSettings.js
@@ -241,7 +241,6 @@
 

 			var fields = [], subSection, options, set, select;

 			var themePreferences = this.themePreferences;

-			var editorThemeWidget = this.editorThemeWidget;

 			if (!this.local && this.editorThemeWidget) {

 				this.editorThemeSection = new mSection.Section(this.sections, {

 					id: "editorThemeSettings", //$NON-NLS-0$

@@ -266,10 +265,13 @@
 						}

 						options.push(set);

 					}

-					fields.push(select = this.themeSelect = new LabeledSelect( {fieldlabel:messages.Theme, options:options}));

-					select.setStorageItem = function(name) {

-						themePreferences.setTheme(name);

-					};

+					select = this.themeSelect = new LabeledSelect( 

+						{	fieldlabel:messages.Theme, 

+							options:options,

+							postChange: themePreferences.setTheme.bind(themePreferences)

+						}

+					);

+					fields.push(select);

 				}

 				if (prefs.fontSizeVisible && (!this.local || prefs.fontSizeLocalVisible)) {

 					var fontSize = themeStyles.style.fontSize;

@@ -284,10 +286,13 @@
 						}

 						options.push(set);

 					}

-					fields.push(select = this.sizeSelect = new LabeledSelect( {fieldlabel:messages["Font Size"], options:options}));

-					select.setStorageItem = function(size) {

-						themePreferences.setFontSize(size);

-					};

+					select = this.sizeSelect = new LabeledSelect( 

+						{	fieldlabel:messages["Font Size"], 

+							options:options,

+							postChange: themePreferences.setFontSize.bind(themePreferences)

+						}

+					);

+					fields.push(select);

 				}

 				if (!this.local && fields.length > 0) {

 					subSection = new Subsection( {sectionName:messages.Theme, parentNode: this.editorThemeSection.getContentElement(), children: fields} );

@@ -330,8 +335,8 @@
 									options = {};

 									options.local = this.local;

 									options.fieldlabel = messages[property];

+									options.postChange = this.update.bind(this);

 									fields.push(info.widget = info.create(property, options, prefs, this));

-									info.widget.setStorageItem = this.update.bind(this);

 								}

 							}

 							if (!this.local && fields.length > 0) {

@@ -347,9 +352,6 @@
 			if (this.local) {

 				fields.forEach(function(child) {

 					this.sections.appendChild( child.node );

-					if (!child.hasOwnProperty("setStorageItem")) { //$NON-NLS-0$

-						child.setStorageItem = this.update.bind(this);

-					}

 					child.show();

 				}.bind(this));

 			}

diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js
index 12e896c..e1f1653 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js
@@ -805,9 +805,9 @@
         var container = document.getElementById('sizecontainer');
         container.appendChild(newdiv);
         this.sizeSelect = new Select({
-            options: options
+            options: options,
+            postChange: this.selectFontSize.bind(this)
         }, newdiv);
-        this.sizeSelect.setStorageItem = this.selectFontSize.bind(this);
         this.sizeSelect.show();
     }
 
@@ -838,9 +838,9 @@
 
         if (!this.sizeSelect) {
             this.sizeSelect = new Select({
-                options: options
+                options: options,
+                postChange: this.selectFontSize.bind(this)
             }, picker);
-            this.sizeSelect.setStorageItem = this.selectFontSize.bind(this);
             this.sizeSelect.show();
         }
     }
@@ -874,9 +874,9 @@
 
         if (!this.themeSelect) {
             this.themeSelect = new Select({
-                options: options
+                options: options,
+                postChange: this.selectTheme.bind(this)
             }, picker);
-            this.themeSelect.setStorageItem = this.selectTheme.bind(this);
             this.themeSelect.show();
 
             var saver = document.getElementById('themesaver');
@@ -920,9 +920,9 @@
 
             picker.appendChild(newdiv);
             this.themeSelect = new Select({
-                options: options
+                options: options,
+                postChange: this.selectTheme.bind(this)
             }, newdiv);
-            this.themeSelect.setStorageItem = this.selectTheme.bind(this);
             this.themeSelect.show();
         }
     }