[Esbox-commits] r2188 - in branches/work_Ed: org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/provider org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/provider org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests org.maemo.esbox.tests 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/src/org/maemo/esbox/internal/api/vm/ui/preferences org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm org.maemo.esbox.vm/src/org/maemo/esbox/vm/core org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards

eswartz at garage.maemo.org eswartz at garage.maemo.org
Wed Sep 16 23:21:12 EEST 2009


Author: eswartz
Date: 2009-09-16 23:21:09 +0300 (Wed, 16 Sep 2009)
New Revision: 2188

Added:
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BaseMachinePreferencePage.java
   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/LaunchVirtualMachineDialog.java
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/ValidateMachineRunner.java
   branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferenceConstants.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/provider/Scratchbox1SDKProvider.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/provider/Scratchbox2SDKProvider.java
   branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java
   branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java
   branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java
   branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java
   branches/work_Ed/org.maemo.esbox.tests/asthelper.completions
   branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachine.java
   branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java
   branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuPreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuSettingsPreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachine.java
   branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java
   branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxPreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareUtils.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseLaunchableVirtualMachineController.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachine.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineConfiguration.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/SlowVirtualMachineLaunchMonitorDialog.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/BaseVirtualMachinePreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/CommonVirtualMachineSettingsPreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachine.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachinePreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/IVirtualMachine.java
Log:
Make changes to improve VM setup experience.

-- Add IMachine parameter to ISDKProvider implementations and remove a lot of cruft which is already handled by other code.

-- Always ask before launching a VM, to avoid silently doing this or killing running machines.

-- Make the build machine preferences page be more careful about halting or restarting machines and ensuring that SDKs are refreshed at the right time.

-- Make VMs compare correctly in #equals and #hashCode (so we can tell if we need to relaunch the machine)

-- Provide a descriptive name for VMs (e.g. the network address) for use in dialogs.

-- Be sure to halt a VM even if SDK shutdown fails.

-- Make VMware network autoconfig act differently if the vmnet interface is working or not.

-- Fix some warnings.

Added: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BaseMachinePreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BaseMachinePreferencePage.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BaseMachinePreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.maemosdk.ui.preferences;
+
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.ui.preferences.ComposedPreferencePage;
+
+/**
+ * @author eswartz
+ *
+ */
+public abstract class BaseMachinePreferencePage extends ComposedPreferencePage {
+
+	/**
+	 * @param style
+	 */
+	public BaseMachinePreferencePage(int style) {
+		super(style);
+	}
+
+	/**
+	 * Recreate the machine from the current unsaved preferences
+	 * @return new {@link IMachine}
+	 */
+	public abstract IMachine createMachine();
+
+}
\ No newline at end of file


Property changes on: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BaseMachinePreferencePage.java
___________________________________________________________________
Name: svn:eol-style
   + native

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-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -85,6 +85,9 @@
 	protected Map<String, IBuildMachine> machineMap;
 	private Label noMachineConfigUI;
 	private Button applyAndValidateButton;
+
+	private IComposablePreferencePage selectedMachinePage;
+	private IMachine lastValidatedMachine;
 	
 	/**
 	 * 
@@ -272,6 +275,7 @@
 			}
 			machineConfigStackLayout.topControl = page.getControl();
 			selectedMachine = machine;
+			selectedMachinePage = page;
 			
 			// wait a step since field editors on other pages 
 			// will clear the message when they lose focus
@@ -284,6 +288,7 @@
 		} else {
 			machineConfigStackLayout.topControl = noMachineConfigUI;
 			selectedMachine = null;
+			selectedMachinePage = null;
 			setErrorMessage(null);
 			setMessage(null, INFORMATION);
 			setValid(true);
@@ -366,9 +371,9 @@
 				
 			if (changed) {
 				// changes in settings mean the machine should be relaunched 
-				shutDownMachines();
+				shutDownMachinesBeforeSwitchingTo(selectedMachine);
 			
-				// reset the build machines, since they were initialized from other prefs
+				// reset the build machines, since they were initialized from internal prefs
 				MachineRegistry.getInstance().refreshBuildMachines();
 				
 				// these objects refer to the old values, so we compare them to detect a change,
@@ -380,6 +385,7 @@
 					newMachine = MachineRegistry.getInstance().setCurrentBuildMachine(newMachine.getName());
 				else
 					newMachine = MachineRegistry.getInstance().setCurrentBuildMachine(newMachine);
+				
 				selectedMachine = newMachine;
 			}
 		} finally {
@@ -388,7 +394,9 @@
 		}
 			
 		if (selectedMachine != null && !MachineManager.getInstance().isActive(selectedMachine)) {
-			MachineManager.getInstance().scheduleAcquireMachine(selectedMachine);
+			//MachineManager.getInstance().scheduleAcquireMachine(selectedMachine);
+			// need to properly time the SDK refresh to use the new machine, so do this first
+			SDKManagerInternal.getInstance().refresh(true);
 		}
 	}
 
@@ -412,16 +420,16 @@
 	/**
 	 * 
 	 */
-	protected boolean shutDownMachines() {
+	protected boolean shutDownMachinesBeforeSwitchingTo(IMachine selectedMachine) {
 		// shut down other VMs first
 		boolean vmRunning = false;
 		IMachine current = null;
-		final IMachine[] currentMachines = MachineRegistry.getInstance().getCurrentBuildMachines();
+		IMachine[] currentMachines_ = MachineRegistry.getInstance().getCurrentBuildMachines();
 		
-		for (int i = 0; i < currentMachines.length; i++) {
-			IMachine machine = currentMachines[i];
+		for (int i = 0; i < currentMachines_.length; i++) {
+			IMachine machine = currentMachines_[i];
 			if (machine instanceof ILocalMachine) {
-				currentMachines[i] = null;	// don't dare shut this down
+				currentMachines_[i] = null;	// don't dare shut this down
 				continue;
 			}
 			
@@ -430,8 +438,17 @@
 				current = machine;
 			}
 		}
+		
+		if (lastValidatedMachine != null && current == null) {
+			if (MachineManager.getInstance().isActive(lastValidatedMachine)) {
+				vmRunning = true;
+				current = lastValidatedMachine;
+				currentMachines_ = new IMachine[] { current };
+			}
+		}
 
-		if (vmRunning && selectedMachine != null) {
+		if (vmRunning && selectedMachine != null && !current.equals(selectedMachine)) {
+			final IMachine[] currentMachines = currentMachines_;
 			boolean doit;
 			String message;
 			if (selectedMachine.getName().equals(current.getName())) {
@@ -465,6 +482,7 @@
 							for (IMachine machine : currentMachines) {
 								if (machine == null)
 									continue;
+								monitor.setTaskName("Shutting down " + machine.getName());
 								MachineManager.getInstance().releaseMachine(machine, new SubProgressMonitor(monitor, 1));
 								if (monitor.isCanceled())
 									break;
@@ -536,32 +554,18 @@
 	@Override
 	protected void contributeButtons(Composite parent) {
 		applyAndValidateButton = new Button(parent, SWT.PUSH);
-		applyAndValidateButton.setText("Apply and &Validate Machine");
+		applyAndValidateButton.setText("&Validate Machine");
 		applyAndValidateButton.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent ev) {
 				
-				performApply();
-				
 				if (selectedMachine != null) {
 					Display.getDefault().asyncExec(new Runnable() {
 
 						public void run() {
-							StyledTextProgressDialog dialog = new StyledTextProgressDialog(
-									getShell(), 
-									"Virtual Machine Validation");
-							
-							dialog.open();
-							
-							ValidateMachineRunner runner = new ValidateMachineRunner(
-									dialog.getProgressReporter(),
-									selectedMachine);
-							try {
-								dialog.run(true, true, runner);
-							} catch (Exception e) {
-								UIActivator.getErrorLogger().logAndShowError("Unexpected exception running tests", e);
-							}
+							validateMachine();
 						}
+
 						
 					});
 				}
@@ -571,4 +575,35 @@
 		((GridLayout) parent.getLayout()).numColumns++;
 	}
 
+	/**
+	 * Run the machine validation.  This is called on the UI thread.
+	 */
+	protected void validateMachine() {
+		
+		StyledTextProgressDialog dialog = new StyledTextProgressDialog(
+				getShell(), 
+				"Virtual Machine Validation");
+		
+		dialog.open();
+		
+		IMachine machineToValidate = selectedMachinePage instanceof BaseMachinePreferencePage ?
+				((BaseMachinePreferencePage) selectedMachinePage).createMachine() :
+					selectedMachine;
+
+		shutDownMachinesBeforeSwitchingTo(machineToValidate);
+
+		ValidateMachineRunner runner = new ValidateMachineRunner(
+				dialog.getProgressReporter(),
+				machineToValidate);
+		try {
+			dialog.run(true, true, runner);
+		} catch (InterruptedException e) {
+			// ignore
+		} catch (Exception e) {
+			UIActivator.getErrorLogger().logAndShowError("Unexpected exception running tests", e);
+		}
+		
+		lastValidatedMachine = machineToValidate;
+	}
+	
 }

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -16,7 +16,6 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 import org.eclipse.core.filesystem.EFS;
@@ -30,7 +29,6 @@
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.swt.widgets.Shell;
 import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
@@ -47,11 +45,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.common.core.ui.IProgressReporter;
 import org.maemo.mica.common.core.ui.ProgressReporterStreamTextMonitor;
-import org.maemo.mica.internal.api.common.core.sdk.SDKManagerInternal;
+import org.maemo.mica.internal.api.common.core.sdk.RefreshSDKManagerJob;
 
 /**
  * This class validates that a machine is properly configured.
@@ -370,33 +368,10 @@
 		monitor.beginTask("", 2);
 		step(monitor, "Testing visibility of shared folders in installed targets");
 		
-		SDKManager.getInstance().waitForRefreshComplete(new SubProgressMonitor(monitor,  1));
-		ISDKTarget[] sdkTargets = getMachineProvidedTargets();
+		ISDKTarget[] sdkTargets = getMachineProvidedTargets(new SubProgressMonitor(monitor, 1));
 		
-		
 		if (sdkTargets.length == 0) {
-			info("Did not find any installed targets in build machine.\n\nRetrying ...");
-			
-			ProgressMonitorDialog dlg2 = new ProgressMonitorDialog(shell);
-			try {
-				dlg2.run(false, true, new IRunnableWithProgress() {
-
-					public void run(IProgressMonitor monitor)
-							throws InvocationTargetException, InterruptedException {
-						SDKManagerInternal.getInstance().refreshFull(monitor);
-					}
-					
-				});
-			} catch (Exception e) {
-				fail("Failed to refresh installed targets:\n{0}", e.getMessage());
-				return false;
-			}
-
-			sdkTargets = getMachineProvidedTargets();
-			if (sdkTargets.length == 0) {
-				fail("Failed to find any installed targets in this machine... it is probably misconfigured or broken.");
-				return false;
-			}
+			info("Did not find any installed targets in build machine.");
 		}
 
 		// make sure we can see the shared folder in the target if it maps there
@@ -423,14 +398,16 @@
 
 	/**
 	 * Get the SDK targets that are purported to be available from the machine.
+	 * @param monitor 
 	 * @return non-<code>null</code> array
 	 */
-	private ISDKTarget[] getMachineProvidedTargets() {
-		List<ISDKTarget> sdktargetsList = new ArrayList<ISDKTarget>(Arrays.asList(
-				SDKManager.getInstance().getAllSDKTargets()));
-		for (Iterator<ISDKTarget> iter = sdktargetsList.iterator(); iter.hasNext(); ) {
-			if (!iter.next().getSDK().getMachine().equals(machine))
-				iter.remove();
+	private ISDKTarget[] getMachineProvidedTargets(IProgressMonitor monitor) {
+		RefreshSDKManagerJob job = new RefreshSDKManagerJob(machine, true);
+		job.run(monitor);
+		
+		List<ISDKTarget> sdktargetsList = new ArrayList<ISDKTarget>();
+		for (ISDK sdk : job.getSDKs()) {
+			sdktargetsList.addAll(Arrays.asList(sdk.getSDKTargets()));
 		}
 		return (ISDKTarget[]) sdktargetsList.toArray(new ISDKTarget[sdktargetsList
 				.size()]);

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferenceConstants.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferenceConstants.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sbrsh/SBRSHPreferenceConstants.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -24,6 +24,6 @@
 	/** Get the preference store that contains these preferences */
 	public static IPreferenceStore getPreferenceStore() {
 		return Activator.getDefault().getPreferenceStore();
-	}
+	} 
 
 }

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -497,6 +497,9 @@
 			}
 
 		} catch (ScratchboxException e2) {
+			if (e2.getMessage().contains("not properly set up"))
+				return;
+			
 			// sb-conf killall can fail in the event there is some
 			// process with a space in its
 			// name... or if no targets exist yet; just log it and keep going
@@ -975,7 +978,11 @@
 	public void forceShutdown(IProgressMonitor monitor) throws MicaException {
 		monitor.beginTask("", 2);
 		
-		killSessions();
+		try {
+			killSessions();
+		} catch (MicaException e) {
+			// this is okay; it might not even have been started
+		}
 		monitor.worked(1);
 		if (monitor.isCanceled())
 			return;

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/provider/Scratchbox1SDKProvider.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/provider/Scratchbox1SDKProvider.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/provider/Scratchbox1SDKProvider.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -12,8 +12,6 @@
 package org.maemo.esbox.internal.scratchbox.sb1.provider;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
 import org.eclipse.core.filesystem.IFileStore;
@@ -28,9 +26,7 @@
 import org.maemo.esbox.internal.scratchbox.sb1.core.SB1PreferenceConstants;
 import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDK;
 import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.machine.IBuildMachine;
 import org.maemo.mica.common.core.machine.IMachine;
-import org.maemo.mica.common.core.machine.MachineRegistry;
 import org.maemo.mica.common.core.preferences.CorePreferenceManager;
 import org.maemo.mica.common.core.preferences.IPreferenceProvider;
 import org.maemo.mica.common.core.sdk.ISDK;
@@ -66,36 +62,21 @@
 	 * 
 	 * @see org.maemo.mica.common.core.sdk.ISDKProvider#createSDKs()
 	 */
-	public List<ISDK> createSDKs(IProgressMonitor monitor) throws MicaException {
+	public List<ISDK> createSDKs(IMachine machine, IProgressMonitor monitor) throws MicaException {
 		if (monitor == null)
 			monitor = new NullProgressMonitor();
 		
 		List<ISDK> sdks = new ArrayList<ISDK>();
-		IBuildMachine[] buildMachines = MachineRegistry.getInstance().getBuildMachines();
-		if (monitor.isCanceled())
-			return sdks;
 		
-		monitor.beginTask("", buildMachines.length);
+		monitor.beginTask("", 1);
 		monitor.subTask("Scanning Scratchbox 1 installations");
 		
-		for (IMachine machine : buildMachines) {
-			IPreferenceProvider prefProvider = new UserAwarePreferenceProviderWrapper(
-					CorePreferenceManager.getInstance()
-							.getPreferenceProvider(), machine);
-			getMachineSDKs(prefProvider, machine, sdks, 
-					new SubProgressMonitor(monitor, 1));
-			if (monitor.isCanceled())
-				break;
-		}
+		IPreferenceProvider prefProvider = new UserAwarePreferenceProviderWrapper(
+				CorePreferenceManager.getInstance()
+						.getPreferenceProvider(), machine);
+		getMachineSDKs(prefProvider, machine, sdks, 
+				new SubProgressMonitor(monitor, 1));
 		
-		Collections.sort(sdks, new Comparator<ISDK>() {
-
-			public int compare(ISDK o1, ISDK o2) {
-				return o1.getName().compareTo(o2.getName());
-			}
-			
-		});
-		
 		return sdks;
 	}
 
@@ -107,15 +88,6 @@
 	private void getMachineSDKs(IPreferenceProvider prefProvider,
 			IMachine machine, List<ISDK> sdks, IProgressMonitor monitor) {
 		
-		if (!machine.isAlive())
-			return;
-			
-		/*
-		MachineUtils.acquireMachine(machine, new SubProgressMonitor(monitor, 9));
-		if (monitor.isCanceled())
-			return;
-		 */
-			
 		String[] paths = prefProvider.getPreferenceValue(SB1PreferenceConstants.SB1_ROOTS).split(":");
 		monitor.beginTask("", paths.length);
 		

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/provider/Scratchbox2SDKProvider.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/provider/Scratchbox2SDKProvider.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/provider/Scratchbox2SDKProvider.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -12,8 +12,6 @@
 package org.maemo.esbox.internal.scratchbox.sb2.provider;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
 import org.eclipse.core.filesystem.IFileStore;
@@ -30,10 +28,7 @@
 import org.maemo.mica.common.core.ErrorLogger;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.filesystem.IFileSystemAccess;
-import org.maemo.mica.common.core.machine.IBuildMachine;
 import org.maemo.mica.common.core.machine.IMachine;
-import org.maemo.mica.common.core.machine.MachineRegistry;
-import org.maemo.mica.common.core.machine.MachineUtils;
 import org.maemo.mica.common.core.preferences.CorePreferenceManager;
 import org.maemo.mica.common.core.preferences.IPreferenceProvider;
 import org.maemo.mica.common.core.sdk.ISDK;
@@ -71,57 +66,32 @@
 	 * 
 	 * @see org.maemo.mica.common.core.sdk.ISDKProvider#createSDKs()
 	 */
-	public List<ISDK> createSDKs(IProgressMonitor monitor) throws MicaException {
+	public List<ISDK> createSDKs(IMachine machine, IProgressMonitor monitor) throws MicaException {
 		if (monitor == null)
 			monitor = new NullProgressMonitor();
 		
 		ErrorLogger logger = Activator.getErrorLogger();
 
 		List<ISDK> sdks = new ArrayList<ISDK>();
-		IBuildMachine[] buildMachines = MachineRegistry.getInstance()
-				.getBuildMachines();
 		
-		if (monitor.isCanceled())
-			return sdks;
-		
-		monitor.beginTask("", buildMachines.length);
+		monitor.beginTask("", 1);
 		monitor.subTask("Scanning Scratchbox 2 installations");
 		
-		for (IMachine machine : buildMachines) {
-			if (!machine.isAlive())
-				continue;
-				
-			/*
-			MachineUtils.acquireMachine(machine, new SubProgressMonitor(monitor, 9));
-			if (monitor.isCanceled())
-				return;
-			 */
-				
-
-			try {
-				IPreferenceProvider prefProvider = new UserAwarePreferenceProviderWrapper(
-						CorePreferenceManager.getInstance()
-								.getPreferenceProvider(), machine);
-				Scratchbox2SDK sdk = getMachineSDK(prefProvider, machine,
-						new SubProgressMonitor(monitor, 1));
-				
-				if (sdk != null) {
-					sdks.add(sdk);
-					sdk.init();
-				}
-			} catch (ScratchboxException e) {
-				logger.log(IStatus.INFO,
-						"Problem scanning Scratchbox 2 installation", e);
+		try {
+			IPreferenceProvider prefProvider = new UserAwarePreferenceProviderWrapper(
+					CorePreferenceManager.getInstance()
+							.getPreferenceProvider(), machine);
+			Scratchbox2SDK sdk = getMachineSDK(prefProvider, machine,
+					new SubProgressMonitor(monitor, 1));
+			
+			if (sdk != null) {
+				sdks.add(sdk);
+				sdk.init();
 			}
+		} catch (ScratchboxException e) {
+			logger.log(IStatus.INFO,
+					"Problem scanning Scratchbox 2 installation", e);
 		}
-
-		Collections.sort(sdks, new Comparator<ISDK>() {
-
-			public int compare(ISDK o1, ISDK o2) {
-				return o1.getName().compareTo(o2.getName());
-			}
-			
-		});
 		
 		return sdks;
 	}
@@ -148,10 +118,6 @@
 				installRoot, prefProvider);
 
 		// see if the right programs seem to exist
-		MachineUtils.acquireMachine(machine, new SubProgressMonitor(monitor, 8));
-		if (monitor.isCanceled())
-			return null;
-		
 		IFileSystemAccess fileSystemAccess = machine.getFileSystemAccess();
 		IFileStore sb2 = fileSystemAccess.getFileStore(installRoot.append("sb2"));
 		IFileStore sb2config = fileSystemAccess.getFileStore(installRoot.append("sb2-config"));
@@ -164,8 +130,9 @@
 			sb2ConfigExists = false;
 		}
 		if (!sb2Exists || !sb2ConfigExists) {
-			Activator.getErrorLogger().log(IStatus.WARNING, 
-					"Ignoring Scratchbox 2 installation at " + installRoot + " (sb2 or sb2-config does not exist)", null);
+			// don't litter Error Log with this
+			//Activator.getErrorLogger().log(IStatus.WARNING, 
+			//		"Ignoring Scratchbox 2 installation at " + installRoot + " (sb2 or sb2-config does not exist)", null);
 			return null;
 		}
 		

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -22,6 +22,8 @@
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.env.EnvironmentModifierBlock;
 import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
 import org.maemo.mica.common.core.process.AbstractProcessLauncher;
 import org.maemo.mica.common.core.process.CommandLineArguments;
 import org.maemo.mica.common.core.process.IProcessLauncher;
@@ -47,11 +49,18 @@
  */
 public class TestSB1ProcessLauncher extends TestProcessLauncher {
 	ISDKProvider sb1Provider;
+	private IMachine machine;
 	private static List<ISDK> sdks;
 
 	@Override
 	protected void setUp() throws Exception {
 		super.setUp();
+		
+		for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+			this.machine = machine;
+			break;
+		}
+
 		SDKManager factory = SDKManagerInternal.getInstance();
 		factory.waitForRefreshComplete(null);
 		
@@ -81,7 +90,7 @@
 			if (sb1Provider == null)
 				sdks = Collections.EMPTY_LIST;
 			else
-				sdks = sb1Provider.createSDKs(null);
+				sdks = sb1Provider.createSDKs(machine, null);
 		}
 		SDKManager.getInstance().waitForRefreshComplete(null);
 		return sdks;

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1SDKProvider.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -27,6 +27,8 @@
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.filesystem.IMountPoint;
 import org.maemo.mica.common.core.machine.ILocalMachine;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
 import org.maemo.mica.common.core.preferences.CorePreferenceManager;
 import org.maemo.mica.common.core.sdk.ISDK;
 import org.maemo.mica.common.core.sdk.ISDKPlatform;
@@ -48,11 +50,17 @@
  */
 public class TestSB1SDKProvider extends BaseTest {
 	private ISDKProvider sb1Provider;
-
+	private IMachine machine;
+	
 	@Override
 	protected void setUp() throws Exception {
 		super.setUp();
 		
+		for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+			this.machine = machine;
+			break;
+		}
+		
 		IPreferenceStore store = CorePreferenceManager.getInstance().getPreferenceStore(SB1PreferenceConstants.SB1_ROOTS);
 		store.setValue(SB1PreferenceConstants.SB1_ROOTS, "/scratchbox:/opt/scratchbox");
 		
@@ -88,7 +96,7 @@
 		if (sb1Provider == null)
 			return;
 		
-		List<ISDK> sdks = sb1Provider.createSDKs(new NullProgressMonitor());
+		List<ISDK> sdks = sb1Provider.createSDKs(machine, new NullProgressMonitor());
 		assertNotNull(sdks);
 		
 		for (ISDK sdk : sdks) {
@@ -117,7 +125,7 @@
 		if (sb1Provider == null)
 			return;
 		
-		List<ISDK> sdks = sb1Provider.createSDKs(new NullProgressMonitor());
+		List<ISDK> sdks = sb1Provider.createSDKs(machine, new NullProgressMonitor());
 		assertNotNull(sdks);
 		
 		for (ISDK sdk : sdks) {
@@ -152,7 +160,7 @@
 			return;
 		
 		boolean any = false;
-		List<ISDK> sdks = sb1Provider.createSDKs(null);
+		List<ISDK> sdks = sb1Provider.createSDKs(machine, null);
 		for (ISDK sdk : sdks) {
 			ISDKTarget[] targets = sdk.getSDKTargets();
 			// for this test, we need to have something to test
@@ -303,7 +311,7 @@
 				fail("Refreshing took too long: " + (System.currentTimeMillis() - start) + " ms to scan " + count + " times");
 			
 			try {
-				List<ISDK> sdks = sb1Provider.createSDKs(null);
+				List<ISDK> sdks = sb1Provider.createSDKs(machine, null);
 				if (first) {
 					for (ISDK sdk : sdks) {
 						(((Scratchbox1SDK) sdk).getCache()).clear();

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2ProcessLauncher.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -19,6 +19,8 @@
 import org.junit.Test;
 import org.maemo.esbox.internal.scratchbox.sb2.provider.Scratchbox2SDKProvider;
 import org.maemo.mica.common.core.*;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
 import org.maemo.mica.common.core.preferences.CorePreferenceConstants;
 import org.maemo.mica.common.core.preferences.CorePreferenceManager;
 import org.maemo.mica.common.core.process.*;
@@ -41,11 +43,18 @@
  */
 public class TestSB2ProcessLauncher extends TestProcessLauncher {
 	ISDKProvider sb2Provider;
+	private IMachine machine;
 	private static List<ISDK> sdks;
 
 	@Override
 	protected void setUp() throws Exception {
 		super.setUp();
+		
+		for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+			this.machine = machine;
+			break;
+		}
+
 		IPreferenceStore preferenceStore = CorePreferenceManager.getInstance().getPreferenceStore(
 				CorePreferenceConstants.LOG_COMMANDS);
 		preferenceStore.setValue(
@@ -79,7 +88,7 @@
 			if (sb2Provider == null)
 				sdks = Collections.EMPTY_LIST;
 			else
-				sdks = sb2Provider.createSDKs(new NullProgressMonitor());
+				sdks = sb2Provider.createSDKs(machine, new NullProgressMonitor());
 		}
 		SDKManager.getInstance().waitForRefreshComplete(null);
 		return sdks;

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB2SDKProvider.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -18,6 +18,8 @@
 import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.machine.ILocalMachine;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
 import org.maemo.mica.common.core.sdk.*;
 import org.maemo.mica.common.core.tests.TestUtils;
 import org.maemo.mica.internal.api.common.core.sdk.SDKManagerInternal;
@@ -36,12 +38,19 @@
  */
 public class TestSB2SDKProvider extends TestCase {
 	private ISDKProvider sb2Provider;
+	private IMachine machine;
 
 	@Override
 	protected void setUp() throws Exception {
 		super.setUp();
+		
+		for (IMachine machine : MachineRegistry.getInstance().getBuildMachines()) {
+			this.machine = machine;
+			break;
+		}
+
 		SDKManager factory = SDKManagerInternal.getInstance();
-
+		
 		List<ISDKProvider> providers = factory.getSDKProviders();
 		assertNotNull(providers);
 		
@@ -66,7 +75,7 @@
 		if (sb2Provider == null)
 			return;
 		
-		List<ISDK> sdks = sb2Provider.createSDKs(null);
+		List<ISDK> sdks = sb2Provider.createSDKs(machine, null);
 		assertNotNull(sdks);
 		
 		for (ISDK sdk : sdks) {
@@ -93,7 +102,7 @@
 		if (sb2Provider == null)
 			return;
 		
-		List<ISDK> sdks = sb2Provider.createSDKs(new NullProgressMonitor());
+		List<ISDK> sdks = sb2Provider.createSDKs(machine, new NullProgressMonitor());
 		for (ISDK sdk : sdks) {
 			ISDKTarget[] targets = sdk.getSDKTargets();
 			for (ISDKTarget target : targets) {
@@ -203,7 +212,7 @@
 				fail("Refreshing took too long: " + (System.currentTimeMillis() - start) + " ms to scan " + count + " times");
 			
 			try {
-				List<ISDK> sdks = sb2Provider.createSDKs(null);
+				List<ISDK> sdks = sb2Provider.createSDKs(machine, null);
 				if (first) {
 					for (ISDK sdk : sdks) {
 						(((Scratchbox2SDK) sdk).getCache()).clear();

Modified: branches/work_Ed/org.maemo.esbox.tests/asthelper.completions
===================================================================
(Binary files differ)

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseLaunchableVirtualMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseLaunchableVirtualMachineController.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseLaunchableVirtualMachineController.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -137,14 +137,6 @@
 				return false;
 			
 			return !monitor.isCompleted();
-			/*
-				return true;
-			try {
-				launcher.getLastCreatedProcess().exitValue();
-				return false;
-			} catch (IllegalThreadStateException e) {
-				return true;
-			}*/
 		}
 		
 		/**
@@ -195,13 +187,9 @@
 		public void cancel() {
 			setFailed(CANCEL_STATUS);
 
-			// XXX: don't do this here... we can't distinguish explicit user cancel from 
+			// don't cancel anything else here... we can't distinguish explicit user cancel from 
 			// a nested cancellation (e.g. refresh SDKs launches machine, then the refresh is canceled).
 			// This can result in killing a perfectly fine machine
-			//if (monitor != null)
-			//	monitor.terminate();
-			//if (launcher != null)
-			//	launcher.getLastCreatedProcess().destroy();
 		}
 	}
 	/**
@@ -339,7 +327,7 @@
 				try {
 					sdk.forceShutdown(new SubProgressMonitor(monitor, 1));
 				} catch (MicaException e) {
-					throw new MachineException(null, e);
+					Activator.getErrorLogger().logError("Problem when shutting down SDK before halting " + getMachine().getName(), e);
 				}
 				if (monitor.isCanceled())
 					return;
@@ -444,15 +432,12 @@
 			
 		} else {
 			
-			// if the machine is timing out, might just be turned off
-			if (status.getCode() == SSHErrorConstants.CODE_TIMEOUT) {
+			// if the machine is timing out, or is turned off,
+			// then this can't be repaired
+			if (status.getCode() == SSHErrorConstants.CODE_TIMEOUT
+					|| !isMachineRunning()) {
 				return Result.IGNORE;
 			}
-			//IStatus probeStatus = testSSHPort();
-			//if (!probeStatus.isOK()) {
-				// no one listening to the port, so probably machine not running; ignore the error and keep trying
-			//	return Result.IGNORE;
-			//}
 		}
 		
 		return super.doAskUserToRepairMachine(shell, status, mode);

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachine.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachine.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachine.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -30,4 +30,17 @@
 		super(id, name, os, arch, controller, sshConfiguration,
 				sharedFilesystemProvider);
 	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineBackend#isAlive()
+	 */
+	@Override
+	public boolean isAlive() {
+		if (getMachineController() instanceof BaseLaunchableVirtualMachineController) {
+			boolean isVMRunning = ((BaseLaunchableVirtualMachineController) getMachineController()).isMachineRunning();
+			if (!isVMRunning)
+				return false;
+		}
+		return super.isAlive();
+	}
 }

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineConfiguration.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineConfiguration.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineConfiguration.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -14,6 +14,8 @@
 import java.io.IOException;
 import java.io.StringWriter;
 import java.net.URI;
+import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 
 import org.eclipse.jface.dialogs.IDialogSettings;
@@ -46,15 +48,45 @@
 		final int prime = 31;
 		int result = 1;
 		result = prime * result;
+		String settingsString = getCanonicalSettingsString(settings);
+		result += settingsString.hashCode();
+		return result;
+	}
+
+	/**
+	 * IDialogSettings has neither #equals nor a way to fetch all the keys...
+	 * so we have to externalize it to detect differences.
+	 * @param settings2
+	 * @return
+	 */
+	private String getCanonicalSettingsString(IDialogSettings settings) {
 		if (settings != null) {
 			StringWriter writer = new StringWriter();
 			try {
 				settings.save(writer);
 			} catch (IOException e) {
 			}
-			result += writer.toString().hashCode();
+			String fullString = writer.toString();
+			
+			// ignore the section name, since it's not predictable
+			fullString = fullString.replaceAll("name=\"[^\"]+\"", "name=\"temp\"");
+			
+			// the lines are not necessarily sorted...
+			String[] lines1 = fullString.split("\n");
+			Arrays.sort(lines1,
+					new Comparator<String>() {
+
+						public int compare(String o1, String o2) {
+							if (o1.contains("<item") && o2.contains("<item")) {
+								return o1.compareTo(o2);
+							}
+							return 0;
+						}
+				
+			});
+			return TextUtils.catenateStrings(lines1, "\n");
 		}
-		return result;
+		return "";
 	}
 
 	/* (non-Javadoc)
@@ -69,18 +101,15 @@
 		if (getClass() != obj.getClass())
 			return false;
 		BaseVirtualMachineConfiguration other = (BaseVirtualMachineConfiguration) obj;
+		
+		// DialogSettings does not implement #equals()
 		if (settings == null) {
 			if (other.settings != null)
 				return false;
 		} else {
-			StringWriter writer1 = new StringWriter();
-			StringWriter writer2 = new StringWriter();
-			try {
-				settings.save(writer1);
-				other.settings.save(writer2);
-			} catch (IOException e) {
-			}
-			if (!writer1.toString().equals(writer2.toString()))
+			String settingsString1 = getCanonicalSettingsString(settings);
+			String settingsString2 = getCanonicalSettingsString(other.settings);
+			if (!settingsString1.equals(settingsString2))
 				return false;
 		}
 		return true;

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-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BaseVirtualMachineController.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -20,17 +20,23 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.preference.PreferenceDialog;
 import org.eclipse.swt.widgets.Display;
 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;
 import org.maemo.esbox.internal.vm.Activator;
+import org.maemo.esbox.vm.core.IVirtualMachine;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.mica.common.core.Policy;
+import org.maemo.mica.common.core.ProductUtils;
 import org.maemo.mica.common.core.WorkspaceUtils;
 import org.maemo.mica.common.core.machine.IMachine;
 import org.maemo.mica.common.core.machine.MachineException;
@@ -84,14 +90,43 @@
 		
 		IStatus status;
 		
-		/*  we don't know where we are when this is called... let the caller decide
-		status = doStopVirtualMachine(new SubProgressMonitor(monitor, 1));
-		if (!status.isOK() && machine.isAlive())
-			return status;
-		if (monitor.isCanceled())
-			return CANCEL_STATUS;
-		 */
+		boolean doLaunch; 
 		
+		if (WorkbenchUtils.isJUnitRunning()) {
+			doLaunch = true;
+		} else {
+			// ask the user first; don't auto-start VMs
+			final String name;
+			if (machine instanceof IVirtualMachine)
+				name = ((IVirtualMachine) machine).getDescriptiveName();
+			else
+				name = machine.getName();
+				
+			
+			final boolean launchRet[] = { false };
+			Display.getDefault().syncExec(new Runnable() {
+				public void run() {
+					AbstractExpandableLookHereDialog 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),
+							"If the machine has already booted, you may need to synchronize the network settings or look for other problems.",
+							new ILookHereProvider[] {
+								getLookAtBuildMachinePrefs(),
+								getLookAtNetworkPrefs(),
+								getLookAtMaemoVMWare()
+							});		
+					launchRet[0] = dialog.open() == IDialogConstants.OK_ID;		
+				}
+			});
+			doLaunch = launchRet[0];
+		}
+		
+		if (!doLaunch)
+			return Status.CANCEL_STATUS;
+		
 		final SynchronizedProgressPartProgressMonitor launchMonitor;
 		final SlowVirtualMachineLaunchMonitorDialog[] monitorDialog = { null };
 		
@@ -106,8 +141,7 @@
 					monitorDialog[0] = new SlowVirtualMachineLaunchMonitorDialog(
 							machine, BaseVirtualMachineController.this, 
 							WorkbenchUtils.getSafeShell(),
-							1000 * 60,
-							monitor);
+							1000 * 60);
 					launchMonitor.setProgressPart(monitorDialog[0].getProgressPart());
 					launchMonitor.beginTask("", IProgressMonitor.UNKNOWN);
 				}
@@ -141,8 +175,65 @@
 			
 		}
 	}
+	
+	/**
+	 * Create a "look here" provider pointing to the Maemo VMware project page.
+	 * @return
+	 */
+	protected ILookHereProvider getLookAtMaemoVMWare() {
+		return new ILookHereProvider() {
 
+			public String getId() {
+				return "maemovmware.prefs";
+			}
+
+			public String getLabel() {
+				return "Maemo SDK Virtual Image documentation";
+			}
+
+			public void handleSelected(Shell shell) {
+				WorkbenchUtils.showWebPageInExternalBrowser(
+					"http://maemovmware.garage.maemo.org/2nd_edition/documentation.html"); // $NON-NLS-1$
+			}
+			
+		};
+	}
+
 	/**
+	 * Create a "look here" provider pointing to Eclipse network preferences.
+	 * @return
+	 */
+	protected ILookHereProvider getLookAtBuildMachinePrefs() {
+		return new ILookHereProvider() {
+
+			public String getId() {
+				return "buildmachine.prefs";
+			}
+
+			public String getLabel() {
+				return "Build Machines preferences";
+			}
+
+			public void handleSelected(Shell shell) {
+				Display.getDefault().asyncExec(new Runnable() {
+
+					public void run() {
+						final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
+								null,
+								BuildMachinePreferencePage.PAGE_ID,
+								null,
+								null);
+						dialog.setBlockOnOpen(false);
+						dialog.open();
+					}
+					
+				});
+			}
+			
+		};
+	}
+	
+	/**
 	 * Start the machine in the VM specific way.  
 	 * @param monitor
 	 * @return status of start (OK for no-op or success)
@@ -222,8 +313,11 @@
 				
 				Activator.getImageDescriptor("icons/full/etool16/virtual_machine_64.png").createImage(),
 				
-				MessageFormat.format("Cannot start or connect to virtual machine ''{0}''",
-						getName()),
+				MessageFormat.format("Cannot start or connect to virtual machine ''{0}'' at {1}:{2}",
+						getName(),
+						getConfiguration().getTargetAddress(),
+						"" + getConfiguration().getTargetPort()
+				),
 				
 				"Be sure the machine is configured properly and that its software is launched, and that the running VM has network connectivity.",
 				
@@ -232,4 +326,5 @@
 			);
 	}
 	
+	
 }

Added: 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	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/AbstractExpandableLookHereDialog.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.vm.ui;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.mica.internal.api.common.core.ILookHereProvider;
+import org.maemo.mica.internal.api.common.core.ui.LookHereMessageWidget;
+
+/**
+ * @author eswartz
+ *
+ */
+public class AbstractExpandableLookHereDialog extends MessageDialog {
+
+	protected LookHereMessageWidget lookHere;
+	protected final ILookHereProvider[] lookHereProviders;
+	protected final String helpMessage;
+	private Group lookHereGroup;
+	private GridData lookHereGridData;
+
+	/**
+	 * @param parentShell
+	 * @param dialogTitle
+	 * @param dialogTitleImage
+	 * @param dialogMessage
+	 * @param dialogImageType
+	 * @param dialogButtonLabels
+	 * @param defaultIndex
+	 */
+	public AbstractExpandableLookHereDialog(Shell parentShell, 
+			String dialogTitle,
+			Image dialogTitleImage,
+			String dialogMessage,
+			int dialogImageType,
+			String helpMessage,
+			ILookHereProvider[] providers,
+			String[] dialogButtonLabels,
+			int defaultIndex) {
+		super(parentShell, dialogTitle, dialogTitleImage, dialogMessage,
+				dialogImageType, dialogButtonLabels, defaultIndex);
+		setShellStyle(getShellStyle() | SWT.RESIZE);
+		this.helpMessage = helpMessage;
+		this.lookHereProviders = providers;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
+	 */
+	@Override
+	protected void buttonPressed(int id) {
+		if (id == IDialogConstants.HELP_ID) {
+			// let our own listener act
+			return;
+		}
+		super.buttonPressed(id);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		super.createButtonsForButtonBar(parent);
+		
+		// get help
+		final Button helpButton = new Button(parent, SWT.TOGGLE);
+		helpButton.setText(IDialogConstants.HELP_LABEL + " >>");
+		helpButton.setFont(JFaceResources.getDialogFont());
+		helpButton.setData(IDialogConstants.HELP_ID);
+		
+		((GridLayout) parent.getLayout()).numColumns++;
+		setButtonLayoutData(helpButton);
+		
+		helpButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (helpButton.getSelection()) {
+					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)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+		Composite contents = (Composite) super.createContents(parent);
+		 
+		lookHereGroup = new Group(contents, SWT.SHADOW_IN);
+		lookHereGridData = GridDataFactory.fillDefaults().span(2, 1).exclude(true).create();
+		lookHereGroup.setLayoutData(lookHereGridData);
+		lookHereGroup.setLayout(new GridLayout());
+		lookHereGroup.setVisible(false);
+		
+		lookHere = new LookHereMessageWidget(lookHereGroup, 
+				helpMessage, 
+				lookHereProviders);
+		lookHere.setLinkSelectedListener(new LookHereMessageWidget.LinkSelectedListener() {
+	
+			public void notifyLinkSelected() {
+				// must close this dialog right now, since these handlers are
+				// likely to put up UI which will only appear behind the dialog
+				AbstractExpandableLookHereDialog.this.setReturnCode(IDialogConstants.CANCEL_ID);
+				AbstractExpandableLookHereDialog.this.close();
+			}
+			
+		});
+		
+		return contents;
+	}
+	
+	@Override
+	protected Control createMessageArea(Composite composite) {
+		Composite control = (Composite) super.createMessageArea(composite);
+		
+		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER)
+			.applyTo(this.imageLabel);
+		
+		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
+			.align(SWT.LEFT, SWT.BEGINNING)
+			.applyTo(messageLabel);
+		
+		return control;
+	}
+
+}
\ No newline at end of file


Property changes on: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/AbstractExpandableLookHereDialog.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/LaunchVirtualMachineDialog.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/LaunchVirtualMachineDialog.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/LaunchVirtualMachineDialog.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.api.vm.ui;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.internal.vm.Activator;
+import org.maemo.mica.internal.api.common.core.ILookHereProvider;
+
+/**
+ * Create a dialog describing a problem with an machine,
+ * passing an IStatus from a failed machine acquire/probe call.
+ * This will present some hyperlinks allowing to user to find
+ * possible sources of help.
+ * @author eswartz
+ *
+ */
+public class LaunchVirtualMachineDialog extends AbstractExpandableLookHereDialog {
+
+	public LaunchVirtualMachineDialog(Shell parent, 
+			String title,
+			String mainMessage, 
+			String helpMessage,
+			ILookHereProvider[] providers) {
+		super(parent, title, null, mainMessage, MessageDialog.QUESTION,
+				helpMessage,
+				providers,
+				new String[] { "Launch", IDialogConstants.CANCEL_LABEL }, 0);
+	
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.IconAndMessageDialog#getImage()
+	 */
+	@Override
+	public Image getImage() {
+		return Activator.getImageDescriptor("icons/full/etool16/virtual_machine_64.png").createImage();
+	}
+}
\ No newline at end of file


Property changes on: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/LaunchVirtualMachineDialog.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/SlowVirtualMachineLaunchMonitorDialog.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/SlowVirtualMachineLaunchMonitorDialog.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/SlowVirtualMachineLaunchMonitorDialog.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -21,16 +21,13 @@
 import org.eclipse.jface.wizard.ProgressMonitorPart;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Shell;
 import org.maemo.mica.common.core.ProductUtils;
 import org.maemo.mica.common.core.machine.IMachine;
 import org.maemo.mica.common.core.machine.IMachineController;
-import org.maemo.mica.internal.api.common.core.ui.LookHereMessageWidget;
 import org.maemo.mica.internal.api.protocol.ssh.SSHMachineControllerBase;
 import org.maemo.mica.protocol.ssh.SSHConfiguration;
 
@@ -40,34 +37,27 @@
  * @author eswartz
  *
  */
-public class SlowVirtualMachineLaunchMonitorDialog extends MessageDialog {
+public class SlowVirtualMachineLaunchMonitorDialog extends AbstractExpandableLookHereDialog {
 
-	/**
-	 * 
-	 */
-	private final IMachineController machineController;
-	protected LookHereMessageWidget lookHere;
 	private Timer timer;
-	private final IProgressMonitor monitor;
 	private ProgressMonitorPart progressPart;
 	private final IMachine machine;
 	
 	public SlowVirtualMachineLaunchMonitorDialog(
 			IMachine machine_, IMachineController machineController, Shell parent,
-			int longOperationTime, IProgressMonitor monitor) {
+			int longOperationTime) {
 		super(parent, "Launching Virtual Machine", null,
-				"Launching " + machine_.getName() + "...",
+				"Still waiting for " + machine_.getName() + " to fully boot...",
 				MessageDialog.INFORMATION,
+				getHelpMessage(machineController),
+				machineController.createLookHereProviders(),
 				new String[] { IDialogConstants.OK_LABEL },
 				0);
 		this.machine = machine_;
-		this.monitor = monitor;
 		
 		setShellStyle(getShellStyle() | SWT.RESIZE);
 		setBlockOnOpen(false);
 		
-		this.machineController = machineController;
-		
 		timer = new Timer(true);
 		timer.schedule(new TimerTask() {
 
@@ -111,6 +101,31 @@
 	}
 	
 	
+	/**
+	 * @param machineController
+	 * @return
+	 */
+	private static String getHelpMessage(IMachineController machineController) {
+
+		StringBuilder builder = new StringBuilder();
+		// the weird spaces between newlines are for OS X 
+		builder.append("If the machine booted successfully but this dialog doesn't go away, then the network settings may need to be synchronized.\n \n");
+		
+		if (machineController instanceof SSHMachineControllerBase) {
+			SSHConfiguration config = ((SSHMachineControllerBase) machineController).getConfiguration();
+			builder.append(MessageFormat.format(
+					"{0} expects to connect to the machine at address {1}:{2}, and for the machine to talk back to the host at address {3} (which you can verify with a ping).\n \n",
+					ProductUtils.getProductName(),
+					config.getTargetAddress(), config.getTargetPort() + "",
+					config.getHostAddress()));
+		}
+		
+		builder.append("A Maemo SDK virtual image runs 'dhclient3' at the end of its boot sequence; you should see the Target IP Address 'bound to' in the console.");
+		
+		return builder.toString();
+	}
+
+
 	/* (non-Javadoc)
 	 * @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
 	 */
@@ -138,47 +153,7 @@
 	protected Control createMessageArea(Composite parent) {
 		Composite composite = (Composite) super.createMessageArea(parent);
 		
-		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER)
-			.applyTo(this.imageLabel);
-		
-		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP)
-			.align(SWT.LEFT, SWT.BEGINNING)
-			.applyTo(messageLabel);
-
-		Group group = new Group(composite, SWT.SHADOW_IN);
-		GridDataFactory.fillDefaults().span(2, 1).applyTo(group);
-		group.setLayout(new GridLayout());
-		
-		StringBuilder builder = new StringBuilder();
-		// the weird spaces are for OS X 
-		builder.append("The virtual machine is still launching but is not accessible yet.\n \n");
-		builder.append("If the machine boots successfully but this dialog doesn't go away, then the network settings may need to be synchronized.\n \n");
-		
-		if (machineController instanceof SSHMachineControllerBase) {
-			SSHConfiguration config = ((SSHMachineControllerBase) machineController).getConfiguration();
-			builder.append(MessageFormat.format(
-					"{0} expects to connect to the machine at address {1}:{2}, and for the machine to talk back to the host at address {3} (which you can verify with a ping).\n \n",
-					ProductUtils.getProductName(),
-					config.getTargetAddress(), config.getTargetPort() + "",
-					config.getHostAddress()));
-		}
-		
-		builder.append("A Maemo SDK virtual image runs 'dhclient' at the end of its boot sequence; you should see the Target IP Address 'bound to' in the console.");
-		
-		lookHere = new LookHereMessageWidget(group, 
-				builder.toString(),
-				machineController.createLookHereProviders());
-		
-		lookHere.setLinkSelectedListener(new LookHereMessageWidget.LinkSelectedListener() {
-
-			public void notifyLinkSelected() {
-				monitor.setCanceled(true);
-				close();
-			}
-			
-		});
-		
-		progressPart = new ProgressMonitorPart(composite, null); 
+		progressPart = new ProgressMonitorPart(composite, null);
 		GridDataFactory.fillDefaults().span(2, 1).applyTo(progressPart);
 
 		progressPart.beginTask("Waiting...", IProgressMonitor.UNKNOWN);

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/BaseVirtualMachinePreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/BaseVirtualMachinePreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/BaseVirtualMachinePreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -15,11 +15,10 @@
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.swt.graphics.Point;
+import org.maemo.esbox.internal.api.maemosdk.ui.preferences.BaseMachinePreferencePage;
 import org.maemo.esbox.internal.api.maemosdk.ui.preferences.SharedFoldersPreferencePage;
-import org.maemo.esbox.vm.core.IVirtualMachine;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.esbox.vm.core.VirtualMachinePreferenceConstants;
-import org.maemo.mica.common.ui.preferences.ComposedPreferencePage;
 import org.maemo.mica.internal.api.common.core.DialogSettingsPreferenceStore;
 
 /**
@@ -28,7 +27,7 @@
  * @author eswartz
  *
  */
-public abstract class BaseVirtualMachinePreferencePage extends ComposedPreferencePage {
+public abstract class BaseVirtualMachinePreferencePage extends BaseMachinePreferencePage {
 
 	protected IVirtualMachineSettingsPreferencePage vmPrefPage;
 	protected CommonVirtualMachineSettingsPreferencePage commonPrefPage;
@@ -83,12 +82,6 @@
 	abstract protected IVirtualMachineAddressConfigurator createAddressConfigurator();
 
 	/**
-	 * Recreate the machine from the current unsaved preferences
-	 * @return new {@link IVirtualMachine}
-	 */
-	abstract protected IVirtualMachine createMachine();
-	
-	/**
 	 * Call from a VM page if some settings influence the network
 	 * settings. 
 	 */

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/CommonVirtualMachineSettingsPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/CommonVirtualMachineSettingsPreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/CommonVirtualMachineSettingsPreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -29,6 +29,7 @@
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.internal.api.maemosdk.ui.preferences.BaseMachinePreferencePage;
 import org.maemo.esbox.internal.vm.Activator;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.esbox.vm.core.VirtualMachinePreferenceConstants;
@@ -54,11 +55,11 @@
 	//private IntegerFieldEditor feCifsHostPort;
 	private IVirtualMachineAddressConfigurator addressConfigurator;
 	private Button configNetworkButton;
-	/*private*/ final BaseVirtualMachinePreferencePage basePrefPage;
+	/*private*/ final BaseMachinePreferencePage basePrefPage;
 
 	public CommonVirtualMachineSettingsPreferencePage(
 			IPreferenceStore preferenceStore,
-			IVirtualMachineAddressConfigurator addressConfigurator, BaseVirtualMachinePreferencePage basePrefPage) {
+			IVirtualMachineAddressConfigurator addressConfigurator, BaseMachinePreferencePage basePrefPage) {
 		super();
 		this.addressConfigurator = addressConfigurator;
 		this.basePrefPage = basePrefPage;

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachine.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachine.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachine.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -1,58 +1,108 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-
-package org.maemo.esbox.internal.vm;
-
-import org.eclipse.core.runtime.Platform;
-import org.maemo.esbox.internal.api.vm.core.BaseVirtualBuildMachine;
-import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-import org.maemo.mica.common.core.machine.IComposablePreferencePage;
-import org.maemo.mica.internal.api.common.core.filesystem.BaseSharedFilesystemProvider;
-
-/**
- * Manually launched machine.
- * @author eswartz
- *
- */
-public class ManualVirtualMachine extends BaseVirtualBuildMachine {
-
-	private static final String ID = Activator.PLUGIN_ID + ".manual_vm";
-	private ManualVirtualMachineConfiguration configuration;
-
-	/**
-	 * @param name
-	 * @param preferenceManualVMConfiguration
-	 */
-	public ManualVirtualMachine(String name,
-			ManualVirtualMachineConfiguration configuration) {
-		super(ID, name, Platform.OS_LINUX, Platform.ARCH_X86,
-				new ManualVirtualMachineController(configuration),
-				configuration.getSSHConfiguration(), 
-				new BaseSharedFilesystemProvider(configuration.getSharedFolders()));
-		this.configuration = configuration; 
-	}
-
-	/* (non-Javadoc)
-	 * @see org.maemo.mica.common.core.machine.IBuildMachine#createPreferencePage()
-	 */
-	public IComposablePreferencePage createPreferencePage() {
-		return new ManualVirtualMachinePreferencePage(configuration);
-	}
-
-
-	/* (non-Javadoc)
-	 * @see org.maemo.esbox.vm.core.IVirtualMachine#getConfiguration()
-	 */
-	public IVirtualMachineConfiguration getConfiguration() {
-		return configuration;
-	}
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.internal.api.vm.core.BaseVirtualBuildMachine;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.mica.common.core.machine.IComposablePreferencePage;
+import org.maemo.mica.internal.api.common.core.filesystem.BaseSharedFilesystemProvider;
+
+/**
+ * Manually launched machine.
+ * @author eswartz
+ *
+ */
+public class ManualVirtualMachine extends BaseVirtualBuildMachine {
+
+	private static final String ID = Activator.PLUGIN_ID + ".manual_vm";
+	private ManualVirtualMachineConfiguration configuration;
+
+	/**
+	 * @param name
+	 * @param preferenceManualVMConfiguration
+	 */
+	public ManualVirtualMachine(String name,
+			ManualVirtualMachineConfiguration configuration) {
+		super(ID, name, Platform.OS_LINUX, Platform.ARCH_X86,
+				new ManualVirtualMachineController(configuration),
+				configuration.getSSHConfiguration(), 
+				new BaseSharedFilesystemProvider(configuration.getSharedFolders()));
+		this.configuration = configuration; 
+	}
+
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		// ONLY check configuration
+		int result = 1;
+		result = prime * result
+				+ ((configuration == null) ? 0 : configuration.hashCode());
+		return result;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		// ONLY check configuration
+		//if (!super.equals(obj))
+		//	return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ManualVirtualMachine other = (ManualVirtualMachine) obj;
+		if (configuration == null) {
+			if (other.configuration != null)
+				return false;
+		} else if (!configuration.equals(other.configuration))
+			return false;
+		return true;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.vm.core.IVirtualMachine#getDescriptiveName()
+	 */
+	public String getDescriptiveName() {
+		return MessageFormat.format("{0} at {1}", 
+				getName(),
+				configuration.getSSHConfiguration().toString());
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IBuildMachine#createPreferencePage()
+	 */
+	public IComposablePreferencePage createPreferencePage() {
+		return new ManualVirtualMachinePreferencePage(configuration);
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.vm.core.IVirtualMachine#getConfiguration()
+	 */
+	public IVirtualMachineConfiguration getConfiguration() {
+		return configuration;
+	}
+
+}

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachinePreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachinePreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ManualVirtualMachinePreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-
-package org.maemo.esbox.internal.vm;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.DialogSettings;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.maemo.esbox.internal.api.vm.ui.preferences.AddressProvider;
-import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
-import org.maemo.esbox.internal.api.vm.ui.preferences.HostInterfaceAddressProvider;
-import org.maemo.esbox.internal.api.vm.ui.preferences.IHostTargetAddressReconciler;
-import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineAddressConfigurator;
-import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage;
-import org.maemo.esbox.internal.api.vm.ui.preferences.LocalhostTargetInterfaceAddressProvider;
-import org.maemo.esbox.internal.api.vm.ui.preferences.SameSubnetHostTargetAddressConciler;
-import org.maemo.esbox.vm.core.IVirtualMachine;
-import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-import org.maemo.mica.common.core.machine.IComposablePreferencePage;
-import org.maemo.mica.common.core.ui.IProgressReporter;
-
-/**
- * @author eswartz
- *
- */
-public class ManualVirtualMachinePreferencePage extends
-		BaseVirtualMachinePreferencePage implements IComposablePreferencePage {
-
-	public ManualVirtualMachinePreferencePage(IVirtualMachineConfiguration config) {
-		super(config);
-	}
-
-
-	/* (non-Javadoc)
-	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createMachine()
-	 */
-	@Override
-	protected IVirtualMachine createMachine() {
-		ManualVirtualMachineConfiguration config = 
-			new ManualVirtualMachineConfiguration(new DialogSettings("temp"));
-		commonPrefPage.saveTo(config);
-		config.setSharedFolders(sharedFoldersPrefPage.getSharedFolders());
-		return new ManualVirtualMachine("Test Manual Machine", config); 
-	}
-
-	
-	/* (non-Javadoc)
-	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createVirtualMachinePreferencePage()
-	 */
-	@Override
-	protected IVirtualMachineSettingsPreferencePage createVirtualMachinePreferencePage(IPreferenceStore store) {
-		return null;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createAddressConfigurator()
-	 */
-	@Override
-	protected IVirtualMachineAddressConfigurator createAddressConfigurator() {
-		return new IVirtualMachineAddressConfigurator() {
-
-			public AddressProvider getDefaultHostAddressProvider() {
-				return new HostInterfaceAddressProvider();
-			}
-
-			public AddressProvider getDefaultTargetAddressProvider() {
-				return new LocalhostTargetInterfaceAddressProvider();
-			}
-
-			public IHostTargetAddressReconciler getHostTargetAddressReconciler() {
-				return new SameSubnetHostTargetAddressConciler();
-			}
-
-			public void configureNetworkSettings(IProgressReporter reporter) {
-				// no clues
-				reporter.log(Activator.createStatus(IStatus.WARNING,
-						"Cannot guess anything for a manually configured machine."));
-			}
-			
-		};
-	}
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.DialogSettings;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.internal.api.vm.ui.preferences.AddressProvider;
+import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
+import org.maemo.esbox.internal.api.vm.ui.preferences.HostInterfaceAddressProvider;
+import org.maemo.esbox.internal.api.vm.ui.preferences.IHostTargetAddressReconciler;
+import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineAddressConfigurator;
+import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage;
+import org.maemo.esbox.internal.api.vm.ui.preferences.LocalhostTargetInterfaceAddressProvider;
+import org.maemo.esbox.internal.api.vm.ui.preferences.SameSubnetHostTargetAddressConciler;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.mica.common.core.machine.IComposablePreferencePage;
+import org.maemo.mica.common.core.ui.IProgressReporter;
+
+/**
+ * @author eswartz
+ *
+ */
+public class ManualVirtualMachinePreferencePage extends
+		BaseVirtualMachinePreferencePage implements IComposablePreferencePage {
+
+	public ManualVirtualMachinePreferencePage(IVirtualMachineConfiguration config) {
+		super(config);
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createMachine()
+	 */
+	@Override
+	public IVirtualMachine createMachine() {
+		ManualVirtualMachineConfiguration config = 
+			new ManualVirtualMachineConfiguration(new DialogSettings("temp"));
+		commonPrefPage.saveTo(config);
+		config.setSharedFolders(sharedFoldersPrefPage.getSharedFolders());
+		return new ManualVirtualMachine("Test Manual Machine", config); 
+	}
+
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createVirtualMachinePreferencePage()
+	 */
+	@Override
+	protected IVirtualMachineSettingsPreferencePage createVirtualMachinePreferencePage(IPreferenceStore store) {
+		return null;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createAddressConfigurator()
+	 */
+	@Override
+	protected IVirtualMachineAddressConfigurator createAddressConfigurator() {
+		return new IVirtualMachineAddressConfigurator() {
+
+			public AddressProvider getDefaultHostAddressProvider() {
+				return new HostInterfaceAddressProvider();
+			}
+
+			public AddressProvider getDefaultTargetAddressProvider() {
+				return new LocalhostTargetInterfaceAddressProvider();
+			}
+
+			public IHostTargetAddressReconciler getHostTargetAddressReconciler() {
+				return new SameSubnetHostTargetAddressConciler();
+			}
+
+			public void configureNetworkSettings(IProgressReporter reporter) {
+				// no clues
+				reporter.log(Activator.createStatus(IStatus.WARNING,
+						"Cannot guess anything for a manually configured machine."));
+			}
+			
+		};
+	}
+}

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/IVirtualMachine.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/IVirtualMachine.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/IVirtualMachine.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -26,4 +26,11 @@
 	 * @return IVirtualMachineConfiguration instance, never <code>null</code>
 	 */
 	IVirtualMachineConfiguration getConfiguration();
+
+	/**
+	 * Get the name of the VM which has some specific data about the machine
+	 * (opposed to #getName()).
+	 * @return String
+	 */
+	String getDescriptiveName();
 }

Modified: branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachine.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachine.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachine.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -18,6 +18,7 @@
 import org.maemo.mica.internal.api.common.core.filesystem.BaseSharedFilesystemProvider;
 
 import java.net.URI;
+import java.text.MessageFormat;
 
 
 /**
@@ -38,8 +39,57 @@
 				new BaseSharedFilesystemProvider(configuration.getSharedFolders()));
 		this.configuration = configuration; 
 	}
+	
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		// ONLY check configuration
+		int result = 1;
+		result = prime * result
+				+ ((configuration == null) ? 0 : configuration.hashCode());
+		return result;
+	}
 
+
 	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		// ONLY check configuration
+		//if (!super.equals(obj))
+		//	return false;
+		if (getClass() != obj.getClass())
+			return false;
+		QemuMachine other = (QemuMachine) obj;
+		if (configuration == null) {
+			if (other.configuration != null)
+				return false;
+		} else if (!configuration.equals(other.configuration))
+			return false;
+		return true;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.vm.core.IVirtualMachine#getDescriptiveName()
+	 */
+	public String getDescriptiveName() {
+		return MessageFormat.format("{0} ({1}:{2})", 
+				getName(),
+				configuration.getSSHConfiguration().getTargetAddress(),
+				"" + configuration.getSSHConfiguration().getTargetPort());
+	}
+
+	/* (non-Javadoc)
 	 * @see org.maemo.esbox.vm.core.IVirtualMachine#createPreferencePage(org.eclipse.swt.widgets.Composite)
 	 */
 	public IComposablePreferencePage createPreferencePage() {

Modified: branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -23,6 +23,7 @@
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.maemo.esbox.internal.api.vm.core.BaseLaunchableVirtualMachineController;
+import org.maemo.esbox.vm.core.IVirtualMachine;
 import org.maemo.esbox.vm.qemu.IQemuConfiguration;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.machine.IProcess;
@@ -215,6 +216,12 @@
 			// re-check if things might be fishy
 			scheduleProbe();
 		}
+		
+		// make sure it looks like QEMU is running
+		if (!isMachineRunning())
+			return Activator.createErrorStatus("QEMU is not running " 
+					+ ((IVirtualMachine) machine).getDescriptiveName(), null);
+		
 		IStatus status = super.doProbeMachine(monitor);
 		//if (launchInfo != null && !status.isOK())
 		//	launchInfo.setFailed(status);

Modified: branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuPreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuPreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -50,7 +50,7 @@
 	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createMachine()
 	 */
 	@Override
-	protected IVirtualMachine createMachine() {
+	public IVirtualMachine createMachine() {
 		IQemuConfiguration config = new QemuConfiguration(new DialogSettings("temp"));
 		commonPrefPage.saveTo(config);
 		config.setSharedFolders(sharedFoldersPrefPage.getSharedFolders());

Modified: branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuSettingsPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuSettingsPreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuSettingsPreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -17,6 +17,7 @@
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.esbox.vm.qemu.IQemuConfiguration;
 import org.maemo.mica.common.ui.preferences.BaseComposableFieldEditorPreferencePage;
+import org.maemo.mica.common.ui.preferences.FileListFieldEditor;
 import org.maemo.mica.common.ui.preferences.NonValidatingFileFieldEditor;
 
 /**
@@ -83,7 +84,7 @@
 		text = feRamSize.getTextControl(getFieldEditorParent());
 		text.setToolTipText("Specify the size of RAM for the machine, in megabytes.  Note: at least 512 Mb is recommended.");
 		
-		feDiskPath = new NonValidatingFileFieldEditor(
+		feDiskPath = new FileListFieldEditor(
 				QemuPreferenceConstants.QEMU_DISK_IMAGE_PATHS,
 				"Disk image(s):", getFieldEditorParent());
 		addField(feDiskPath);

Modified: branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachine.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachine.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachine.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -20,6 +20,7 @@
 import org.maemo.mica.internal.api.common.core.machine.IBuildMachineImpl;
 
 import java.net.URI;
+import java.text.MessageFormat;
 
 
 /**
@@ -41,8 +42,57 @@
 		this.configuration = configuration; 
 	}
 	
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		// ONLY check configuration
+		int result = 1;
+		result = prime * result
+				+ ((configuration == null) ? 0 : configuration.hashCode());
+		return result;
+	}
 
+
 	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		// ONLY check configuration
+		//if (!super.equals(obj))
+		//	return false;
+		if (getClass() != obj.getClass())
+			return false;
+		VirtualBoxMachine other = (VirtualBoxMachine) obj;
+		if (configuration == null) {
+			if (other.configuration != null)
+				return false;
+		} else if (!configuration.equals(other.configuration))
+			return false;
+		return true;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.vm.core.IVirtualMachine#getDescriptiveName()
+	 */
+	public String getDescriptiveName() {
+		return MessageFormat.format("{0} ({1} at {2}:{3})", 
+				getName(),
+				configuration.getMachineName(),
+				configuration.getSSHConfiguration().getTargetAddress(),
+				"" + configuration.getSSHConfiguration().getTargetPort());
+	}
+	
+	/* (non-Javadoc)
 	 * @see org.maemo.esbox.vm.core.IVirtualMachine#createPreferencePage(org.eclipse.swt.widgets.Composite)
 	 */
 	public IComposablePreferencePage createPreferencePage() {

Modified: branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxMachineController.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -27,6 +27,7 @@
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.maemo.esbox.internal.api.vm.core.BaseLaunchableVirtualMachineController;
+import org.maemo.esbox.vm.core.IVirtualMachine;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.esbox.vm.virtualbox.IVirtualBoxConfiguration;
 import org.maemo.mica.common.core.MicaException;
@@ -82,7 +83,7 @@
 			}
 
 			public String getLabel() {
-				return "Enable port forwarding";
+				return "Enable port forwarding for NAT";
 			}
 
 			public void handleSelected(final Shell shell) {
@@ -102,7 +103,6 @@
 							if (MessageDialog.openQuestion(null, title, question)) {
 								VirtualBoxUtils.setPortForwarding(configuration, hostPort, targetPort);
 								
-								
 								if (isMachineRunning() && DialogUtils.showQuestionDialog(null, "Restart VirtualBox",
 										"VirtualBox needs to be restarted to apply changes.", 
 										"Restart", "Leave running")) {
@@ -195,12 +195,25 @@
 		
 		for (String line : results.getStdoutLines()) {
 			// handle 2.1, which lists only UUIDs, and 2.2, which lists the same format as "list vms"
-			if (line.contains(machineUUID))
+			if (line.contains(machineUUID) || line.contains("\"" + machineName + "\""))
 				return true;
 		}
 		return false;  
 	}
 
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineControllerBase#doProbeMachine(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	@Override
+	protected IStatus doProbeMachine(IProgressMonitor monitor) {
+		// make sure it looks like VirtualBox is running
+		if (!isMachineRunning())
+			return Activator.createErrorStatus("VirtualBox is not running " 
+					+ ((IVirtualMachine) machine).getDescriptiveName(), null);
+
+		return super.doProbeMachine(monitor);
+	}
+	
 	/**
 	 * Ensure we know the UUID for the machine
 	 * @return
@@ -235,7 +248,8 @@
 			launchInfo.monitor.waitForCompletion(null);
 			
 			// we need a little delay between that exit
-			// and the actual launch
+			// and the actual launch, since it takes some time 
+			// before the machine appears in the runningvms list.
 			int timeout = 5000;
 			while (timeout > 0) {
 				if (isMachineRunning())

Modified: branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxPreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.virtualbox/src/org/maemo/esbox/internal/vm/virtualbox/VirtualBoxPreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -55,7 +55,7 @@
 	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createMachine()
 	 */
 	@Override
-	protected IVirtualMachine createMachine() {
+	public IVirtualMachine createMachine() {
 		IVirtualBoxConfiguration config = createConfiguration();
 		return new VirtualBoxMachine("Test VirtualBox Machine", config); 
 	}

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -11,7 +11,6 @@
 package org.maemo.esbox.internal.api.vm.vmware;
 
 import java.io.File;
-import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.eclipse.jface.operation.IRunnableWithProgress;

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -11,7 +11,9 @@
 package org.maemo.esbox.internal.vm.vmware;
 
 import java.net.URI;
+import java.text.MessageFormat;
 
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.maemo.esbox.internal.api.vm.core.BaseVirtualBuildMachine;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
@@ -39,8 +41,57 @@
 		this.configuration = configuration; 
 	}
 	
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		// ONLY check configuration
+		int result = 1;
+		result = prime * result
+				+ ((configuration == null) ? 0 : configuration.hashCode());
+		return result;
+	}
 
+
 	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		// ONLY check configuration
+		//if (!super.equals(obj))
+		//	return false;
+		if (getClass() != obj.getClass())
+			return false;
+		VMwareMachine other = (VMwareMachine) obj;
+		if (configuration == null) {
+			if (other.configuration != null)
+				return false;
+		} else if (!configuration.equals(other.configuration))
+			return false;
+		return true;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.vm.core.IVirtualMachine#getDescriptiveName()
+	 */
+	public String getDescriptiveName() {
+		return MessageFormat.format("{0} ({1} at {2}:{3})", 
+				getName(),
+				new Path(configuration.getVmxPath()).lastSegment(),
+				configuration.getSSHConfiguration().getTargetAddress(),
+				"" + configuration.getSSHConfiguration().getTargetPort());
+	}
+
+	/* (non-Javadoc)
 	 * @see org.maemo.esbox.vm.core.IVirtualMachine#createPreferencePage(org.eclipse.swt.widgets.Composite)
 	 */
 	public IComposablePreferencePage createPreferencePage() {

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -21,6 +21,7 @@
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.maemo.esbox.internal.api.vm.core.BaseLaunchableVirtualMachineController;
+import org.maemo.esbox.vm.core.IVirtualMachine;
 import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
 import org.maemo.mica.common.core.HostUtils;
 import org.maemo.mica.common.core.MicaException;
@@ -181,11 +182,16 @@
 	 * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineControllerBase#doProbeMachine(org.eclipse.core.runtime.IProgressMonitor)
 	 */
 	@Override
-	protected synchronized IStatus doProbeMachine(IProgressMonitor monitor) {
+	protected IStatus doProbeMachine(IProgressMonitor monitor) {
 		if (launchInfo != null && !launchInfo.isAlive()) {
 			// re-check if things might be fishy
 			scheduleProbe();
 		}
+		
+		if (!isMachineRunning())
+			return Activator.createErrorStatus("VMware is not running " 
+					+ ((IVirtualMachine) machine).getDescriptiveName(), null);
+		
 		IStatus status = super.doProbeMachine(monitor);
 		return status;
 

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -11,6 +11,7 @@
 
 package org.maemo.esbox.internal.vm.vmware;
 
+import java.io.IOException;
 import java.net.Inet4Address;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -29,6 +30,7 @@
 import org.maemo.esbox.internal.api.vm.ui.preferences.SameSubnetHostTargetAddressConciler;
 import org.maemo.esbox.vm.core.IVirtualMachine;
 import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.HostUtils;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.ui.IProgressReporter;
 import org.maemo.mica.internal.api.common.core.IPNetmaskFilter;
@@ -54,7 +56,7 @@
 	 * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createMachine()
 	 */
 	@Override
-	protected IVirtualMachine createMachine() {
+	public IVirtualMachine createMachine() {
 		IVMwareConfiguration config = new VMwareConfiguration(new DialogSettings("temp"));
 		commonPrefPage.saveTo(config);
 		config.setSharedFolders(sharedFoldersPrefPage.getSharedFolders());
@@ -127,6 +129,7 @@
 				reporter.log(Activator.createStatus(IStatus.ERROR, 
 						"This VM is configured for host-only networking, which usually means it cannot be contacted from the host, nor access the Internet.  Please reconfigure it for NAT or Bridged networking if problems occur."));
 			} else if (networkType.equals(VMwareUtils.NETWORK_CONFIG_BRIDGED)) {
+				//vmnet = "vmnet0";  // not a real interface
 				reporter.logInfo("Configuring for bridged networking.");
 			} else {
 				reporter.log(Activator.createStatus(IStatus.WARNING, 
@@ -141,109 +144,175 @@
 		}
 		
 		String port = "22";
-		if (isNAT) {
-			port = "2222";
-			reporter.logInfo("Set SSH Target Port to the default recommendation for NAT ("+port+").");
-			reporter.logInfo("If you're using Port Forwarding and NAT, this may need to be edited.");
+		commonPrefPage.getSSHHostPort().setStringValue(port);
+		reporter.logInfo("Set SSH Host Port to the default ("+port+").");
+		
+		
+		InetAddress hostAddr = null;
+		
+		if (vmnet != null) {
+			Map<String, InetAddress> vmnets = VMwareUtils.getVMNetMappings();
+			hostAddr = vmnets.get(vmnet);
+			
+			if (hostAddr == null) {
+				reporter.log(Activator.createStatus(IStatus.ERROR,
+						"Could not find the " + vmnet + " interface.  The VMX file may be referencing a missing, misconfigured, or unknown interface."));
+			}
+			else if (!canAccessAddress(hostAddr)) {
+				reporter.log(Activator.createStatus(IStatus.ERROR,
+						"Could not access the address of the " + vmnet + " interface."));
+				
+				if (HostUtils.isWindows()) {
+					reporter.log(Activator.createStatus(IStatus.ERROR,
+							"You may need to go to Control Panel > Network Connections and edit the Properties of this interface (VMware Virtual Ethernet Adapter for " + vmnet + ") and enable the 'Internet Protocol (TCP/IP)' item."));
+				}
+				reporter.log(Activator.createStatus(IStatus.WARNING,
+						"Configuring for an unknown network."));
+				vmnet = null;
+			}
+		}
+		
+		if (vmnet != null) {
+			setupForVMnet(reporter, vmnet, hostAddr);
 		} else {
-			reporter.logInfo("Set SSH Target Port to the default ("+port+").");
+			setupForUnknownNetwork(reporter, isNAT);	
 		}
-		commonPrefPage.getSSHTargetPort().setStringValue(port);
+		
+	}
 
+	/**
+	 * @param hostAddr
+	 * @return
+	 */
+	private boolean canAccessAddress(InetAddress hostAddr) {
+		try {
+			return hostAddr.isReachable(1000);
+		} catch (IOException e) {
+			return false;
+		}
+	}
+
+	/**
+	 * We have a known VMnet, so configure for it by attaching to the
+	 * endpoints of the subnet and using the standard SSH ports.
+	 * @param reporter
+	 * @param vmnet
+	 */
+	private void setupForVMnet(IProgressReporter reporter, String vmnet, InetAddress hostAddr) {
+		String port;
 		port = "22";
-		commonPrefPage.getSSHHostPort().setStringValue(port);
-		reporter.logInfo("Set SSH Host Port to the default ("+port+").");
+		commonPrefPage.getSSHTargetPort().setStringValue(port);
+		reporter.logInfo("Set Target Port to " + port);
 		
+		InetAddress targetAddr = null;
+		
+		try {
+			// the network is *.1, but the endpoint is *.2
+			byte[] addr = hostAddr.getAddress();
+			if (addr.length == 4 && addr[3] == 1) {
+				addr[3] = 2;
+				hostAddr = Inet4Address.getByAddress(addr);
+			}
+		} catch (UnknownHostException e) {
+			reporter.log(Activator.createErrorStatus(
+					"Could not correct the local host address",
+					e));
+		}
+		commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
+
+		reporter.logInfo("Set Host Address to " + vmnet + " endpoint address " + hostAddr);
+		
+		if (targetAddr == null) {
+			// guess the target address as being on the same subnet as the host
+			targetAddr = VMwareUtils.convertToLikelyDHCPAddress(hostAddr);
+		}
+		
+		if (targetAddr != null) {
+			commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
+			
+			reporter.logInfo("Set Target Address to likely " + vmnet + " DHCP address " + targetAddr);
+			reporter.log(Activator.createStatus(IStatus.WARNING, 
+				"You may need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
+
+		} else {
+			reporter.log(Activator.createStatus(IStatus.WARNING,
+					"Unable to determine the likely target address for the " + vmnet + " interface."));
+		}
+	
+	}
+
+	/**
+	 * We don't know what vmnet is being used, so we have to basically guess.
+	 * @param reporter
+	 * @param isNAT
+	 */
+	private void setupForUnknownNetwork(IProgressReporter reporter,
+			boolean isNAT) {
 		InetAddress hostAddr = null;
 		InetAddress targetAddr = null;
 		
-		if (vmnet == null) {
-			// the host is the default in non-NAT, non-bridged modes
-			try {
-				hostAddr = InetAddress.getLocalHost();
-				commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
-				
-				reporter.logInfo("Set Host Address to LAN address " + hostAddr);
+		String port = null;
 
-				// Dunno target -- it's DHCP.  Reset the low byte if it's not on the same subnet.
-				targetAddr = commonPrefPage.getSSHTargetAddr().getAddress();
-				if (targetAddr instanceof Inet4Address) {
-					IPNetmaskFilter filter;
+		// the host is the default in non-NAT, non-bridged modes
+		try {
+			hostAddr = InetAddress.getLocalHost();
+			commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
+			
+			reporter.logInfo("Set Host Address to LAN address " + hostAddr);
+
+			// Dunno target -- it's DHCP.  Reset the low byte if it's not on the same subnet.
+			targetAddr = commonPrefPage.getSSHTargetAddr().getAddress();
+			if (targetAddr instanceof Inet4Address) {
+				IPNetmaskFilter filter;
+				try {
+					filter = new IPNetmaskFilter(hostAddr);
+					if (!filter.accept(targetAddr))
+						targetAddr = null;
+				} catch (MicaException e) {
+					targetAddr = null;
+				}
+			}
+			
+			if (targetAddr == null) {
+				if (isNAT) {
 					try {
-						filter = new IPNetmaskFilter(hostAddr);
-						if (!filter.accept(targetAddr))
-							targetAddr = null;
-					} catch (MicaException e) {
-						targetAddr = null;
+						targetAddr = Inet4Address.getByAddress(new byte[] { 127, 0, 0, 1});
+						
+						port = "2222";
+						reporter.logInfo("Set Target Port to the NAT default (2222)");
+						commonPrefPage.getSSHTargetPort().setStringValue("2222");
+					} catch (UnknownHostException e) {
+						// unlikely...
+						// guess the target address as being on the same subnet as the host
+						targetAddr = VMwareUtils.convertToLikelyDHCPAddress(hostAddr);
 					}
-				}
-				
-				if (targetAddr == null) {
+				} else {
 					targetAddr = InetAddress.getLocalHost();
 					if (targetAddr instanceof Inet4Address) {
 						byte[] addrBytes = targetAddr.getAddress();
 						addrBytes[3] = 0;
 						targetAddr = InetAddress.getByAddress(addrBytes);
 					}
-					commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
-					reporter.logInfo("Set Target Address to LAN address " + targetAddr + " (please edit)");
 				}
-				reporter.log(Activator.createStatus(IStatus.WARNING, 
-						"You will need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
-			} catch (UnknownHostException e) {
-				// dunno!
-				reporter.log(Activator.createErrorStatus(
-						"Could not construct the local host address",
-						e));
-			}	
-			
-		} else {
-			// configure based on the network in use
-			Map<String, InetAddress> vmnets = VMwareUtils.getVMNetMappings();
-			hostAddr = vmnets.get(vmnet);
-			if (hostAddr != null) {
-				try {
-					// the network is *.1, but the endpoint is *.2
-					byte[] addr = hostAddr.getAddress();
-					if (addr.length == 4 && addr[3] == 1) {
-						addr[3] = 2;
-						hostAddr = Inet4Address.getByAddress(addr);
-					}
-				} catch (UnknownHostException e) {
-					reporter.log(Activator.createErrorStatus(
-							"Could not correct the local host address",
-							e));
-				}
-				commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
-
-				reporter.logInfo("Set Host Address to " + vmnet + " endpoint address " + hostAddr);
-
-				if (isNAT) {
-					try {
-						targetAddr = Inet4Address.getByAddress(new byte[] { 127, 0, 0, 1});
-					} catch (UnknownHostException e) {
-						// unlikely
-					}
-				}
-				if (targetAddr == null) {
-					// guess the target address
-					targetAddr = VMwareUtils.convertToLikelyDHCPAddress(hostAddr);
-				}
 				
-				if (targetAddr != null) {
-					commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
-					
-					reporter.logInfo("Set Target Address to likely " + vmnet + " DHCP address " + targetAddr);
-					reporter.log(Activator.createStatus(IStatus.WARNING, 
-						"You may need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
-
-				}
-			} else {
-				reporter.log(Activator.createStatus(IStatus.WARNING,
-						"Could not find the address of the " + vmnet + " interface.  The VMX file may be referencing a missing, misconfigured, or unknown interface."));
+				commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
+				reporter.logInfo("Set Target Address to LAN address " + targetAddr + " (please edit)");
 			}
+			reporter.log(Activator.createStatus(IStatus.WARNING, 
+					"You will need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
+			
+			if (port == null) {
+				port = "22";
+				commonPrefPage.getSSHTargetPort().setStringValue(port);
+				reporter.logInfo("Set Target Port to " + port);
+			}
+			
+		} catch (UnknownHostException e) {
+			// dunno!
+			reporter.log(Activator.createErrorStatus(
+					"Could not construct the local host address",
+					e));
 		}
-		
 	}
 
 }

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -17,7 +17,7 @@
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.StringFieldEditor;
 import org.eclipse.swt.widgets.Text;
-import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
+import org.maemo.esbox.internal.api.maemosdk.ui.preferences.BaseMachinePreferencePage;
 import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
@@ -36,14 +36,14 @@
 	private FileFieldEditor feVmxPath;
 	private StringFieldEditor feVMWAREExeName;
 	private StringFieldEditor feVMWARELaunchPattern;
-	/*private*/ final BaseVirtualMachinePreferencePage vmPrefPage;
+	/*private*/ final BaseMachinePreferencePage vmPrefPage;
 
 	/**
 	 * @param preferenceStore 
 	 * @param vmPrefPage 
 	 * 
 	 */
-	public VMwareSettingsPreferencePage(IPreferenceStore preferenceStore, BaseVirtualMachinePreferencePage vmPrefPage) {
+	public VMwareSettingsPreferencePage(IPreferenceStore preferenceStore, BaseMachinePreferencePage vmPrefPage) {
 		this.vmPrefPage = vmPrefPage;
 		setTitle("VMware Options");
 		setPreferenceStore(preferenceStore);

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareUtils.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareUtils.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareUtils.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -81,7 +81,7 @@
 		WindowsRegistry registry = WindowsRegistry.getRegistry();
 		if (registry != null) {
 			String baseKey = "SOFTWARE\\VMware, Inc.\\VMnetLib\\VMnetConfig\\vmnet";
-			for (int iface = 1; iface <= 9; iface++) {
+			for (int iface = 0; iface <= 9; iface++) {
 				String value = registry.getLocalMachineValue(baseKey + iface, "IPSubnetAddress");
 				if (value != null) {
 					try {

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java	2009-09-16 13:21:42 UTC (rev 2187)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java	2009-09-16 20:21:09 UTC (rev 2188)
@@ -54,7 +54,7 @@
 		this.fileToDownload = downloadFile;
 		if (fileToDownload.getInstallLocation() == null && installationPath != null)
 			try {
-				fileToDownload.setInstallLocation(new File(installationPath).toURL());
+				fileToDownload.setInstallLocation(new File(installationPath).toURI().toURL());
 			} catch (MalformedURLException e) {
 				Activator.getErrorLogger().logAndShowError(
 						"Cannot get location for file "
@@ -100,7 +100,7 @@
 	public void setInstallationPath(String installationPath) {
 		this.installationPath = installationPath;
 		try {
-			fileToDownload.setInstallLocation(new File(installationPath).toURL());
+			fileToDownload.setInstallLocation(new File(installationPath).toURI().toURL());
 		} catch (MalformedURLException e) {
 			Activator.getErrorLogger().logAndShowError(
 					"Cannot get location for file "



More information about the Esbox-commits mailing list