[Esbox-commits] r2099 - 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 Sep 3 22:22:36 EEST 2009
Author: eswartz
Date: 2009-09-03 22:22:33 +0300 (Thu, 03 Sep 2009)
New Revision: 2099
Modified:
branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java
Log:
Fix ESbox bug 4487
Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java 2009-09-03 16:16:21 UTC (rev 2098)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java 2009-09-03 19:22:33 UTC (rev 2099)
@@ -63,6 +63,7 @@
private final IBuildMachine buildMachine;
private Scratchbox1InstallerWorkPage workPage;
+ private boolean suppressNokiaBinariesWizard;
/**
* Constructs a new target wizard.
@@ -76,6 +77,18 @@
this.buildMachine = buildMachines[0];
initialize();
}
+
+ /**
+ * Control whether this wizard will ask the user to install the Nokia Binaries
+ * afterwards. Since that wizard runs asynchronously after this one, it's
+ * hard to synchronize package operations around it. Instead, run it directly.
+ * (ESbox #4487)
+ * @param suppressNokiaBinariesWizard true to avoid asking user to run wizard
+ */
+ public void setSuppressNokiaBinariesWizard(
+ boolean suppressNokiaBinariesWizard) {
+ this.suppressNokiaBinariesWizard = suppressNokiaBinariesWizard;
+ }
private void initialize() {
setNeedsProgressMonitor(true);
@@ -155,14 +168,25 @@
final boolean goOn = workPage.reportOperationStatus("Target Installation Results", message, status, true)
&& !status.matches(IStatus.CANCEL);
+
+ if (success && !suppressNokiaBinariesWizard) {
+ promptInstallNokiaBinaries(false);
+ }
-
+ return goOn;
+ }
+
+ /**
+ * Ask the user to install Nokia binaries, which are required in some cases.
+ * @param synchronous controls whether the wizard is launched synchronously or not.
+ * This is used in automatic invocations of the target wizard.
+ */
+ private void promptInstallNokiaBinaries(boolean synchronous) {
//calls Nokia-closed binaries wizard
- if (success
- && DialogUtils.showQuestionDialog(DialogUtils.getShell(),
+ if (DialogUtils.showQuestionDialog(DialogUtils.getShell(),
"Nokia-closed binaries installation",
"Would you like to install Nokia-closed binaries for installed targets now?")) {
- Display.getDefault().asyncExec(new Runnable() {
+ Runnable runnable = new Runnable() {
public void run() {
//get installed targets
Scratchbox1TargetInstallerData data = targetPage.getTargetInstallerData();
@@ -177,12 +201,14 @@
//call wizard with targets pre selected
NokiaBinariesInstallWizard.startWizard(installed.toArray(new ISDKTarget[installed.size()]));
}
- });
- }
-
- return goOn;
+ };
+ if (synchronous)
+ Display.getDefault().syncExec(runnable);
+ else
+ Display.getDefault().asyncExec(runnable);
+ }
}
-
+
public IStatus doWork() {
final IStatus[] statuses = { Policy.getCancelStatus(Activator.getDefault()) } ;
try {
@@ -243,13 +269,17 @@
NewScratchbox1TargetWizard wizard = new NewScratchbox1TargetWizard();
wizard.init(activeWorkbenchWindow.getWorkbench(),
StructuredSelection.EMPTY);
+ wizard.setSuppressNokiaBinariesWizard(true);
Shell parent = activeWorkbenchWindow.getShell();
WizardDialog dialog = new WizardDialog(parent, wizard);
dialog.create();
int result = dialog.open();
if (result == Window.CANCEL)
return Activator.createStatus(IStatus.CANCEL, "Scratchbox 1 target installation was canceled");
- else
- return Activator.createStatus(IStatus.OK, "Scratchbox 1 target has finished");
+
+ // now install Nokia binaries synchronously
+ wizard.promptInstallNokiaBinaries(true);
+ return Activator.createStatus(IStatus.OK, "Scratchbox 1 target installation has finished");
}
+
}
More information about the Esbox-commits
mailing list