[Esbox-commits] r2045 - in branches/work_Ed: org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox

eswartz at garage.maemo.org eswartz at garage.maemo.org
Fri Aug 28 21:57:26 EEST 2009


Author: eswartz
Date: 2009-08-28 21:57:25 +0300 (Fri, 28 Aug 2009)
New Revision: 2045

Modified:
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxSettingsPreferencePage.java
Log:
Fix ESbox bug 4452 for issues when using composed preference pages (e.g. the Build Machines page).

Field editors and their preference pages don't behave as expected when the focus changes, meaning there is often no error message at all unless you're focused on the given editor.  

We need to do some nasty reflection here in order to find out what the field editor pref page already knows but hides behind private fields.  

We also add extra checking and listening and validation to ensure we show any error found but favor an error from the current page if selected.

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java	2009-08-28 18:26:30 UTC (rev 2044)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java	2009-08-28 18:57:25 UTC (rev 2045)
@@ -265,16 +265,28 @@
 	protected void changeSelectedMachine(String name) {
 		IBuildMachine machine = machineMap.get(name);
 		if (machine != null) {
-			IComposablePreferencePage page = machineConfigPages.get(machine.getName());
+			final IComposablePreferencePage page = machineConfigPages.get(machine.getName());
 			if (page.getControl() == null) {
 				page.setContainer(getContainer());
 				page.createControl(machineConfigComposite);
 			}
 			machineConfigStackLayout.topControl = page.getControl();
 			selectedMachine = machine;
+			
+			// wait a step since field editors on other pages 
+			// will clear the message when they lose focus
+			Display.getDefault().asyncExec(new Runnable() {
+				public void run() {
+					page.revalidate();	
+					updateApplyButton();
+				}
+			});
 		} else {
 			machineConfigStackLayout.topControl = noMachineConfigUI;
 			selectedMachine = null;
+			setErrorMessage(null);
+			setMessage(null, INFORMATION);
+			setValid(true);
 		}
 		machineConfigComposite.layout();
 		getShell().layout(true, true);

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java	2009-08-28 18:26:30 UTC (rev 2044)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java	2009-08-28 18:57:25 UTC (rev 2045)
@@ -214,6 +214,13 @@
 		treeViewer.expandAll();
 	}
 
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IComposablePreferencePage#revalidate()
+	 */
+	public void revalidate() {
+		validate();
+	}
+	
 	protected void validate() {
 		setErrorMessage(null);
 		setMessage(null, INFORMATION);

Modified: branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxSettingsPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxSettingsPreferencePage.java	2009-08-28 18:26:30 UTC (rev 2044)
+++ branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxSettingsPreferencePage.java	2009-08-28 18:57:25 UTC (rev 2045)
@@ -168,6 +168,7 @@
 			@Override
 			public void focusLost(FocusEvent e) {
 				refreshMachineNameViewer();
+				validate();
 			}
 		});
 		



More information about the Esbox-commits mailing list