[Esbox-commits] r2031 - branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard

eswartz at garage.maemo.org eswartz at garage.maemo.org
Thu Aug 27 19:47:02 EEST 2009


Author: eswartz
Date: 2009-08-27 19:47:01 +0300 (Thu, 27 Aug 2009)
New Revision: 2031

Modified:
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1TargetInstallerSelectionWizardPage.java
Log:
Fix ESbox #4447 and #4000.  
Also add support for double-clicking to go to next page.

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java	2009-08-27 15:12:39 UTC (rev 2030)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java	2009-08-27 16:47:01 UTC (rev 2031)
@@ -13,8 +13,10 @@
 
 import java.lang.reflect.InvocationTargetException;
 
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.dialogs.InputDialog;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.layout.GridDataFactory;
@@ -24,6 +26,7 @@
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.window.Window;
 import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
@@ -34,8 +37,11 @@
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWizard;
+import org.maemo.esbox.internal.api.scratchbox.ui.wizards.ApplyAutoconfPatchWizard;
 import org.maemo.esbox.internal.scratchbox.sb1.Activator;
 import org.maemo.esbox.internal.scratchbox.sb1.IHelpID;
+import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
+import org.maemo.mica.common.core.HostUtils;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.Policy;
 import org.maemo.mica.common.core.machine.IBuildMachine;
@@ -45,8 +51,11 @@
 import org.maemo.mica.common.core.process.IStreamMonitor;
 import org.maemo.mica.common.core.process.ProcessLauncherParameters;
 import org.maemo.mica.common.core.process.ProcessLauncherUtils;
+import org.maemo.mica.common.core.sdk.ISDK;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.core.sdk.SDKManager;
 import org.maemo.mica.internal.api.common.core.SudoWrappedProcessLauncherFactory;
+import org.maemo.mica.internal.api.common.ui.wizards.WizardWorkProgressPageBase;
 import org.maemo.mica.internal.api.maemosdk.ui.wizards.BadInstallationPage;
 
 import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
@@ -132,8 +141,22 @@
 	}
 
 	public boolean canFinish() {
-		return canFinish;
+		if (!canFinish)
+			return false;
+		
+		// we dynamically add all the pages, so validate them each
+		IWizardPage page = targetPage;
+		while (page != null) {
+			// this one will never be complete until we see it
+			if (page instanceof WizardWorkProgressPageBase)
+				break;
+			if (!page.isPageComplete())
+				return false;
+			page = page.getNextPage();
+		}
+		return true;
 	}
+	
 	/**
 	 * @param canFinish
 	 *            the canFinish to set
@@ -146,10 +169,12 @@
 	public boolean performFinish() {
 		final IStatus status = doWork();
 		
-		final boolean success = status.isMultiStatus()
+		// if we did a lot of work, we have a multistatus.
+		// otherwise, it's an error or nothing really changed.
+		final boolean installedNew = status.isMultiStatus()
 				&& (status.isOK() || status.matches(IStatus.INFO));
 
-		String message = status.isMultiStatus() ? success ? "Installation succeeded"
+		String message = status.isMultiStatus() ? installedNew ? "Installation succeeded"
 				: "Installation encountered some errors"
 				: null;
 
@@ -157,13 +182,39 @@
 				"SDK Installation Results", message, status, true)
 				&& !status.matches(IStatus.CANCEL);
 
-		// Need to reboot
-		if (success)
+		if (installedNew) {
+			patchAutotools();
 			doReboot();
+		}
 
 		return goOn;
 	}
 
+	/**
+	 * Start wizard to patch autotools, since it will break over Samba
+	 */
+	private void patchAutotools() {
+		if (HostUtils.isWindows()) {
+			ApplyAutoconfPatchWizard wizard = new ApplyAutoconfPatchWizard();
+			
+			// we should find the wizard here, but don't fail if we don't
+			IScratchbox1SDK theSDK = null;
+			IPath installPath = 
+				new Path(targetPage.getSDKInstallerData().getScratchboxLocation());
+			for (ISDK sdk : SDKManager.getInstance().getSDKsOfType(IScratchbox1SDK.class)) {
+				if (((IScratchbox1SDK)sdk).getInstallRoot().equals(installPath)) {
+					theSDK = (IScratchbox1SDK) sdk;
+				}
+			}
+			if (theSDK != null) {
+				wizard.setInitialTargets(new Object[] { theSDK });
+			}
+			
+			WizardDialog dialog = new WizardDialog(getShell(), wizard);
+			dialog.open();
+		}		
+	}
+
 	private void doReboot() {
 		MessageDialog rebootDlg= new MessageDialog(
 						super.getShell(),

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java	2009-08-27 15:12:39 UTC (rev 2030)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java	2009-08-27 16:47:01 UTC (rev 2031)
@@ -16,9 +16,11 @@
 import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IOpenListener;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.OpenEvent;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.wizard.IWizardPage;
@@ -169,6 +171,19 @@
 			}
 			
 		});
+		sdkTable.addOpenListener(new IOpenListener() {
+
+			/* (non-Javadoc)
+			 * @see org.eclipse.jface.viewers.IOpenListener#open(org.eclipse.jface.viewers.OpenEvent)
+			 */
+			public void open(OpenEvent event) {
+				validatePage();
+				if (isPageComplete()) {
+					getWizard().getContainer().showPage(getNextPage());
+				}
+			}
+			
+		});
 	}
 
 	/**
@@ -354,6 +369,8 @@
 	 */
 	protected void doChangeSDKChoice(Scratchbox1SDKInstallerData data) {
 		sdkInstallerData = data;
+		detectionPage = null;
+		
 		if (data != null) {
 			userList.setText(data.getUserList());
 			userGroup.setText(data.getUserGroup());
@@ -377,7 +394,9 @@
 	public IWizardPage getNextPage() {
 		if (PreviousInstallationDetectionPage.detect(buildMachine,
 				sdkInstallerData)) {
-			detectionPage = new PreviousInstallationDetectionPage(getWizard(), sdkInstallerData);
+			if (detectionPage == null) {
+				detectionPage = new PreviousInstallationDetectionPage(getWizard(), sdkInstallerData);
+			}
 			return detectionPage;
 		}
 		return getWizard().getWorkPage();

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1TargetInstallerSelectionWizardPage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1TargetInstallerSelectionWizardPage.java	2009-08-27 15:12:39 UTC (rev 2030)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1TargetInstallerSelectionWizardPage.java	2009-08-27 16:47:01 UTC (rev 2031)
@@ -24,10 +24,12 @@
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ComboViewer;
 import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IOpenListener;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.OpenEvent;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
@@ -253,6 +255,19 @@
 			}
 			
 		});
+		platformTable.addOpenListener(new IOpenListener() {
+
+			/* (non-Javadoc)
+			 * @see org.eclipse.jface.viewers.IOpenListener#open(org.eclipse.jface.viewers.OpenEvent)
+			 */
+			public void open(OpenEvent event) {
+				validatePage();
+				if (isPageComplete()) {
+					getWizard().getContainer().showPage(getNextPage());
+				}
+			}
+			
+		});
 	}
 
 	/**



More information about the Esbox-commits mailing list