[Esbox-commits] r942 - in branches/work_Ed: org.maemo.esbox.maemosdk.ui/META-INF org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences org.maemo.esbox.vm org.maemo.esbox.vm/conf org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ui/actions org.maemo.esbox.vm/src/org/maemo/esbox/vm/core org.maemo.esbox.vm.qemu/conf org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu

eswartz at garage.maemo.org eswartz at garage.maemo.org
Mon Nov 17 16:40:19 EET 2008


Author: eswartz
Date: 2008-11-17 16:40:17 +0200 (Mon, 17 Nov 2008)
New Revision: 942

Added:
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderPreferenceConverter.java
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderTableViewer.java
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java
Removed:
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/ValidateMachineRunner.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderPreferenceConverter.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderTableViewer.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFoldersPreferencePage.java
Modified:
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF
   branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/BuildMachinePreferencePage.java
   branches/work_Ed/org.maemo.esbox.vm.qemu/conf/qemu_prefs.xml
   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/QemuPreferenceConstantsPrivate.java
   branches/work_Ed/org.maemo.esbox.vm/conf/vm_prefs.xml
   branches/work_Ed/org.maemo.esbox.vm/plugin.xml
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.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/ui/actions/ValidateVirtualMachineCommand.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstants.java
   branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstantsPrivate.java
Log:
Work in progress
-- move shared folder UI to maemosdk
-- make ISharedFolder a type rather than Pair<IPath,IPath>
-- allow for "alias"/bind mount shares 
-- move SSH mount walker stuff to core
-- move "validate virtual machine" command into this pref page
-- better UI for diagnosing mount failures

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/META-INF/MANIFEST.MF	2008-11-17 14:40:17 UTC (rev 942)
@@ -14,4 +14,5 @@
  org.eclipse.ui.ide;bundle-version="3.4.1"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
-Export-Package: org.maemo.esbox.internal.maemosdk.ui.actions
+Export-Package: org.maemo.esbox.internal.api.maemosdk.ui.preferences,
+ org.maemo.esbox.internal.maemosdk.ui.actions

Copied: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderPreferenceConverter.java (from rev 941, branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderPreferenceConverter.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderPreferenceConverter.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderPreferenceConverter.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.maemosdk.ui.preferences;
+
+import org.eclipse.core.runtime.Path;
+import org.maemo.mica.common.core.machine.ISharedFolder;
+import org.maemo.mica.internal.api.common.core.machine.BaseSharedFolder;
+
+import java.util.*;
+
+/**
+ * Convert from/to string format to table format.  The input is a string like:
+ * 
+ * host|target|alias[,...]
+ * 
+ * And the output is a List of ISharedFolder.
+ * @author eswartz
+ *
+ */
+public class SharedFolderPreferenceConverter {
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.ui.preferences.IJFaceViewerFieldEditorConverter#convertModelToPreference(java.lang.Object)
+	 */
+	public String convertModelToPreference(Object input) {
+		if (input == null)
+			return "";
+		
+		Collection<ISharedFolder> elements = (Collection<ISharedFolder>) input;
+		StringBuilder entries = new StringBuilder();
+		boolean first = true;
+		for (ISharedFolder element : elements) {
+			if (element.getLocalPath().isEmpty() && element.getRemotePath().isEmpty())
+				continue;
+			String entry = element.getLocalPath().toOSString() 
+				+ "|" + element.getRemotePath().toPortableString()
+				+ "|" + element.isAlias();
+			if (first)
+				first = false;
+			else
+				entries.append(',');
+			entries.append(entry);
+		}
+		return entries.toString();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.ui.preferences.IJFaceViewerFieldEditorConverter#convertPreferenceToModel(java.lang.String)
+	 */
+	public List<ISharedFolder> convertPreferenceToModel(String preference) {
+		String[] entries = preference.split(",");
+		List<ISharedFolder> elements = new ArrayList<ISharedFolder>();
+		for (String entry : entries) {
+			String[] hostTarget = entry.split("\\|");
+			if (hostTarget.length == 3) {
+				elements.add(new BaseSharedFolder(new Path(hostTarget[0]), new Path(hostTarget[1]),
+						Boolean.parseBoolean(hostTarget[2])));
+			}
+		}
+		return elements;
+	}
+
+}


Property changes on: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderPreferenceConverter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderTableViewer.java (from rev 941, branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderTableViewer.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderTableViewer.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderTableViewer.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * 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.maemosdk.ui.preferences;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.widgets.*;
+import org.maemo.mica.common.core.machine.ISharedFolder;
+
+import java.util.Collection;
+
+/**
+ * A table viewer for shared folder mappings.  The content should be Collection&lt;Pair&lt;IPath,IPath&gt;&gt;
+ * @author eswartz
+ *
+ */
+public class SharedFolderTableViewer extends TableViewer {
+
+	private Collection<ISharedFolder> mappings;
+	private TableColumn targetColumn;
+	private TableColumn hostColumn;
+	private TableColumn aliasColumn;
+	private TableViewerColumn hostViewerColumn;
+	private TableViewerColumn targetViewerColumn;
+	private TableViewerColumn aliasViewerColumn;
+	
+	public SharedFolderTableViewer(Composite parent, int style) {
+		super(parent, style | SWT.FULL_SELECTION | SWT.SINGLE);
+		
+		final Table table = getTable();
+		
+		table.setLinesVisible (true);
+		table.setHeaderVisible (true);
+		
+		hostColumn = new TableColumn(table, SWT.LEFT);
+		hostColumn.setText("Host");
+		hostColumn.pack();
+		
+		targetColumn = new TableColumn(table, SWT.LEFT);
+		targetColumn.setText("Target");
+		targetColumn.pack();
+		
+		aliasColumn = new TableColumn(table, SWT.CENTER);
+		aliasColumn.setText("Alias?");
+		aliasColumn.pack();
+		
+		hostViewerColumn = new TableViewerColumn(this, hostColumn);
+		hostViewerColumn.setLabelProvider(new ColumnLabelProvider() {
+			@Override
+			public String getText(Object element) {
+				ISharedFolder entry = (ISharedFolder) element;
+				return entry.getLocalPath().toOSString();
+			}
+		});
+		targetViewerColumn = new TableViewerColumn(this, targetColumn);
+		targetViewerColumn.setLabelProvider(new ColumnLabelProvider() {
+			@Override
+			public String getText(Object element) {
+				ISharedFolder entry = (ISharedFolder) element;
+				return entry.getRemotePath().toPortableString();
+			}
+		});
+		aliasViewerColumn = new TableViewerColumn(this, aliasColumn);
+		aliasViewerColumn.setLabelProvider(new ColumnLabelProvider() {
+			@Override
+			public String getText(Object element) {
+				ISharedFolder entry = (ISharedFolder) element;
+				return entry.isAlias() ? "yes" : "no";
+			}
+		});
+		
+		table.addControlListener(new ControlAdapter() {
+			@Override
+			public void controlResized(ControlEvent e) {
+				int fullSize = table.getSize().x - 48;
+				hostColumn.setWidth(fullSize / 2 - 3);
+				targetColumn.setWidth(fullSize / 2 - 3);
+				aliasColumn.setWidth(48);
+			}
+		});
+		
+		setContentProvider(new ArrayContentProvider());
+	}
+
+	public Collection<ISharedFolder> getMappings() {
+		return mappings;
+	}
+
+	/**
+	 * Add cell editors to the viewer.
+	 */
+	public void addEditors() {
+		hostViewerColumn.setEditingSupport(new EditingSupport(this) {
+
+			@Override
+			protected boolean canEdit(Object element) {
+				return true;
+			}
+
+			@Override
+			protected CellEditor getCellEditor(final Object element) {
+				// allow TAB to go to next field (table seems to hide this functionality away)
+				final TextCellEditor editor = new TextCellEditor(getTable());
+				((Text) editor.getControl()).addTraverseListener(new TraverseListener() {
+
+					public void keyTraversed(TraverseEvent e) {
+						editor.deactivate();
+						editElement(element, 1);
+					}
+					
+				});
+				return editor;
+			}
+
+			@Override
+			protected Object getValue(Object element) {
+				ISharedFolder pair = (ISharedFolder) element;
+				return pair.getLocalPath().toOSString();
+			}
+
+			@Override
+			protected void setValue(Object element, Object value) {
+				ISharedFolder pair = (ISharedFolder) element;
+				pair.setLocalPath(new Path(value.toString()));
+				refresh(pair);
+			}
+			
+		});
+		
+		targetViewerColumn.setEditingSupport(new EditingSupport(this) {
+
+			@Override
+			protected boolean canEdit(Object element) {
+				return true;
+			}
+
+			@Override
+			protected CellEditor getCellEditor(Object element) {
+				return new TextCellEditor(getTable());
+			}
+
+			@Override
+			protected Object getValue(Object element) {
+				ISharedFolder pair = (ISharedFolder) element;
+				return pair.getRemotePath().toPortableString();
+			}
+
+			@Override
+			protected void setValue(Object element, Object value) {
+				ISharedFolder pair = (ISharedFolder) element;
+				pair.setRemotePath(new Path(value.toString()));
+				refresh(pair);
+			}
+			
+		});
+		
+		aliasViewerColumn.setEditingSupport(new EditingSupport(this) {
+			
+			@Override
+			protected boolean canEdit(Object element) {
+				return true;
+			}
+			
+			@Override
+			protected CellEditor getCellEditor(Object element) {
+				return new CheckboxCellEditor(getTable());
+			}
+			
+			@Override
+			protected Object getValue(Object element) {
+				ISharedFolder pair = (ISharedFolder) element;
+				return pair.isAlias();
+			}
+			
+			@Override
+			protected void setValue(Object element, Object value) {
+				ISharedFolder pair = (ISharedFolder) element;
+				pair.setAlias((Boolean) value);
+				refresh(pair);
+			}
+			
+		});
+	}
+}


Property changes on: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFolderTableViewer.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java (from rev 941, branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFoldersPreferencePage.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * 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.maemosdk.ui.preferences;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.maemo.mica.common.core.machine.ISharedFolder;
+import org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage;
+import org.maemo.mica.internal.api.common.core.machine.BaseSharedFolder;
+
+import java.util.List;
+
+/**
+ * This page is included inside a BuildMachineSelectionPreferencePage
+ * to configure the shared folder mappings between host and target.
+ * @author eswartz
+ *
+ */
+public class SharedFoldersPreferencePage extends BaseComposablePreferencePage {
+
+	private SharedFolderTableViewer tableViewer;
+	private Composite composite;
+	private Button addButton;
+	private Button removeButton;
+	private Table table;
+	private SharedFolderPreferenceConverter preferenceConverter;
+	private List<ISharedFolder> model;
+	private final String preferenceName;
+
+	public SharedFoldersPreferencePage(IPreferenceStore store, String preferenceName) {
+		super();
+		setTitle("Shared folders");
+		setPreferenceStore(store);
+		this.preferenceName = preferenceName;
+		this.preferenceConverter = new SharedFolderPreferenceConverter();
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage#anyChanges()
+	 */
+	@Override
+	public boolean anyChanges() {
+		return super.anyChanges() || !getStoredPreference(false).equals(createPreference());
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage#performDefaults()
+	 */
+	@Override
+	public void performDefaults() {
+		super.performDefaults();
+		loadModel(true);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage#performApply()
+	 */
+	@Override
+	public void performApply() {
+		super.performApply();
+		saveModel();
+	}
+	
+	protected void loadModel(boolean isDefault) {
+		String info = getStoredPreference(isDefault);
+		model = preferenceConverter.convertPreferenceToModel(info);
+		tableViewer.setInput(model);
+	}
+
+	/**
+	 * @return
+	 */
+	private String getStoredPreference(boolean isDefault) {
+		String info;
+		if (isDefault)
+			info = getPreferenceStore().getDefaultString(preferenceName);
+		else
+			info = getPreferenceStore().getString(preferenceName);
+		return info;
+	}
+	
+	protected void saveModel() {
+		String info = createPreference();
+		getPreferenceStore().setValue(preferenceName, info);
+	}
+
+	/**
+	 * @return
+	 */
+	private String createPreference() {
+		String info = preferenceConverter.convertModelToPreference(model);
+		return info;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	public void createControl(Composite parent) {
+		composite = new Composite(parent, SWT.NONE);
+		setControl(composite);
+
+		GridLayout layout = new GridLayout(2, false);
+		layout.marginWidth = layout.marginHeight = 0;
+		composite.setLayout(layout);
+		
+		GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+		layoutData.horizontalSpan = 2;
+		composite.setLayoutData(layoutData);
+		
+		// left side is the table
+		Label label = new Label(composite, SWT.NONE);
+		label.setText("Shared folder mappings:");
+		GridData labelLayout = new GridData(SWT.LEFT, SWT.TOP, true, false);
+		labelLayout.horizontalSpan = 2;
+		label.setLayoutData(labelLayout);
+		
+		tableViewer = new SharedFolderTableViewer(composite, SWT.BORDER);
+		tableViewer.addEditors();
+		
+		GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+		tableLayoutData.heightHint = 64;
+		table = tableViewer.getTable();
+		table.setLayoutData(tableLayoutData);
+		
+		// right side is buttons
+		Composite buttonBox = new Composite(composite, SWT.NONE);
+		buttonBox.setLayout(new GridLayout());
+		GridData buttonLayoutData = new GridData(SWT.RIGHT, SWT.TOP, false, false);
+		buttonLayoutData.verticalSpan = 2;
+		buttonBox.setLayoutData(buttonLayoutData);
+		
+		addButton = new Button(buttonBox, SWT.PUSH);
+		addButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+		addButton.setText("Add");
+		addButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				doAdd();
+			}
+		});
+		
+		removeButton = new Button(buttonBox, SWT.PUSH);
+		removeButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+		removeButton.setText("Remove");
+		removeButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				doRemove();
+			}
+		});
+		
+		tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+			/* (non-Javadoc)
+			 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+			 */
+			public void selectionChanged(SelectionChangedEvent event) {
+				removeButton.setEnabled(!event.getSelection().isEmpty());
+			}
+		});
+		
+		loadModel(false);
+	}
+
+	/**
+	 * 
+	 */
+	protected void doAdd() {
+		ISharedFolder share = new BaseSharedFolder(Path.EMPTY, Path.EMPTY, false);
+		model.add(share);
+		tableViewer.refresh();
+		tableViewer.setSelection(new StructuredSelection(share));
+		tableViewer.editElement(share, 0);
+	}
+	
+	protected void doRemove() {
+		IStructuredSelection ss = (IStructuredSelection) tableViewer.getSelection();
+		if (ss.isEmpty())
+			return;
+		model.remove(ss.getFirstElement());
+		tableViewer.refresh();
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+		// createControl() does all the work; this is a sub-preference page which doesn't have
+		// a description or buttons
+		return null;
+	}
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.core.machine.IComposablePreferencePage#getComposite()
+	 */
+	public Composite getComposite() {
+		return composite;
+	}
+}


Property changes on: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/SharedFoldersPreferencePage.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java (from rev 941, branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/ValidateMachineRunner.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -0,0 +1,355 @@
+/*******************************************************************************
+ * 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.maemosdk.ui.preferences;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.console.MessageConsole;
+import org.maemo.mica.common.core.*;
+import org.maemo.mica.common.core.machine.*;
+import org.maemo.mica.common.core.process.*;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.core.sdk.SDKFactory;
+
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * This class validates that a machine is properly configured.
+ * @author eswartz
+ *
+ */
+public class ValidateMachineRunner implements IRunnableWithProgress {
+
+	private IMachine machine;
+
+	public ValidateMachineRunner(Shell shell, IMachine machine) {
+		this.shell = shell;
+		this.machine = machine;
+	}
+	
+	private Shell shell;
+
+	protected void fail(final String msg, final Object... param) {
+		Display.getDefault().syncExec(new Runnable() {
+
+			public void run() {
+				MessageDialog.openError(shell, "Validation Failure", MessageFormat.format(msg, param));
+			}
+			
+		});
+	}
+	
+	protected void info(final String msg, final Object... param) {
+		Display.getDefault().syncExec(new Runnable() {
+
+			public void run() {
+				MessageDialog.openInformation(shell, "Validation Information", MessageFormat.format(msg, param));
+			}
+			
+		});
+	}
+	
+	protected void warn(final String msg, final Object... param) {
+		Display.getDefault().syncExec(new Runnable() {
+
+			public void run() {
+				MessageDialog.openWarning(shell, "Validation Information", MessageFormat.format(msg, param));
+			}
+			
+		});
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public void run(IProgressMonitor monitor) throws InvocationTargetException,
+			InterruptedException {
+		if (monitor == null)
+			monitor = new NullProgressMonitor();
+		
+		monitor.beginTask("Testing machine ''" + machine.getName() + "''", 10);
+		
+		if (!testMachineRunning(machine))
+			return;
+		monitor.worked(1);
+		if (monitor.isCanceled())
+			return;
+
+		if (!testProcessLaunching(machine))
+			return;
+		monitor.worked(1);
+		if (monitor.isCanceled())
+			return;
+		
+		if (!testBasicFileSystem(machine))
+			return;
+		monitor.worked(1);
+		if (monitor.isCanceled())
+			return;
+		
+		if (!testSharedFolders(monitor))
+			return;
+		
+		info("Everything seems to work!");
+		monitor.done();
+	}
+
+	/**
+	 * @param machine
+	 */
+	private boolean testMachineRunning(final IMachine machine) {
+		// make sure it's running
+		final IStatus[] statuses = { null };
+		ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
+		try {
+			dialog.run(true, true, new IRunnableWithProgress() {
+
+				public void run(IProgressMonitor monitor)
+						throws InvocationTargetException, InterruptedException {
+					statuses[0] = MachineManager.getInstance().acquireMachine(machine, null);
+				}
+				
+			});
+		} catch (InvocationTargetException e) {
+			fail(e.getMessage());
+		} catch (InterruptedException e) {
+			fail(e.getMessage());
+		}
+		IStatus status = statuses[0];
+		if (!status.isOK()) {
+			if (status.getSeverity() == IStatus.ERROR) {
+				fail("Failed to launch or revive the virtual build machine:\n\n{0}", status.getMessage());
+				return false;
+			}
+			fail("The virtual build machine is not well, going to continue anyway...:\n\n{0}", status.getMessage());
+		}
+		return true;
+	}
+
+	/**
+	 * @param machine
+	 */
+	private boolean testProcessLaunching(final IMachine machine) {
+		// check the process launcher
+		IProcessLauncherFactory processLauncherFactory = machine.getProcessLauncherFactory();
+		IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, 
+				"ls " + machine.getUserHome());
+		MessageConsole console = CoreConsoleManager.getInstance().getConsole(true, null, "Virtual machine ~devel home directory listing");
+		
+		Process process;
+		try {
+			process = processLauncher.createProcess();
+		} catch (MicaException e) {
+			fail("Could not run 'ls' on " + machine.getUserHome() + " directory.\nIf SSH connections to machine are failing, ensure the \nrun_linux_wait.bat script (in the plugin) has not been modified\nand that the virtual machine has booted properly:\n{0}", 
+					e);
+			return false;
+		}
+		processLauncher.redirectToConsole(console);
+		
+		try {
+			process.waitFor();
+		} catch (InterruptedException e) {
+					
+		}
+		
+		return true;
+	}
+
+	/**
+	 * @param machine
+	 */
+	private boolean testBasicFileSystem(final IMachine machine) {
+		// check the basic filesystem access
+		IFileStore store = machine.getFileSystemAccess().getFileStore(machine.getUserHome());
+		if (!store.fetchInfo().exists()) {
+			fail("Could not access ''{0}'' over SSH filesystem.\n\nThis is probably a serious problem because the home directory for this user should exist.",
+					store);
+			return false;
+		}
+		
+		// see if the workspace is visible on the machine
+		IPath workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+		IPath remoteWorkspace = machine.getFileSystemMapping().convertHostToTargetPath(workspaceRoot);
+		if (remoteWorkspace == null) {
+			warn("Could not access the workspace root on the build machine.\n\nThis will usually complicate new project creation.\n\nPlease place the workspace somewhere under\n'c:/sources/shared' for best results.");
+		}
+		return true;
+	}
+
+	/**
+	 * Check that the shares defined for the machine are mounted and usable
+	 * @param monitor
+	 * @return
+	 */
+	private boolean testSharedFolders(IProgressMonitor monitor) {
+		ISharedFilesystemProvider sharedFilesystemProvider = machine.getSharedFilesystemProvider();
+		if (sharedFilesystemProvider == null)
+			return true;
+		
+		List<ISharedFolder> sharedFolders = sharedFilesystemProvider.getSharedFolders();
+		monitor.beginTask("Checking shared folders", sharedFolders.size());
+		
+		boolean succeeded = true;
+		for (ISharedFolder share : sharedFolders) {
+			succeeded &= testSharedFolder(new SubProgressMonitor(monitor, 1), share);
+		}
+		monitor.done();
+		return succeeded;
+	}
+
+	private boolean testSharedFolder(IProgressMonitor monitor, ISharedFolder share) {
+		IPath host = share.getLocalPath();
+		IPath remote = share.getRemotePath();
+		
+		// check the shared folder
+		monitor.beginTask("Checking " + host + " -> " + remote, 5);
+		
+		IPath localFilePath = host.append("__testfile.txt");
+		IFileStore localStore = EFS.getLocalFileSystem().getStore(
+				localFilePath);
+		IPath remoteFilePath = remote.append("__testfile.txt"); 
+		IFileStore remoteStore = machine.getFileSystemAccess().getFileStore(
+				remoteFilePath);
+	
+		monitor.worked(1);
+		if (monitor.isCanceled())
+			return false;
+	
+		try {
+			localStore.delete(0, null);
+		} catch (CoreException e) {
+		}
+	
+		// in case the filesystem is NOT shared, don't falsely detect a similar file on the VM's local filesystem
+		try {
+			remoteStore.delete(0, null);
+			remoteStore.fetchInfo();
+		} catch (CoreException e) {
+		}
+		
+		OutputStream os;
+		try {
+			os = localStore.openOutputStream(EFS.OVERWRITE, null);
+			os.write("Contents\n".getBytes());
+			Policy.close(os);
+		} catch (Exception e) {
+			fail("Could not create local test file ''{0}''.\n\nThis is a serious problem.",
+					localStore);
+			return false;
+		}
+		monitor.worked(1);
+		if (monitor.isCanceled())
+			return false;
+		
+		// wait a little while for samba to notice, or else it looks like the file doesn't exist (:p !!!)
+		try {
+			Thread.sleep(1000);
+		} catch (InterruptedException e1) {
+		}
+		remoteStore = machine.getFileSystemAccess().getFileStore(remoteFilePath);
+		if (!remoteStore.fetchInfo().exists()) {
+			fail("Could not access {0} over SSH filesystem.\n\nThis file should be visible since we created it locally and this location\nis assumed to be shared at {1}.\n\nPlease log in to the machine and invoke ''sh mount_share.sh''.\n",
+					remoteStore, localStore);
+			return false;
+		}
+		monitor.worked(1);
+		if (monitor.isCanceled())
+			return false;
+		
+		if (!share.isAlias()) {
+			if (!testScratchboxTargets(remoteFilePath.toPortableString()))
+				return false;
+		}
+		monitor.worked(1);
+		if (monitor.isCanceled())
+			return false;
+		
+		try {
+			localStore.delete(0, null);
+		} catch (CoreException e) {
+		}
+		
+		monitor.worked(1);
+		monitor.done();
+	
+		return true;
+	}
+
+	/**
+	 * 
+	 */
+	private boolean testScratchboxTargets(String path) {
+		IFileStore remoteStore;
+		
+		SDKFactory.getInstance().waitForRefreshComplete(null);
+		ISDKTarget[] sdkTargets = SDKFactory.getInstance().getAllSDKTargets();
+		
+		
+		if (countMachineProvidedTargets(sdkTargets) == 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 {
+						SDKFactory.getInstance().refresh(true);
+						SDKFactory.getInstance().waitForRefreshComplete(monitor);
+					}
+					
+				});
+			} catch (Exception e) {
+				fail("Failed to refresh installed targets:\n{0}", e.getMessage());
+				return false;
+			}
+
+			sdkTargets = SDKFactory.getInstance().getAllSDKTargets();
+			if (countMachineProvidedTargets(sdkTargets) == 0) {
+				fail("Failed to find any installed targets in this machine... it is probably misconfigured or broken.");
+				return false;
+			}
+		}
+
+		// make sure we can see the shared folder in all targets
+		for (ISDKTarget target : sdkTargets) {
+			// now test the file
+			remoteStore = target.getTargetFileSystemAccess().getFileStore(new Path(path));
+			if (!remoteStore.fetchInfo().exists()) {
+				fail("Could not access ''{0}'' inside build target ''{1}''.\n\nThis file should be visible since it is shared and accessible from the user''s home.\n\nEither there is a missing ''bind'' mount making this folder visible to scratchbox,\nor something else is broken.",
+						remoteStore, target);
+				return false;
+			}
+		}
+		
+		return true;
+	}
+
+	private int countMachineProvidedTargets(ISDKTarget[] sdkTargets) {
+		int count = 0;
+		for (ISDKTarget sdkTarget : sdkTargets)
+			if (sdkTarget.getSDK().getMachine().equals(machine))
+				count++;
+		return count;
+	}
+
+}


Property changes on: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/ValidateMachineRunner.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/BuildMachinePreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/BuildMachinePreferencePage.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/BuildMachinePreferencePage.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -24,6 +24,7 @@
 import org.eclipse.swt.widgets.*;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.maemo.esbox.internal.api.maemosdk.ui.preferences.ValidateMachineRunner;
 import org.maemo.esbox.internal.maemosdk.ui.UIActivator;
 import org.maemo.mica.common.core.machine.*;
 
@@ -55,6 +56,13 @@
 	 * 
 	 */
 	public BuildMachinePreferencePage() {
+		setupMachineInfo();
+	}
+	
+	/**
+	 * 
+	 */
+	private void setupMachineInfo() {
 		// first, ensure we scan the build machines (establishing defaults, etc)
 		MachineRegistry.getInstance().getBuildMachines();
 		
@@ -94,8 +102,9 @@
 			originalSelectedMachine = selectedMachine = (IBuildMachine) machine;
 			break;
 		}
+		
 	}
-	
+
 	/* (non-Javadoc)
 	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
 	 */
@@ -275,12 +284,13 @@
 			MachineRegistry.getInstance().refreshBuildMachines();
 		}
 		
-		if (originalSelectedMachine != selectedMachine) {
-			MachineRegistry.getInstance().setCurrentBuildMachine((IBuildMachine) selectedMachine);
-			changed = true;
+		// these objects refer to the old values, so we compare them to detect a change,
+		// but a change in prefs also requires a new machine instance
+		if (changed || originalSelectedMachine != selectedMachine) {
+			setupMachineInfo();
+			MachineRegistry.getInstance().setCurrentBuildMachine(selectedMachine.getName());
 		}
 		
-		originalSelectedMachine = selectedMachine;
 	}
 	
 	/* (non-Javadoc)

Deleted: branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/ValidateMachineRunner.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/ValidateMachineRunner.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/preferences/ValidateMachineRunner.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -1,314 +0,0 @@
-/*******************************************************************************
- * 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.maemosdk.ui.preferences;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.console.MessageConsole;
-import org.maemo.mica.common.core.*;
-import org.maemo.mica.common.core.machine.IMachine;
-import org.maemo.mica.common.core.machine.MachineManager;
-import org.maemo.mica.common.core.process.*;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
-import org.maemo.mica.common.core.sdk.SDKFactory;
-
-import java.io.OutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-
-/**
- * This class validates that a machine is properly configured.
- * @author eswartz
- *
- */
-public class ValidateMachineRunner implements IRunnableWithProgress {
-
-	private IMachine machine;
-
-	public ValidateMachineRunner(Shell shell, IMachine machine) {
-		this.shell = shell;
-		this.machine = machine;
-	}
-	
-	private Shell shell;
-
-	protected void fail(final String msg, final Object... param) {
-		Display.getDefault().syncExec(new Runnable() {
-
-			public void run() {
-				MessageDialog.openError(shell, "Validation Failure", MessageFormat.format(msg, param));
-			}
-			
-		});
-	}
-	
-	protected void info(final String msg, final Object... param) {
-		Display.getDefault().syncExec(new Runnable() {
-
-			public void run() {
-				MessageDialog.openInformation(shell, "Validation Information", MessageFormat.format(msg, param));
-			}
-			
-		});
-	}
-	
-	protected void warn(final String msg, final Object... param) {
-		Display.getDefault().syncExec(new Runnable() {
-
-			public void run() {
-				MessageDialog.openWarning(shell, "Validation Information", MessageFormat.format(msg, param));
-			}
-			
-		});
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
-	 */
-	public void run(IProgressMonitor monitor) throws InvocationTargetException,
-			InterruptedException {
-		if (monitor == null)
-			monitor = new NullProgressMonitor();
-		
-		monitor.beginTask("Testing machine ''" + machine.getName() + "''", 10);
-		
-		if (!testMachineRunning(machine))
-			return;
-		monitor.worked(1);
-		if (monitor.isCanceled())
-			return;
-
-		if (!testProcessLaunching(machine))
-			return;
-		monitor.worked(1);
-		if (monitor.isCanceled())
-			return;
-		
-		if (!testBasicFileSystem(machine))
-			return;
-		monitor.worked(1);
-		if (monitor.isCanceled())
-			return;
-		
-		// check the shared folder
-		// XXX: the specific directories are a hack and should be accessible through IMachine API
-		IFileStore localStore = EFS.getLocalFileSystem().getStore(new Path("c:/sources/shared/__testfile.txt"));
-		IFileStore remoteStore = machine.getFileSystemAccess().getFileStore(new Path("/home/devel/shared/__testfile.txt"));
-
-		monitor.worked(1);
-		if (monitor.isCanceled())
-			return;
-
-		try {
-			localStore.delete(0, null);
-		} catch (CoreException e) {
-		}
-
-		// in case the filesystem is NOT shared, don't falsely detect a similar file on the VM's local filesystem
-		try {
-			remoteStore.delete(0, null);
-			remoteStore.fetchInfo();
-		} catch (CoreException e) {
-		}
-		
-		OutputStream os;
-		try {
-			os = localStore.openOutputStream(EFS.OVERWRITE, null);
-			os.write("Contents\n".getBytes());
-			Policy.close(os);
-		} catch (Exception e) {
-			fail("Could not create local test file ''{0}''.\n\nThis is a serious problem.",
-					localStore);
-			return;
-		}
-		monitor.worked(1);
-		if (monitor.isCanceled())
-			return;
-		
-		// wait a little while for samba to notice, or else it looks like the file doesn't exist (:p !!!)
-		try {
-			Thread.sleep(1000);
-		} catch (InterruptedException e1) {
-		}
-		remoteStore = machine.getFileSystemAccess().getFileStore(new Path("/home/devel/shared/__testfile.txt"));
-		if (!remoteStore.fetchInfo().exists()) {
-			fail("Could not access {0} over SSH filesystem.\n\nThis file should be visible since we created it locally and this location\nis assumed to be shared at {1}.\n\nPlease log in to the machine and invoke ''sh mount_share.sh''.\n",
-					remoteStore, localStore);
-			return;
-		}
-		monitor.worked(1);
-		if (monitor.isCanceled())
-			return;
-		
-		if (!testScratchboxTargets("/home/devel/shared/__testfile.txt"))
-			return;
-		monitor.worked(1);
-		if (monitor.isCanceled())
-			return;
-		
-		try {
-			localStore.delete(0, null);
-		} catch (CoreException e) {
-		}
-		
-		info("Everything seems to work!");
-		monitor.done();
-	}
-
-	/**
-	 * @param machine
-	 */
-	private boolean testMachineRunning(final IMachine machine) {
-		// make sure it's running
-		final IStatus[] statuses = { null };
-		ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
-		try {
-			dialog.run(true, true, new IRunnableWithProgress() {
-
-				public void run(IProgressMonitor monitor)
-						throws InvocationTargetException, InterruptedException {
-					statuses[0] = MachineManager.getInstance().acquireMachine(machine, null);
-				}
-				
-			});
-		} catch (InvocationTargetException e) {
-			fail(e.getMessage());
-		} catch (InterruptedException e) {
-			fail(e.getMessage());
-		}
-		IStatus status = statuses[0];
-		if (!status.isOK()) {
-			if (status.getSeverity() == IStatus.ERROR) {
-				fail("Failed to launch or revive the virtual build machine:\n{0}", status);
-				return false;
-			}
-			fail("The virtual build machine is not well, going to continue anyway...:\n{0}", status);
-		}
-		return true;
-	}
-
-	/**
-	 * @param machine
-	 */
-	private boolean testProcessLaunching(final IMachine machine) {
-		// check the process launcher
-		IProcessLauncherFactory processLauncherFactory = machine.getProcessLauncherFactory();
-		IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, 
-				"ls " + machine.getUserHome());
-		MessageConsole console = CoreConsoleManager.getInstance().getConsole(true, null, "Virtual machine ~devel home directory listing");
-		
-		Process process;
-		try {
-			process = processLauncher.createProcess();
-		} catch (MicaException e) {
-			fail("Could not run 'ls' on " + machine.getUserHome() + " directory.\nIf SSH connections to machine are failing, ensure the \nrun_linux_wait.bat script (in the plugin) has not been modified\nand that the virtual machine has booted properly:\n{0}", 
-					e);
-			return false;
-		}
-		processLauncher.redirectToConsole(console);
-		
-		try {
-			process.waitFor();
-		} catch (InterruptedException e) {
-					
-		}
-		
-		return true;
-	}
-
-	/**
-	 * @param machine
-	 */
-	private boolean testBasicFileSystem(final IMachine machine) {
-		// check the basic filesystem access
-		IFileStore store = machine.getFileSystemAccess().getFileStore(machine.getUserHome());
-		if (!store.fetchInfo().exists()) {
-			fail("Could not access ''{0}'' over SSH filesystem.\n\nThis is probably a serious problem because the home directory for this user should exist.",
-					store);
-			return false;
-		}
-		
-		// see if the workspace is visible on the machine
-		IPath remoteWorkspace = machine.getFileSystemMapping().convertHostToTargetPath(ResourcesPlugin.getWorkspace().getRoot().getLocation());
-		if (remoteWorkspace == null) {
-			// XXX TODO: need an API for finding the actual share points
-			warn("Could not access the workspace root on the build machine.\n\nThis will usually complicate new project creation.\n\nPlease place the workspace somewhere under\n'c:/sources/shared' for best results.");
-		}
-		return true;
-	}
-
-	/**
-	 * 
-	 */
-	private boolean testScratchboxTargets(String path) {
-		IFileStore remoteStore;
-		
-		SDKFactory.getInstance().waitForRefreshComplete(null);
-		ISDKTarget[] sdkTargets = SDKFactory.getInstance().getAllSDKTargets();
-		
-		
-		if (countMachineProvidedTargets(sdkTargets) == 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 {
-						SDKFactory.getInstance().refresh(true);
-						SDKFactory.getInstance().waitForRefreshComplete(monitor);
-					}
-					
-				});
-			} catch (Exception e) {
-				fail("Failed to refresh installed targets:\n{0}", e.getMessage());
-				return false;
-			}
-
-			sdkTargets = SDKFactory.getInstance().getAllSDKTargets();
-			if (countMachineProvidedTargets(sdkTargets) == 0) {
-				fail("Failed to find any installed targets in this machine... it is probably misconfigured or broken.");
-				return false;
-			}
-		}
-
-		// make sure we can see the shared folder in all targets
-		for (ISDKTarget target : sdkTargets) {
-			// now test the file
-			remoteStore = target.getTargetFileSystemAccess().getFileStore(new Path(path));
-			if (!remoteStore.fetchInfo().exists()) {
-				fail("Could not access '{0}' inside build target '{1}'.\n\nThis file should be visible since it is shared and accessible from the user's home.\n\nEither there is a missing 'bind' mount making this folder visible to scratchbox,\nor something else is broken.",
-						remoteStore, target);
-				return false;
-			}
-		}
-		
-		return true;
-	}
-
-	private int countMachineProvidedTargets(ISDKTarget[] sdkTargets) {
-		int count = 0;
-		for (ISDKTarget sdkTarget : sdkTargets)
-			if (sdkTarget.getSDK().getMachine() == machine)
-				count++;
-		return count;
-	}
-
-}

Modified: branches/work_Ed/org.maemo.esbox.vm/conf/vm_prefs.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/conf/vm_prefs.xml	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/conf/vm_prefs.xml	2008-11-17 14:40:17 UTC (rev 942)
@@ -10,7 +10,7 @@
 	<entry key="VM_SSH_TARGET_ADDR">127.0.0.1</entry>
 	<entry key="VM_SSH_TARGET_PORT">2222</entry>
 	<entry key="VM_SSH_HOST_ADDR">10.0.2.2</entry>
-	<entry key="VM_CIFS_TARGET_PORT">445</entry>
+	<entry key="VM_CIFS_TARGET_PORT">4445</entry>
 	
 	<entry key="VM_SHARED_FOLDERS_WIN32">c:\maemo\shared=/home/maemo/shared,c:\maemo\shared=/scratchbox/users/maemo/home/maemo/shared</entry>
 	<entry key="VM_SHARED_FOLDERS_UNIX">/home/${USER}/maemo/shared=/home/maemo/shared,/home/${USER}/maemo/shared=/scratchbox/users/maemo/home/maemo/shared</entry>

Modified: branches/work_Ed/org.maemo.esbox.vm/plugin.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/plugin.xml	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/plugin.xml	2008-11-17 14:40:17 UTC (rev 942)
@@ -6,9 +6,9 @@
       <command
             categoryId="org.eclipse.ui.category.help"
             defaultHandler="org.maemo.esbox.internal.vm.ui.actions.ValidateVirtualMachineCommand"
-            description="Validate launching and communication with ESbox virtual machine"
+            description="Validate launching and communication with ESbox build machines"
             id="org.maemo.esbox.vm.validateVirtualMachineCommand"
-            name="Validate ESbox Virtual Machine">
+            name="Validate ESbox Build Machines">
       </command>
    </extension>
    <extension
@@ -19,7 +19,7 @@
                commandId="org.maemo.esbox.vm.validateVirtualMachineCommand"
                mnemonic="V"
                style="push"
-               tooltip="Run to ensure that the virtual machine build host is properly configured.">
+               tooltip="Run to ensure that the build machine is properly configured.">
          </command>
       </menuContribution>
    </extension>

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/core/BasePreferenceVirtualMachineConfiguration.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -11,13 +11,17 @@
 
 package org.maemo.esbox.internal.api.vm.core;
 
+import org.maemo.esbox.internal.api.maemosdk.ui.preferences.SharedFolderPreferenceConverter;
 import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.esbox.vm.core.VirtualMachinePreferenceConstants;
 import org.maemo.mica.common.core.CorePreferenceManager;
 import org.maemo.mica.common.core.machine.ISharedFilesystemProvider;
-import org.maemo.mica.internal.api.common.core.machine.StockSharedFilesystemProvider;
+import org.maemo.mica.common.core.machine.ISharedFolder;
+import org.maemo.mica.internal.api.common.core.machine.BaseSharedFilesystemProvider;
 import org.maemo.mica.protocol.ssh.SSHConfiguration;
 
+import java.util.List;
+
 /**
  * Basic implementation of {@link IVirtualMachineConfiguration} that reads preferences.
  * @author eswartz
@@ -66,7 +70,9 @@
 	}
 
 	public ISharedFilesystemProvider getSharedFilesystemProvider() {
-		return new StockSharedFilesystemProvider(getUserName());
+		SharedFolderPreferenceConverter converter = new SharedFolderPreferenceConverter();
+		List<ISharedFolder> sharedFolders = converter.convertPreferenceToModel(getPreference(VirtualMachinePreferenceConstants.VM_SHARED_FOLDERS));
+		return new BaseSharedFilesystemProvider(sharedFolders);
 	}
 
 }

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	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/BaseVirtualMachinePreferencePage.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -12,6 +12,8 @@
 package org.maemo.esbox.internal.api.vm.ui.preferences;
 
 import org.eclipse.swt.graphics.Point;
+import org.maemo.esbox.internal.api.maemosdk.ui.preferences.SharedFoldersPreferencePage;
+import org.maemo.esbox.vm.core.VirtualMachinePreferenceConstants;
 import org.maemo.mica.common.core.machine.IComposablePreferencePage;
 import org.maemo.mica.common.ui.preferences.ComposedPreferencePage;
 
@@ -36,7 +38,8 @@
 		addPage(vmPrefPage);
 		commonPrefPage = new CommonVirtualMachineSettingsPreferencePage();
 		addPage(commonPrefPage);
-		sharedFoldersPrefPage = new SharedFoldersPreferencePage();
+		sharedFoldersPrefPage = new SharedFoldersPreferencePage(VirtualMachinePreferenceConstants.getPreferenceStore(),
+				VirtualMachinePreferenceConstants.VM_SHARED_FOLDERS);
 		addPage(sharedFoldersPrefPage);
 	}
 

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	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/CommonVirtualMachineSettingsPreferencePage.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -30,6 +30,7 @@
 	private StringFieldEditor feSshTargetAddr;
 	private IntegerFieldEditor feSshTargetPort;
 	private StringFieldEditor feSshHostAddr;
+	private IntegerFieldEditor feCifsHostPort;
 
 	public CommonVirtualMachineSettingsPreferencePage() {
 		super();
@@ -99,6 +100,15 @@
 		text = feSshHostPort.getTextControl(getFieldEditorParent());
 		text.setToolTipText("Specify the SSH port visible in the machine.\nThis may be different from the port seen inside the machine,\nespecially if the port is redirected to be visible to the host.");
 		 */
+		feCifsHostPort = new IntegerFieldEditor(
+				VirtualMachinePreferenceConstants.VM_CIFS_TARGET_PORT,
+				"Target Samba port:",
+				getFieldEditorParent(),
+				5);
+		addField(feCifsHostPort);
+		text = feCifsHostPort.getTextControl(getFieldEditorParent());
+		text.setToolTipText("Specify the Samba/CIFS port used in the machine.\nThis may be different from the port seen outside the machine,\nespecially if the port is redirected to be visible to the host.");
+		
 	}
 
 }

Deleted: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderPreferenceConverter.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderPreferenceConverter.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderPreferenceConverter.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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.preferences;
-
-import com.nokia.cpp.internal.api.utils.core.Pair;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.maemo.mica.common.ui.preferences.IJFaceViewerFieldEditorConverter;
-
-import java.util.*;
-
-/**
- * Convert from/to string format to table format.  The input is a string like:
- * 
- * host=target[,...]
- * 
- * And the output is a Collection of Pair&lt;IPath, IPath&gt;
- * @author eswartz
- *
- */
-public class SharedFolderPreferenceConverter implements
-		IJFaceViewerFieldEditorConverter {
-
-	/* (non-Javadoc)
-	 * @see org.maemo.mica.common.ui.preferences.IJFaceViewerFieldEditorConverter#convertModelToPreference(java.lang.Object)
-	 */
-	public String convertModelToPreference(Object input) {
-		if (input == null)
-			return "";
-		
-		Collection<Pair<IPath, IPath>> elements = (Collection<Pair<IPath, IPath>>) input;
-		StringBuilder entries = new StringBuilder();
-		boolean first = true;
-		for (Pair<IPath, IPath> element : elements) {
-			if (element.first.isEmpty() && element.second.isEmpty())
-				continue;
-			String entry = element.first.toOSString() + "=" + element.second.toPortableString();
-			if (first)
-				first = false;
-			else
-				entries.append(',');
-			entries.append(entry);
-		}
-		return entries.toString();
-	}
-
-	/* (non-Javadoc)
-	 * @see org.maemo.mica.common.ui.preferences.IJFaceViewerFieldEditorConverter#convertPreferenceToModel(java.lang.String)
-	 */
-	public List<Pair<IPath, IPath>> convertPreferenceToModel(String preference) {
-		String[] entries = preference.split(",");
-		List<Pair<IPath, IPath>> elements = new ArrayList<Pair<IPath,IPath>>();
-		for (String entry : entries) {
-			String[] hostTarget = entry.split("=");
-			if (hostTarget.length == 2) {
-				elements.add(new Pair<IPath, IPath>(new Path(hostTarget[0]), new Path(hostTarget[1])));
-			}
-		}
-		return elements;
-	}
-
-}

Deleted: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderTableViewer.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderTableViewer.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFolderTableViewer.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * 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.preferences;
-
-import com.nokia.cpp.internal.api.utils.core.Pair;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-
-import java.util.Collection;
-
-/**
- * A table viewer for shared folder mappings.  The content should be Collection&lt;Pair&lt;IPath,IPath&gt;&gt;
- * @author eswartz
- *
- */
-public class SharedFolderTableViewer extends TableViewer {
-
-	private Collection<Pair<IPath, IPath>> mappings;
-	private TableColumn targetColumn;
-	private TableColumn hostColumn;
-	private TableViewerColumn hostViewerColumn;
-	private TableViewerColumn targetViewerColumn;
-	
-	public SharedFolderTableViewer(Composite parent, int style) {
-		super(parent, style | SWT.FULL_SELECTION | SWT.SINGLE);
-		
-		final Table table = getTable();
-		
-		table.setLinesVisible (true);
-		table.setHeaderVisible (true);
-		
-		hostColumn = new TableColumn(table, SWT.LEFT);
-		hostColumn.setText("Host");
-		hostColumn.pack();
-		
-		targetColumn = new TableColumn(table, SWT.LEFT);
-		targetColumn.setText("Target");
-		targetColumn.pack();
-		
-		hostViewerColumn = new TableViewerColumn(this, hostColumn);
-		hostViewerColumn.setLabelProvider(new ColumnLabelProvider() {
-			@Override
-			public String getText(Object element) {
-				Pair<IPath, IPath> entry = (Pair<IPath, IPath>) element;
-				return entry.first.toOSString();
-			}
-		});
-		targetViewerColumn = new TableViewerColumn(this, targetColumn);
-		targetViewerColumn.setLabelProvider(new ColumnLabelProvider() {
-			@Override
-			public String getText(Object element) {
-				Pair<IPath, IPath> entry = (Pair<IPath, IPath>) element;
-				return entry.second.toPortableString();
-			}
-		});
-		
-		table.addControlListener(new ControlAdapter() {
-			@Override
-			public void controlResized(ControlEvent e) {
-				int fullSize = table.getSize().x;
-				hostColumn.setWidth(fullSize / 2 - 3);
-				targetColumn.setWidth(fullSize / 2 - 3);
-			}
-		});
-		
-		setContentProvider(new ArrayContentProvider());
-	}
-
-	public Collection<Pair<IPath, IPath>> getMappings() {
-		return mappings;
-	}
-
-	/**
-	 * Add cell editors to the viewer.
-	 */
-	public void addEditors() {
-		hostViewerColumn.setEditingSupport(new EditingSupport(this) {
-
-			@Override
-			protected boolean canEdit(Object element) {
-				return true;
-			}
-
-			@Override
-			protected CellEditor getCellEditor(final Object element) {
-				// allow TAB to go to next field (table seems to hide this functionality away)
-				final TextCellEditor editor = new TextCellEditor(getTable());
-				((Text) editor.getControl()).addTraverseListener(new TraverseListener() {
-
-					public void keyTraversed(TraverseEvent e) {
-						editor.deactivate();
-						editElement(element, 1);
-					}
-					
-				});
-				return editor;
-			}
-
-			@Override
-			protected Object getValue(Object element) {
-				Pair<IPath, IPath> pair = (Pair<IPath, IPath>) element;
-				return pair.first.toOSString();
-			}
-
-			@Override
-			protected void setValue(Object element, Object value) {
-				Pair<IPath, IPath> pair = (Pair<IPath, IPath>) element;
-				pair.first = new Path(value.toString());
-				refresh(pair);
-			}
-			
-		});
-		
-		targetViewerColumn.setEditingSupport(new EditingSupport(this) {
-
-			@Override
-			protected boolean canEdit(Object element) {
-				return true;
-			}
-
-			@Override
-			protected CellEditor getCellEditor(Object element) {
-				return new TextCellEditor(getTable());
-			}
-
-			@Override
-			protected Object getValue(Object element) {
-				Pair<IPath, IPath> pair = (Pair<IPath, IPath>) element;
-				return pair.second.toPortableString();
-			}
-
-			@Override
-			protected void setValue(Object element, Object value) {
-				Pair<IPath, IPath> pair = (Pair<IPath, IPath>) element;
-				pair.second = new Path(value.toString());
-				refresh(pair);
-			}
-			
-		});
-	}
-}

Deleted: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFoldersPreferencePage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFoldersPreferencePage.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/api/vm/ui/preferences/SharedFoldersPreferencePage.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * 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.preferences;
-
-import com.nokia.cpp.internal.api.utils.core.Pair;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.maemo.esbox.vm.core.VirtualMachinePreferenceConstants;
-import org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage;
-
-import java.util.List;
-
-/**
- * This page is included inside a VirtualMachineSelectionPreferencePage
- * to configure the shared folder mappings between host and target.
- * @author eswartz
- *
- */
-public class SharedFoldersPreferencePage extends BaseComposablePreferencePage {
-
-	private SharedFolderTableViewer tableViewer;
-	private Composite composite;
-	private Button addButton;
-	private Button removeButton;
-	private Table table;
-	private SharedFolderPreferenceConverter preferenceConverter;
-	private List<Pair<IPath, IPath>> model;
-
-	public SharedFoldersPreferencePage() {
-		super();
-		setTitle("Shared folders");
-		setPreferenceStore(VirtualMachinePreferenceConstants.getPreferenceStore());
-		preferenceConverter = new SharedFolderPreferenceConverter();
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage#anyChanges()
-	 */
-	@Override
-	public boolean anyChanges() {
-		return super.anyChanges() || getStoredPreference(false).equals(createPreference());
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage#performDefaults()
-	 */
-	@Override
-	public void performDefaults() {
-		super.performDefaults();
-		loadModel(true);
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.maemo.mica.common.ui.preferences.BaseComposablePreferencePage#performApply()
-	 */
-	@Override
-	public void performApply() {
-		super.performApply();
-		saveModel();
-	}
-	
-	protected void loadModel(boolean isDefault) {
-		String info = getStoredPreference(isDefault);
-		model = preferenceConverter.convertPreferenceToModel(info);
-		tableViewer.setInput(model);
-	}
-
-	/**
-	 * @return
-	 */
-	private String getStoredPreference(boolean isDefault) {
-		String info;
-		if (isDefault)
-			info = getPreferenceStore().getDefaultString(VirtualMachinePreferenceConstants.VM_SHARED_FOLDERS);
-		else
-			info = getPreferenceStore().getString(VirtualMachinePreferenceConstants.VM_SHARED_FOLDERS);
-		return info;
-	}
-	
-	protected void saveModel() {
-		String info = createPreference();
-		getPreferenceStore().setValue(VirtualMachinePreferenceConstants.VM_SHARED_FOLDERS, info);
-	}
-
-	/**
-	 * @return
-	 */
-	private String createPreference() {
-		String info = preferenceConverter.convertModelToPreference(model);
-		return info;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
-	 */
-	@Override
-	public void createControl(Composite parent) {
-		composite = new Composite(parent, SWT.NONE);
-		setControl(composite);
-
-		GridLayout layout = new GridLayout(2, false);
-		layout.marginWidth = layout.marginHeight = 0;
-		composite.setLayout(layout);
-		
-		GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
-		layoutData.horizontalSpan = 2;
-		composite.setLayoutData(layoutData);
-		
-		// left side is the table
-		Label label = new Label(composite, SWT.NONE);
-		label.setText("Shared folder mappings:");
-		GridData labelLayout = new GridData(SWT.LEFT, SWT.TOP, true, false);
-		labelLayout.horizontalSpan = 2;
-		label.setLayoutData(labelLayout);
-		
-		tableViewer = new SharedFolderTableViewer(composite, SWT.BORDER);
-		tableViewer.addEditors();
-		
-		GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
-		tableLayoutData.heightHint = 64;
-		table = tableViewer.getTable();
-		table.setLayoutData(tableLayoutData);
-		
-		// right side is buttons
-		Composite buttonBox = new Composite(composite, SWT.NONE);
-		buttonBox.setLayout(new GridLayout());
-		GridData buttonLayoutData = new GridData(SWT.RIGHT, SWT.TOP, false, false);
-		buttonLayoutData.verticalSpan = 2;
-		buttonBox.setLayoutData(buttonLayoutData);
-		
-		addButton = new Button(buttonBox, SWT.PUSH);
-		addButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-		addButton.setText("Add");
-		addButton.addSelectionListener(new SelectionAdapter() {
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				doAdd();
-			}
-		});
-		
-		removeButton = new Button(buttonBox, SWT.PUSH);
-		removeButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-		removeButton.setText("Remove");
-		removeButton.addSelectionListener(new SelectionAdapter() {
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				doRemove();
-			}
-		});
-		
-		tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-			/* (non-Javadoc)
-			 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
-			 */
-			public void selectionChanged(SelectionChangedEvent event) {
-				removeButton.setEnabled(!event.getSelection().isEmpty());
-			}
-		});
-		
-		loadModel(false);
-	}
-
-	/**
-	 * 
-	 */
-	protected void doAdd() {
-		Pair<IPath, IPath> pair = new Pair<IPath, IPath>(Path.EMPTY, Path.EMPTY);
-		model.add(pair);
-		tableViewer.refresh();
-		tableViewer.setSelection(new StructuredSelection(pair));
-		tableViewer.editElement(pair, 0);
-	}
-	
-	protected void doRemove() {
-		IStructuredSelection ss = (IStructuredSelection) tableViewer.getSelection();
-		if (ss.isEmpty())
-			return;
-		model.remove(ss.getFirstElement());
-		tableViewer.refresh();
-	}
-
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
-	 */
-	@Override
-	protected Control createContents(Composite parent) {
-		// createControl() does all the work; this is a sub-preference page which doesn't have
-		// a description or buttons
-		return null;
-	}
-	/* (non-Javadoc)
-	 * @see org.maemo.mica.common.core.machine.IComposablePreferencePage#getComposite()
-	 */
-	public Composite getComposite() {
-		return composite;
-	}
-}

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ui/actions/ValidateVirtualMachineCommand.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ui/actions/ValidateVirtualMachineCommand.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/internal/vm/ui/actions/ValidateVirtualMachineCommand.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -12,27 +12,14 @@
 package org.maemo.esbox.internal.vm.ui.actions;
 
 import org.eclipse.core.commands.*;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.*;
 import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.console.MessageConsole;
-import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
-import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
-import org.maemo.esbox.vm.core.IVirtualMachine;
-import org.maemo.mica.common.core.*;
+import org.maemo.esbox.internal.api.maemosdk.ui.preferences.ValidateMachineRunner;
+import org.maemo.esbox.internal.vm.Activator;
 import org.maemo.mica.common.core.machine.*;
-import org.maemo.mica.common.core.process.*;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
-import org.maemo.mica.common.core.sdk.SDKFactory;
 
-import java.io.OutputStream;
-import java.lang.reflect.InvocationTargetException;
 import java.text.MessageFormat;
 
 /**
@@ -63,15 +50,6 @@
 		});
 	}
 	
-	protected void warn(final String msg, final Object... param) {
-		Display.getDefault().syncExec(new Runnable() {
-
-			public void run() {
-				MessageDialog.openWarning(getShell(), "Validation Information", MessageFormat.format(msg, param));
-			}
-			
-		});
-	}
 	/**
 	 * @return
 	 */
@@ -88,218 +66,27 @@
 		// find a virtual machine
 		boolean found = false;
 		
-		IMachine[] machines = MachineRegistry.getInstance().getBuildMachines();
-		for (IMachine machine : machines) {
-			if (machine instanceof IVirtualMachine) {
-				runVirtualMachineTests(machine);
-				found = true;
+		IBuildMachine[] machines = MachineRegistry.getInstance().getBuildMachines();
+		for (IBuildMachine machine : machines) {
+			ValidateMachineRunner runner = new ValidateMachineRunner(
+					shell, machine);
+			try {
+				runner.run(new NullProgressMonitor());
+			} catch (Exception e) {
+				Activator.getErrorLogger().logAndShowError("Unexpected exception running tests", e);
 			}
+			found = true;
 		}
 		
 		if (!found) {
-			if (Platform.getOS().equals(Platform.OS_WIN32))
-				fail("Cannot find a registered virtual build machine -- probably a build or packaging error.");
-			else
-				info("No virtual build machines used or needed on this platform.");
+			fail("No build machine registered -- please consult ESbox > Build Machines to configure.");
 			return null;
 		}
 
 		return null;
 	}
 
-	private Object runVirtualMachineTests(IMachine machine) {
-		if (!testVirtualMachineRunning(machine))
-			return null;
-
-		if (!testProcessLaunching(machine))
-			return null;
-		
-		if (!testBasicFileSystem(machine))
-			return null;
-		
-		// check the shared folder
-		// XXX: the specific directories are a hack and should be accessible through IMachine API
-		IFileStore localStore = EFS.getLocalFileSystem().getStore(new Path("c:/sources/shared/__testfile.txt"));
-		IFileStore remoteStore = machine.getFileSystemAccess().getFileStore(new Path("/home/devel/shared/__testfile.txt"));
-		
-		try {
-			localStore.delete(0, null);
-		} catch (CoreException e) {
-		}
-
-		// in case the filesystem is NOT shared, don't falsely detect a similar file on the VM's local filesystem
-		try {
-			remoteStore.delete(0, null);
-			remoteStore.fetchInfo();
-		} catch (CoreException e) {
-		}
-		
-		OutputStream os;
-		try {
-			os = localStore.openOutputStream(EFS.OVERWRITE, null);
-			os.write("Contents\n".getBytes());
-			Policy.close(os);
-		} catch (Exception e) {
-			fail("Could not create local test file ''{0}''.\n\nThis is a serious problem.",
-					localStore);
-			return null;
-		}
-		
-		// wait a little while for samba to notice, or else it looks like the file doesn't exist (:p !!!)
-		try {
-			Thread.sleep(1000);
-		} catch (InterruptedException e1) {
-		}
-		remoteStore = machine.getFileSystemAccess().getFileStore(new Path("/home/devel/shared/__testfile.txt"));
-		if (!remoteStore.fetchInfo().exists()) {
-			fail("Could not access {0} over SSH filesystem.\n\nThis file should be visible since we created it locally and this location\nis assumed to be shared at {1}.\n\nPlease log in to the machine and invoke ''sh mount_share.sh''.\n",
-					remoteStore, localStore);
-			return null;
-		}
-		
-		if (!testScratchboxTargets("/home/devel/shared/__testfile.txt"))
-			return null;
-		
-		try {
-			localStore.delete(0, null);
-		} catch (CoreException e) {
-		}
-		
-		info("Everything seems to work!");
-		return null;
-	}
-
 	/**
-	 * @param machine
-	 */
-	private boolean testVirtualMachineRunning(final IMachine machine) {
-		// make sure it's running
-		final IStatus[] statuses = { null };
-		ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
-		try {
-			dialog.run(true, true, new IRunnableWithProgress() {
-
-				public void run(IProgressMonitor monitor)
-						throws InvocationTargetException, InterruptedException {
-					statuses[0] = MachineManager.getInstance().acquireMachine(machine, null);
-				}
-				
-			});
-		} catch (InvocationTargetException e) {
-			fail(e.getMessage());
-		} catch (InterruptedException e) {
-			fail(e.getMessage());
-		}
-		IStatus status = statuses[0];
-		if (!status.isOK()) {
-			if (status.getSeverity() == IStatus.ERROR) {
-				fail("Failed to launch or revive the virtual build machine:\n{0}", status);
-				return false;
-			}
-			fail("The virtual build machine is not well, going to continue anyway...:\n{0}", status);
-		}
-		return true;
-	}
-
-	/**
-	 * @param machine
-	 */
-	private boolean testProcessLaunching(final IMachine machine) {
-		// check the process launcher
-		IProcessLauncherFactory processLauncherFactory = machine.getProcessLauncherFactory();
-		IProcessLauncher processLauncher = ProcessLauncherCreator.createProcessLauncher(processLauncherFactory, 
-				"ls " + machine.getUserHome());
-		MessageConsole console = CoreConsoleManager.getInstance().getConsole(true, null, "Virtual machine ~devel home directory listing");
-		
-		Process process;
-		try {
-			process = processLauncher.createProcess();
-		} catch (MicaException e) {
-			fail("Could not run 'ls' on " + machine.getUserHome() + " directory.\nIf SSH connections to machine are failing, ensure the \nrun_linux_wait.bat script (in the plugin) has not been modified\nand that the virtual machine has booted properly:\n{0}", 
-					e);
-			return false;
-		}
-		processLauncher.redirectToConsole(console);
-		
-		try {
-			process.waitFor();
-		} catch (InterruptedException e) {
-					
-		}
-		
-		return true;
-	}
-
-	/**
-	 * @param machine
-	 */
-	private boolean testBasicFileSystem(final IMachine machine) {
-		// check the basic filesystem access
-		IFileStore store = machine.getFileSystemAccess().getFileStore(machine.getUserHome());
-		if (!store.fetchInfo().exists()) {
-			fail("Could not access ''{0}'' over SSH filesystem.\n\nThis is probably a serious problem because the home directory for this user should exist.",
-					store);
-			return false;
-		}
-		
-		// see if the workspace is visible on the machine
-		IPath remoteWorkspace = machine.getFileSystemMapping().convertHostToTargetPath(ResourcesPlugin.getWorkspace().getRoot().getLocation());
-		if (remoteWorkspace == null) {
-			// XXX TODO: need an API for finding the actual share points
-			warn("Could not access the workspace root on the build machine.\n\nThis will usually complicate new project creation.\n\nPlease place the workspace somewhere under\n'c:/sources/shared' for best results.");
-		}
-		return true;
-	}
-
-	/**
-	 * 
-	 */
-	private boolean testScratchboxTargets(String path) {
-		IFileStore remoteStore;
-		
-		SDKFactory.getInstance().waitForRefreshComplete(null);
-		IScratchboxSDKTarget[] sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
-		
-		if (sdkTargets.length == 0) {
-			info("Could not locate any scratchbox SDK targets in virtual build machine.\n\nRetrying ...");
-			
-			ProgressMonitorDialog dlg2 = new ProgressMonitorDialog(getShell());
-			try {
-				dlg2.run(false, true, new IRunnableWithProgress() {
-
-					public void run(IProgressMonitor monitor)
-							throws InvocationTargetException, InterruptedException {
-						SDKFactory.getInstance().refresh(true);
-					}
-					
-				});
-			} catch (Exception e) {
-				fail("Failed to refresh Scratchbox SDKS:\n{0}", e.getMessage());
-				return false;
-			}
-
-			sdkTargets = ScratchboxSDKFacade.getInstance().getScratchboxSDKTargets();
-			if (sdkTargets.length < 4) {
-				fail("Failed to find all the expected scratchbox targets (wanted at least four)... the build machine is probably misconfigured or broken.");
-				return false;
-			}
-		}
-
-		// make sure we can see the shared folder in all targets
-		for (ISDKTarget target : sdkTargets) {
-			// now test the file
-			remoteStore = target.getTargetFileSystemAccess().getFileStore(new Path(path));
-			if (!remoteStore.fetchInfo().exists()) {
-				fail("Could not access {0} inside scratchbox target {1}.\n\nThis file should be visible since it is shared and accessible from the user's home.\n\nEither there is a missing 'bind' mount making this folder visible to scratchbox,\nor something else is broken.",
-						remoteStore, target);
-				return false;
-			}
-		}
-		
-		return true;
-	}
-
-	/**
 	 * @param applicationContext
 	 */
 	private void setupContext(Object applicationContext) {

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstants.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstants.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstants.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -44,4 +44,5 @@
 	 */
 	public static final String VM_SHARED_FOLDERS = "VM_SHARED_FOLDERS";
 
+	static final Class privateKeysClass = VirtualMachinePreferenceConstantsPrivate.class;
 }

Modified: branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstantsPrivate.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstantsPrivate.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm/src/org/maemo/esbox/vm/core/VirtualMachinePreferenceConstantsPrivate.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -16,7 +16,7 @@
  *
  */
 public class VirtualMachinePreferenceConstantsPrivate {
-	public static final String VM_SHARED_FOLDERS_WIN32 = "VM_SHARED_FOLDERS_WIN32";
-	public static final String VM_SHARED_FOLDERS_UNIX = "VM_SHARED_FOLDERS_UNIX";
+	static final String VM_SHARED_FOLDERS_WIN32 = "VM_SHARED_FOLDERS_WIN32";
+	static final String VM_SHARED_FOLDERS_UNIX = "VM_SHARED_FOLDERS_UNIX";
 
 }

Modified: branches/work_Ed/org.maemo.esbox.vm.qemu/conf/qemu_prefs.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.qemu/conf/qemu_prefs.xml	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/conf/qemu_prefs.xml	2008-11-17 14:40:17 UTC (rev 942)
@@ -6,7 +6,7 @@
 	see the org.maemo.mica.common.core.preference_set_provider extension</comment>
 	
 	<entry key="QEMU_MEMORY_SIZE">512</entry>
-	<entry key="QEMU_LAUNCH_PATTERN">"${QEMU}" -kernel-kqemu "${DISK_OPTIONS}" -usb -L "${INSTALL_PATH}" -m ${MEMORY} -redir tcp:${SSH_PORT}::22</entry>
+	<entry key="QEMU_LAUNCH_PATTERN">"${QEMU}" -kernel-kqemu "${DISK_OPTIONS}" -usb -L "${INSTALL_PATH}" -m ${MEMORY} -redir tcp:${SSH_PORT}::22 -redir tcp:445::${CIFS_PORT}</entry>
 
 	<entry key="QEMU_INSTALL_PATH_WIN32">c:/Program Files/QEMU</entry>
 	<entry key="QEMU_EXE_NAME_WIN32">qemu.exe</entry>

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	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachine.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -12,20 +12,21 @@
 
 import org.eclipse.core.runtime.*;
 import org.eclipse.jface.dialogs.IDialogConstants;
-import org.maemo.esbox.vm.core.*;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
 import org.maemo.esbox.vm.qemu.IQemuConfiguration;
 import org.maemo.mica.common.core.*;
 import org.maemo.mica.common.core.machine.*;
 import org.maemo.mica.common.core.process.*;
+import org.maemo.mica.common.core.process.ProcessLauncherUtils.Results;
 import org.maemo.mica.common.ui.dialogs.DialogUtils;
 import org.maemo.mica.common.ui.dialogs.PasswordInputDialog;
 import org.maemo.mica.internal.api.common.core.machine.IBuildMachineImpl;
 import org.maemo.mica.internal.api.protocol.ssh.SSHMachineBackend;
 
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.*;
 import java.text.MessageFormat;
-import java.util.Map;
+import java.util.List;
 
 
 /**
@@ -62,16 +63,15 @@
 		if (sharedFilesystemProvider == null)
 			return Status.OK_STATUS;
 		
-		Map<IPath, IPath> sharedFolders = 
-			sharedFilesystemProvider.getSharedFolders();
+		List<ISharedFolder> sharedFolders = sharedFilesystemProvider.getSharedFolders();
 		
 		monitor.beginTask("Validating shared folders", sharedFolders.size() * 2);
 		
 		boolean neededMount = false;
 		
 		String fsTypePattern = "smbfs|cifs";
-		for (Map.Entry<IPath, IPath> entry : sharedFolders.entrySet()) {
-			if (!isPathMounted(entry.getValue(), fsTypePattern, null)) {
+		for (ISharedFolder share : sharedFolders) {
+			if (!isPathMounted(share.getRemotePath(), fsTypePattern, null)) {
 				neededMount = true;
 				PasswordInputDialog dialog = new PasswordInputDialog(
 						DialogUtils.getShell(), 
@@ -79,7 +79,7 @@
 						MessageFormat.format(
 								"Enter the password for user ''{0}'' to mount the share ''{1}'':",
 								MachineRegistry.getInstance().getLocalMachine().getUserName(),
-								entry.getKey()));
+								share.getLocalPath()));
 				if (IDialogConstants.CANCEL_ID == dialog.open())
 					continue;
 				
@@ -90,7 +90,7 @@
 					return Activator.createErrorStatus(
 							MessageFormat.format(
 									"Could not mount ''{0}'' in {1}",
-									entry.getKey().toString(),
+									share.getLocalPath().toString(),
 									getName()), e);
 				}
 				
@@ -103,8 +103,8 @@
 		// verify that the mounting succeeded
 		boolean allSharesMounted = true;
 		if (neededMount) {
-			for (Map.Entry<IPath, IPath> entry : sharedFolders.entrySet()) {
-				if (!isPathMounted(entry.getValue(), fsTypePattern, null)) {
+			for (ISharedFolder share : sharedFolders) {
+				if (!isPathMounted(share.getRemotePath(), fsTypePattern, null)) {
 					allSharesMounted = false;
 				}
 				monitor.worked(1);
@@ -138,7 +138,7 @@
 						"mount_share.sh"));
 		
 		processLauncher.usePTY(true);
-		final Process process = processLauncher.createProcess();
+		//final Process process = processLauncher.createProcess();
 		final MicaException[] exceptions = { null };
 		
 		Thread thread = new Thread("Send password to mount") {
@@ -148,7 +148,7 @@
 			 */
 			@Override
 			public void run() {
-				try {
+				//try {
 					/* this goes to a weird stream (somehow) so we can't read it,
 					 even though it shows up when we put stuff to the Console!
 					InputStream is = process.getInputStream();
@@ -161,6 +161,22 @@
 					}
 					*/
 					
+					try {
+						Results results = ProcessLauncherUtils.launchAndReadStandardStreamsWithInput(processLauncher, 
+								new ByteArrayInputStream((password + "\n").getBytes()),
+								null);
+						String stdout = results.stdout.trim();
+						String stderr = results.stderr.replaceAll("Password:", "").trim();
+						if (results.exitCode != 0 || stdout.length() + stderr.length() > 0) {
+							exceptions[0] = new MicaException("Mounting script did not succeed:\n\n"
+									+ stdout + "\n" + stderr);
+						}
+					} catch (MicaException e) {
+						exceptions[0] = e;
+					}
+					System.out.println(exceptions[0]);
+					
+					/* this process adds noise to the console window without much use
 					// send password
 					OutputStream os = process.getOutputStream();
 					os.write((password + "\n").getBytes());
@@ -181,22 +197,23 @@
 					exceptions[0] = new MicaException("Failed to send password", e);
 					return;
 				}
+				*/
 			}
 		};
 		thread.start();
 		
 		boolean timedOut = !JobUtils.waitForThread(thread, 10000, null);
 
-		process.destroy();
+		//process.destroy();
 		
-		if (!thread.isAlive()) {
-			if (exceptions[0] != null) {
-				throw exceptions[0];
-			}
+		MicaException result = exceptions[0];
+		if (thread.isAlive())
+			thread.interrupt();
+		
+		if (result != null) {
+			throw result;
 		}
 		if (timedOut) {
-			if (thread.isAlive())
-				thread.interrupt();
 			throw new MicaException("Timeout sending password");
 		}
 	}

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	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuMachineController.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -344,41 +344,48 @@
 	 * @see org.maemo.mica.internal.common.core.machine.BaseMachineController#doAskUserToRepairMachine(org.eclipse.swt.widgets.Shell, org.eclipse.core.runtime.IStatus)
 	 */
 	@Override
-	protected Result doAskUserToRepairMachine(Shell shell, IStatus status) {
+	protected Result doAskUserToRepairMachine(Shell shell, final IStatus status) {
 		// see if QEMU *seems* to be running... i.e. something is listening on the SSH port
 		try {
 			Socket socket = new Socket(qemuConfiguration.getSSHConfiguration().getTargetIPAddress(),
 					qemuConfiguration.getSSHConfiguration().getTargetPort());
 			socket.close();
 			
-		
-			final boolean[] results = { false };
-			if (!WorkbenchUtils.isJUnitRunning()) {
-				Display.getDefault().syncExec(new Runnable() {
-		
-					public void run() {
-						results[0] = MessageDialog.openConfirm(null, "QEMU running?", 
-								MessageFormat.format(
-										"QEMU may still be running, but it seems to be halted or crashed\n"
-										+"(or something else owns the server socket {0}:{1}).\n\n"
-										+"Please kill it if necessary and select 'Ok' to retry.",
-										qemuConfiguration.getSSHConfiguration().getTargetIPAddress(), 
-										""+qemuConfiguration.getSSHConfiguration().getTargetPort()));
-					}
-					
-				});
-			}
-			
-			if (!results[0]) {
-				// canceled
-				return Result.ABORT;
-			}
-			return Result.RETRY;
-			
 		} catch (IOException e) {
 			// no one listening to the port, so probably qemu not running; ignore the error and keep trying
 			return Result.IGNORE;
 		}
+		
+		final boolean[] results = { false };
+		if (!WorkbenchUtils.isJUnitRunning()) {
+			Display.getDefault().syncExec(new Runnable() {
+	
+				public void run() {
+					results[0] = MessageDialog.openConfirm(null, "QEMU Problem",
+							MessageFormat.format(
+									"{0}\n\nCause:\n\n{1}\n\nRetry?",
+									status.getMessage(), status.getException().getMessage())
+									);
+					/*
+							MessageFormat.format(
+									
+									"QEMU may still be running, but it seems to be halted or crashed\n"
+									+"(or something else owns the server socket {0}:{1}).\n\n"
+									+"Please kill it if necessary and select 'Ok' to retry.",
+									qemuConfiguration.getSSHConfiguration().getTargetIPAddress(), 
+									""+qemuConfiguration.getSSHConfiguration().getTargetPort())
+					 */
+				}
+				
+			});
+		}
+		
+		if (!results[0]) {
+			// canceled
+			return Result.ABORT;
+		}
+		return Result.RETRY;
+
 	}
 
 	/* (non-Javadoc)
@@ -430,6 +437,7 @@
 		
 		try {
 			// try to ensure mounts are shared, but don't sync on this here
+			final IStatus[] subStatus = { null };
 			if (!isValidating) {
 				isValidating = true;
 				Runnable runnable = new Runnable() {
@@ -441,6 +449,7 @@
 							if (!status.isOK()) {
 								Activator.getErrorLogger().logError(status.getMessage(), status.getException());
 							}
+							subStatus[0] = status;
 						} finally {
 							isValidating = false;
 						}
@@ -457,6 +466,10 @@
 					runnable.run();
 			}
 			
+			// in case the runnable was synchronous
+			if (!isValidating && subStatus[0] != null)
+				return subStatus[0];
+			
 			return Status.OK_STATUS;
 		} finally {
 			monitor.worked(1);

Modified: branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuPreferenceConstantsPrivate.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuPreferenceConstantsPrivate.java	2008-11-14 14:01:39 UTC (rev 941)
+++ branches/work_Ed/org.maemo.esbox.vm.qemu/src/org/maemo/esbox/internal/vm/qemu/QemuPreferenceConstantsPrivate.java	2008-11-17 14:40:17 UTC (rev 942)
@@ -17,12 +17,12 @@
  *
  */
 public class QemuPreferenceConstantsPrivate {
-	public static final String QEMU_INSTALL_PATH_WIN32 = "QEMU_INSTALL_PATH_WIN32";
-	public static final String QEMU_EXE_NAME_WIN32 = "QEMU_EXE_NAME_WIN32";
-	public static final String QEMU_DISK_IMAGE_PATHS_WIN32 = "QEMU_DISK_IMAGE_PATHS_WIN32";
+	static final String QEMU_INSTALL_PATH_WIN32 = "QEMU_INSTALL_PATH_WIN32";
+	static final String QEMU_EXE_NAME_WIN32 = "QEMU_EXE_NAME_WIN32";
+	static final String QEMU_DISK_IMAGE_PATHS_WIN32 = "QEMU_DISK_IMAGE_PATHS_WIN32";
 	
-	public static final String QEMU_INSTALL_PATH_UNIX = "QEMU_INSTALL_PATH_UNIX";
-	public static final String QEMU_EXE_NAME_UNIX = "QEMU_EXE_NAME_UNIX";
-	public static final String QEMU_DISK_IMAGE_PATHS_UNIX = "QEMU_DISK_IMAGE_PATHS_UNIX";
+	static final String QEMU_INSTALL_PATH_UNIX = "QEMU_INSTALL_PATH_UNIX";
+	static final String QEMU_EXE_NAME_UNIX = "QEMU_EXE_NAME_UNIX";
+	static final String QEMU_DISK_IMAGE_PATHS_UNIX = "QEMU_DISK_IMAGE_PATHS_UNIX";
 
 }



More information about the Esbox-commits mailing list