[Esbox-commits] r2197 - in branches/work_Ed: org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Fri Sep 18 19:13:17 EEST 2009
Author: eswartz
Date: 2009-09-18 19:13:17 +0300 (Fri, 18 Sep 2009)
New Revision: 2197
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/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/AbstractExpandableLookHereDialog.java
Log:
-- Detect whether a VM is running but not contactable, vs. not running at all, and show help right away if the former
-- Fix up virtualbox scanning so it doesn't come up with an error immediately
Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java 2009-09-18 15:34:55 UTC (rev 2196)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java 2009-09-18 16:13:17 UTC (rev 2197)
@@ -28,7 +28,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.maemo.esbox.internal.api.maemosdk.ui.preferences.BuildMachinePreferencePage;
-import org.maemo.esbox.internal.api.vm.ui.AbstractExpandableLookHereDialog;
import org.maemo.esbox.internal.api.vm.ui.LaunchVirtualMachineDialog;
import org.maemo.esbox.internal.api.vm.ui.SlowVirtualMachineLaunchMonitorDialog;
import org.maemo.esbox.internal.api.vm.ui.SynchronizedProgressPartProgressMonitor;
@@ -102,22 +101,39 @@
else
name = machine.getName();
+ final String message;
+ final boolean likelyNetworkIssue;
+ likelyNetworkIssue = (this instanceof BaseLaunchableVirtualMachineController
+ && ((BaseLaunchableVirtualMachineController) this).isMachineRunning());
+
+ if (likelyNetworkIssue)
+ message = MessageFormat.format("{0} cannot contact the VM:\n \n{1}.\n \n"
+ + "Launch it now, or look for solutions below?",
+ ProductUtils.getProductName(),
+ name);
+ else
+ message = MessageFormat.format("{0} needs to launch the VM:\n \n{1}.\n \n"
+ + "Launch it now?",
+ ProductUtils.getProductName(),
+ name);
+
final boolean launchRet[] = { false };
Display.getDefault().syncExec(new Runnable() {
public void run() {
- AbstractExpandableLookHereDialog dialog = new LaunchVirtualMachineDialog(
+ LaunchVirtualMachineDialog dialog = new LaunchVirtualMachineDialog(
null, "Virtual Machine Needed",
- MessageFormat.format("{0} cannot contact the VM:\n \n{1}.\n \n"
- + "Launch it now?",
- ProductUtils.getProductName(),
- name),
+ message,
"If the machine has already booted, you may need to synchronize the network settings or look for other problems.",
new ILookHereProvider[] {
getLookAtBuildMachinePrefs(),
getLookAtNetworkPrefs(),
getLookAtMaemoVMWare()
- });
+ });
+
+ if (likelyNetworkIssue) {
+ dialog.setHelpExpanded(true);
+ }
launchRet[0] = dialog.open() == IDialogConstants.OK_ID;
}
});
Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/AbstractExpandableLookHereDialog.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/AbstractExpandableLookHereDialog.java 2009-09-18 15:34:55 UTC (rev 2196)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/AbstractExpandableLookHereDialog.java 2009-09-18 16:13:17 UTC (rev 2197)
@@ -40,6 +40,8 @@
protected final String helpMessage;
private Group lookHereGroup;
private GridData lookHereGridData;
+ private boolean initExpanded;
+ private Button helpButton;
/**
* @param parentShell
@@ -90,14 +92,13 @@
// NOTE: we really want to use SWT.TOGGLE here, but the button
// looks totally different from a pushbutton on OS X :p
- final Button helpButton = new Button(parent, SWT.PUSH);
- helpButton.setText(IDialogConstants.HELP_LABEL + " >>");
+ helpButton = new Button(parent, SWT.PUSH);
helpButton.setFont(JFaceResources.getDialogFont());
helpButton.setData(IDialogConstants.HELP_ID);
((GridLayout) parent.getLayout()).numColumns++;
setButtonLayoutData(helpButton);
-
+
helpButton.addSelectionListener(new SelectionAdapter() {
boolean toggled = false;
@@ -105,23 +106,30 @@
public void widgetSelected(SelectionEvent e) {
toggled = !toggled;
//if (helpButton.getSelection()) {
- if (toggled) {
- helpButton.setText("<< " + IDialogConstants.HELP_LABEL);
- lookHereGridData.heightHint = SWT.DEFAULT;
- lookHereGridData.exclude = false;
- lookHereGroup.setVisible(true);
- }
- else {
- helpButton.setText(IDialogConstants.HELP_LABEL + " >>");
- lookHereGridData.exclude = true;
- lookHereGridData.heightHint = 0;
- lookHereGroup.setVisible(false);
- }
- getShell().pack();
+ updateHelp(toggled);
}
});
}
+ /**
+ * @param toggled
+ */
+ protected void updateHelp(boolean toggled) {
+ if (toggled) {
+ helpButton.setText("<< " + IDialogConstants.HELP_LABEL);
+ lookHereGridData.heightHint = SWT.DEFAULT;
+ lookHereGridData.exclude = false;
+ lookHereGroup.setVisible(true);
+ }
+ else {
+ helpButton.setText(IDialogConstants.HELP_LABEL + " >>");
+ lookHereGridData.exclude = true;
+ lookHereGridData.heightHint = 0;
+ lookHereGroup.setVisible(false);
+ }
+ getShell().pack();
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IconAndMessageDialog#createContents(org.eclipse.swt.widgets.Composite)
*/
@@ -149,6 +157,8 @@
});
+ updateHelp(initExpanded);
+
return contents;
}
@@ -165,5 +175,13 @@
return control;
}
+
+ /**
+ * Set the default state of the help portion (before initialization)
+ */
+ public void setHelpExpanded(boolean initExpanded) {
+ this.initExpanded = initExpanded;
+ }
+
}
\ No newline at end of file
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-09-18 15:34:55 UTC (rev 2196)
+++ branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxSettingsPreferencePage.java 2009-09-18 16:13:17 UTC (rev 2197)
@@ -57,7 +57,8 @@
private ComboViewer machineViewer;
private Job fetchMachinesJob;
private Collection<String> machineNames = Collections.emptyList();
-
+ private boolean hasScannedVirtualMachines;
+
/**
* @param preferenceStore
*
@@ -197,6 +198,9 @@
VirtualBoxPreferenceConstants.VIRTUALBOX_MACHINE_NAME);
if (!getComposite().isDisposed())
feVboxMachineName.setViewerModel(current);
+
+ hasScannedVirtualMachines = true;
+ validate();
}
});
@@ -228,10 +232,13 @@
setValid(false);
if (machineNames != null && !machineNames.isEmpty())
setErrorMessage("Please select a machine name after ensuring the Executable field is valid.");
+ else if (hasScannedVirtualMachines)
+ setErrorMessage("No VirtualBox VMs are registered or detected. Please ensure the Executable field is valid first.");
else
- setErrorMessage("No VirtualBox VMs are registered or detected. Please ensure the Executable field is valid first.");
+ setMessage("Scanning VirtualBox VMs...", INFORMATION);
} else {
setValid(true);
+ setMessage(null);
setErrorMessage(null);
}
}
More information about the Esbox-commits
mailing list