[Esbox-commits] r1975 - in branches/work_Ed: org.maemo.esbox.scratchbox.sb1/META-INF org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard org.maemo.esbox.vm.vmware org.maemo.esbox.vm.vmware/META-INF org.maemo.esbox.vm.vmware/data org.maemo.esbox.vm.vmware/icons org.maemo.esbox.vm.vmware/icons/full org.maemo.esbox.vm.vmware/icons/full/etool16 org.maemo.esbox.vm.vmware/icons/full/wizban org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards

eswartz at garage.maemo.org eswartz at garage.maemo.org
Wed Aug 19 19:15:12 EEST 2009


Author: eswartz
Date: 2009-08-19 19:15:11 +0300 (Wed, 19 Aug 2009)
New Revision: 1975

Added:
   branches/work_Ed/org.maemo.esbox.vm.vmware/data/
   branches/work_Ed/org.maemo.esbox.vm.vmware/data/license.txt
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_48.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_64.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/wizban/
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/wizban/virtual_machine_wiz.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/ui/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java
Removed:
   branches/work_Ed/org.maemo.esbox.vm.vmware/data/license.txt
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_48.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_64.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/wizban/
   branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/wizban/virtual_machine_wiz.png
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/ui/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java
Modified:
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/META-INF/MANIFEST.MF
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java
   branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java
   branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF
   branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml
   branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java
Log:
Merge revs 1973:1974 from trunk

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/META-INF/MANIFEST.MF
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/META-INF/MANIFEST.MF	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/META-INF/MANIFEST.MF	2009-08-19 16:15:11 UTC (rev 1975)
@@ -19,4 +19,5 @@
 Export-Package: org.maemo.esbox.internal.scratchbox.sb1.command;x-friends:="org.maemo.esbox.scratchbox.tests",
  org.maemo.esbox.internal.scratchbox.sb1.core;x-friends:="org.maemo.esbox.scratchbox.tests,org.maemo.esbox.tests",
  org.maemo.esbox.internal.scratchbox.sb1.provider;x-friends:="org.maemo.esbox.scratchbox.tests",
+ org.maemo.esbox.internal.scratchbox.sb1.ui.wizard,
  org.maemo.esbox.scratchbox.sb1.sdk

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1SDKWizard.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -21,13 +21,18 @@
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
 import org.eclipse.jface.wizard.IWizardContainer;
 import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWizard;
 import org.maemo.esbox.internal.scratchbox.sb1.Activator;
 import org.maemo.esbox.internal.scratchbox.sb1.IHelpID;
@@ -246,6 +251,33 @@
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 	}
 	
+	/**
+	 * Starts a new Wizard instance
+	 * @param defaultTargets If not null the default selected targets will be these
+	 * 
+	 */
+	public static IStatus startWizard() {
+		IWorkbenchWindow activeWorkbenchWindow = Activator.getDefault()
+				.getWorkbench().getActiveWorkbenchWindow();
+		if (activeWorkbenchWindow == null) {
+			// action has been disposed
+			return Activator.createStatus(IStatus.ERROR, "Cannot open Scratchbox 1 SDK wizard");
+		}
+		
+		NewScratchbox1SDKWizard wizard = new NewScratchbox1SDKWizard();
+		wizard.init(activeWorkbenchWindow.getWorkbench(),
+				StructuredSelection.EMPTY);
+		Shell parent = activeWorkbenchWindow.getShell();
+		WizardDialog dialog = new WizardDialog(parent, wizard);
+		dialog.create();
+		int result = dialog.open();
+		if (result == Window.CANCEL)
+			return Activator.createStatus(IStatus.CANCEL, "Scratchbox 1 SDK installation was canceled");
+		else
+			return Activator.createStatus(IStatus.OK, "Scratchbox 1 SDK has finished");
+			
+	}
+	
 	public class Scratchbox1SDKInstallerWorkPage extends
 			Scratchbox1InstallerWorkPage {
 		private Label freeSpaceWarningLabel;

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/NewScratchbox1TargetWizard.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -20,9 +20,19 @@
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.*;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.*;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWizard;
 import org.maemo.esbox.internal.scratchbox.sb1.Activator;
 import org.maemo.esbox.internal.scratchbox.sb1.IHelpID;
 import org.maemo.esbox.internal.scratchbox.sb1.ui.wizard.nokiabin.NokiaBinariesInstallWizard;
@@ -216,4 +226,30 @@
 	 */
 	public void init(IWorkbench workbench, IStructuredSelection selection) {
 	}
-}
\ No newline at end of file
+	
+	/**
+	 * Starts a new Wizard instance
+	 * @param defaultTargets If not null the default selected targets will be these
+	 * 
+	 */
+	public static IStatus startWizard() {
+		IWorkbenchWindow activeWorkbenchWindow = Activator.getDefault()
+				.getWorkbench().getActiveWorkbenchWindow();
+		if (activeWorkbenchWindow == null) {
+			// action has been disposed
+			return Activator.createStatus(IStatus.ERROR, "Cannot open Scratchbox 1 SDK wizard");
+		}
+		
+		NewScratchbox1TargetWizard wizard = new NewScratchbox1TargetWizard();
+		wizard.init(activeWorkbenchWindow.getWorkbench(),
+				StructuredSelection.EMPTY);
+		Shell parent = activeWorkbenchWindow.getShell();
+		WizardDialog dialog = new WizardDialog(parent, wizard);
+		dialog.create();
+		int result = dialog.open();
+		if (result == Window.CANCEL)
+			return Activator.createStatus(IStatus.CANCEL, "Scratchbox 1 target installation was canceled");
+		else
+			return Activator.createStatus(IStatus.OK, "Scratchbox 1 target has finished");
+	}
+}

Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/ui/wizard/Scratchbox1SDKInstallerSelectionWizardPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -339,7 +339,7 @@
 					WARNING);
 		}
 		setPageComplete(true);
-		getWizard().setCanFinish(false);
+		getWizard().setCanFinish(true);
 	}
 
 	/* (non-Javadoc)

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/META-INF/MANIFEST.MF	2009-08-19 16:15:11 UTC (rev 1975)
@@ -12,7 +12,10 @@
  org.maemo.mica.protocol.ssh;bundle-version="2.0.0",
  org.maemo.esbox.vm;bundle-version="2.0.0",
  org.maemo.esbox.maemosdk.core;bundle-version="2.0.0",
- org.eclipse.cdt.core;bundle-version="5.0.2"
+ org.eclipse.cdt.core;bundle-version="5.0.2",
+ org.maemo.mica.linux.packages.ui;bundle-version="2.0.0",
+ org.maemo.mica.linux.packages.core;bundle-version="2.0.0",
+ org.maemo.esbox.scratchbox.sb1;bundle-version="2.0.0"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
 Export-Package: org.maemo.esbox.internal.vm.vmware;x-friends:="org.maemo.esbox.vm.tests",

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/data (from rev 1974, trunk/org.maemo.esbox.vm.vmware/data)

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/data/license.txt
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/data/license.txt	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/data/license.txt	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,251 +0,0 @@
-IMPORTANT: READ CAREFULLY BEFORE INSTALLING, DOWNLOADING, OR USING
-THE SOFTWARE
-
-This Software includes some software copyrighted by Nokia Corporation or
-third parties and some Open Source Software in binary form.
-
-The Software copyrighted by Nokia or some third parties is licensed to you
-under the Nokia End-User License Agreement [see below] and distributed to
-you only in binary form.
-
-The Open Source Software is licensed and distributed under GNU General
-Public License (GPL, the GNU lesser General Public License (LGPL, aka. The GNU
-Library General Public License) and/or other copyright licenses, permissions,
-notices or disclaimers containing obligation or permission to provide the
-source code of such software with the binary / executable form delivery of
-the said software. The source code of such software are made available to
-you in accordance with the referred license terms and conditions on this
-page http://www.maemo.org. The exact license terms of GPL, LGPL and said
-certain other licenses, as well as the required copyright and other notices,
-permissions and acknowledgements are reproduced in and delivered to you as
-part of the referred source code.
-
-
-NOKIA CORPORATION END-USER SOFTWARE AGREEMENT
-
-This Software Agreement ("Agreement") is between You (either an
-individual or an entity), the End User, and Nokia Corporation ("Nokia").
-The Agreement authorizes You to use the Software specified in Clause 1
-below, which may be stored on a CD-ROM, sent to You by electronic mail,
-or downloaded from Nokia's Web pages or Servers or from other sources
-under the terms and conditions set forth below. This is an agreement on
-end-user rights and not an agreement for sale. Nokia continues to own
-the copy of the Software and the physical media contained in the sales
-package and any other copy that You are authorized to make pursuant to
-this Agreement.
-
-Read this Agreement carefully before installing, downloading, or using
-the Software.  By clicking on the "I Accept" button while installing,
-downloading, and/or using the Software, You agree to the terms and
-conditions of this Agreement.  If You do not agree to all of the
-terms and conditions of this Agreement, promptly click the "Decline"
-or "I Do Not Accept" button, cancel the installation or downloading,
-or destroy or return the Software and accompanying documentation to
-Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU
-HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS
-TERMS AND CONDITIONS.
-
-1. SOFTWARE.
-
-As used in this Agreement, the term "Software" means, collectively:
-(i) the software product identified above (ii) all the contents of the
-disk(s), CD-ROM(s), electronic mail and its file attachments, or other
-media with which this Agreement is provided, including the object code
-form of the software delivered via a CD-ROM, electronic mail, or Web page
-(iii) digital images, stock photographs, clip art, or other artistic
-works ("Stock Files") (iv) related explanatory written materials and
-any other possible documentation related thereto ("Documentation");
-(v) fonts, and (vi) upgrades, modified versions, updates, additions,
-and copies of the Software (collectively "Updates"), if any, licensed
-to You by Nokia under this Agreement.
-
-2. END-USER RIGHTS AND USE.
-
-Nokia grants to You non-exclusive, non-transferable end-user rights
-to install the Software on the local hard disk(s) or other permanent
-storage media of one computer and use the Software on a single computer
-or terminal at a time.
-
-3. LIMITATIONS ON END-USER RIGHTS.
-
-You may not copy, distribute, or make derivative works of the Software
-except as follows:
-
-(a) You may make one copy of the Software on magnetic media as an archival
-backup copy, provided Your archival backup copy is not installed or
-used on any computer. Any other copies You make of the Software are in
-violation of this Agreement.
-
-(b) You may not use, modify, translate, reproduce, or transfer the right
-to use the Software or copy the Software except as expressly provided
-in this Agreement.
-
-(c) You may not resell, sublicense, rent, lease, or lend the Software.
-
-(d) You may not reverse engineer, reverse compile, disassemble, or
-otherwise attempt to discover the source code of the Software (except
-to the extent that this restriction is expressly prohibited by law)
-or create derivative works based on the Software.
-
-(e) Unless stated otherwise in the Documentation, You shall not display,
-modify, reproduce, or distribute any of the Stock Files included with the
-Software. In the event that the Documentation allows You to display the
-Stock Files, You shall not distribute the Stock Files on a stand-alone
-basis, i.e., in circumstances in which the Stock Files constitute the
-primary value of the product being distributed. You should review the
-"Readme" files associated with the Stock Files that You use to ascertain
-what rights You have with respect to such materials. Stock Files may
-not be used in the production of libelous, defamatory, fraudulent,
-infringing, lewd, obscene, or pornographic material or in any otherwise
-illegal manner. You may not register or claim any rights in the Stock
-Files or derivative works thereof.
-
-(f) You agree that You shall only use the Software in a manner that
-complies with all applicable laws in the jurisdiction in which You use
-the Software, including, but not limited to, applicable restrictions
-concerning copyright and other intellectual property rights.
-
-4. COPYRIGHT.
-
-The Software and all rights, without limitation including proprietary
-rights therein, are owned by Nokia and/or its licensors and affiliates and
-are protected by international treaty provisions and all other applicable
-national laws of the country in which it is being used. The structure,
-organization, and code of the Software are the valuable trade secrets and
-confidential information of Nokia and/or its licensors and affiliates. You
-must not copy the Software, except as set forth in clause 3 (Limitations
-On End-User Rights). Any copies which You are permitted to make pursuant
-to this Agreement must contain the same copyright and other proprietary
-notices that appear on the Software.
-
-5. MULTIPLE ENVIRONMENT SOFTWARE / MULTIPLE LANGUAGE SOFTWARE / DUAL
-MEDIA SOFTWARE / MULTIPLE COPIES / UPDATES.
-
-If the Software supports multiple platforms or languages, if You receive
-the Software on multiple media, or if You otherwise receive multiple
-copies of the Software, the number of computers on which all versions
-of the Software are installed shall be one computer. You may not rent,
-lease, sublicense, lend, or transfer versions or copies of the Software
-You do not use. If the Software is an Update to a previous version of
-the Software, You must possess valid end-user rights to such a previous
-version in order to use the Update, and You may use the previous version
-for ninety (90) days after You receive the Update in order to assist
-You in the transition to the Update. After such time You no longer have
-a right to use the previous version, except for the sole purpose of
-enabling You to install the Update.
-
-6. COMMENCEMENT & TERMINATION.
-
-This Agreement is effective from the first date You install the
-Software. You may terminate this Agreement at any time by permanently
-deleting, destroying, and returning, at Your own costs, the Software, all
-backup copies, and all related materials provided by Nokia. Your end-user
-rights automatically and immediately terminate without notice from Nokia
-if You fail to comply with any provision of this Agreement. In such an
-event, You must immediately delete, destroy, or return at Your own cost,
-the Software, all backup copies, and all related material to Nokia.
-
-7. YOU ACKNOWLEDGE THAT THE SOFTWARE IS PROVIDED "AS IS" WITHOUT
-WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND TO THE MAXIMUM EXTENT
-PERMITTED BY APPLICABLE LAW NEITHER NOKIA, ITS LICENSORS OR AFFILIATES,
-NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR THAT THE SOFTWARE
-WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS, OR
-OTHER RIGHTS.  THERE IS NO WARRANTY BY NOKIA OR BY ANY OTHER PARTY THAT
-THE FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR
-THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE.
-YOU ASSUME ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE SOFTWARE
-TO ACHIEVE YOUR INTENDED RESULTS AND FOR THE INSTALLATION, USE, AND
-RESULTS OBTAINED FROM IT.
-
-8. NO OTHER OBLIGATIONS.
-
-This Agreement creates no obligations on the part of Nokia other than
-as specifically set forth herein.
-
-9. LIMITATION OF LIABILITY.
-
-TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL
-NOKIA, ITS EMPLOYEES OR LICENSORS OR AFFILIATES BE LIABLE FOR ANY LOST
-PROFITS, REVENUE, SALES, DATA, OR COSTS OF PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES, PROPERTY DAMAGE, PERSONAL INJURY, INTERRUPTION OF BUSINESS,
-LOSS OF BUSINESS INFORMATION, OR FOR ANY SPECIAL, DIRECT, INDIRECT,
-INCIDENTAL, ECONOMIC, COVER, PUNITIVE, SPECIAL, OR CONSEQUENTIAL
-DAMAGES, HOWEVER CAUSED AND WHETHER ARISING UNDER CONTRACT, TORT,
-NEGLIGENCE, OR OTHER THEORY OF LIABILITY ARISING OUT OF THE USE OF
-OR INABILITY TO USE THE SOFTWARE, EVEN IF NOKIA OR ITS LICENSORS OR
-AFFILIATES ARE ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE
-SOME COUNTRIES/STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF
-LIABILITY, BUT MAY ALLOW LIABILITY TO BE LIMITED, IN SUCH CASES, NOKIA,
-ITS EMPLOYEES OR LICENSORS OR AFFILIATES' LIABILITY SHALL BE LIMITED
-TO U.S. $50.  Nothing contained in this Agreement shall prejudice the
-statutory rights of any party dealing as a consumer.  Nothing contained
-in this Agreement limits Nokia's liability to You in the event of death
-or personal injury resulting from Nokia's negligence. Nokia is acting
-on behalf of its employees and licensors or affiliates for the purpose
-of disclaiming, excluding, and/or restricting obligations, warranties,
-and liability as provided in this clause 9, but in no other respects
-and for no other purpose.
-
-10. TECHNICAL SUPPORT.
-
-Nokia has no obligation to furnish You with technical support unless
-separately agreed in writing between You and Nokia.
-
-11. EXPORT CONTROL.
-
-The Software, including technical data, includes cryptographic software
-subject to export controls under the U.S. Export Administration
-Regulations ("EAR") and may be subject to import or export controls in
-other countries. The EAR prohibits the use of the Software and technical
-data by a Government End User, as defined hereafter, without a license
-from the U.S. government. A Government End User is defined in Part
-772 of the EAR as "any foreign central, regional, or local government
-department, agency, or other entity performing governmental functions;
-including governmental research institutions, governmental corporations,
-or their separate business units (as defined in part 772 of the EAR)
-which are engaged in the manufacture or distribution of items or
-services controlled on the Wassenaar Munitions List, and international
-governmental organizations. This term does not include: utilities
-(telecommunications companies and Internet service providers; banks
-and financial institutions; transportation; broadcast or entertainment;
-educational organizations; civil health and medical organizations; retail
-or wholesale firms; and manufacturing or industrial entities not engaged
-in the manufacture or distribution of items or services controlled on
-the Wassenaar Munitions List.)" You agree to strictly comply with all
-applicable import and export regulations and acknowledge that You have
-the responsibility to obtain licenses to export, re-export, transfer, or
-import the Software. You further represent that You are not a Government
-End User as defined above, and You will not transfer the Software to
-any Government End User without a license.
-
-12. NOTICES.
-
-All notices and return of the Software and Documentation should be
-delivered to:
-
-NOKIA CORPORATION 
-P.O. Box 100 
-FIN-00045 
-NOKIA GROUP FINLAND
-
-13.  APPLICABLE LAW & GENERAL PROVISIONS.
-
-This Agreement is governed by the laws of Finland.  All disputes
-arising from or relating to this Agreement shall be settled by a single
-arbitrator appointed by the Central Chamber of Commerce of Finland. The
-arbitration procedure shall take place in Helsinki, Finland in the English
-language. If any part of this Agreement is found void and unenforceable,
-it will not affect the validity of the balance of the Agreement, which
-shall remain valid and enforceable according to its terms. This Agreement
-may only be modified in writing by an authorized officer of Nokia.
-
-This is the entire agreement between Nokia and You relating to the
-Software, and it supersedes any prior representations, discussions,
-undertakings, end-user agreements, communications, or advertising relating
-to the Software.
-
-PLEASE SUBMIT ANY ACCOMPANYING REGISTRATION FORMS TO RECEIVE REGISTRATION
-BENEFITS WHERE APPLICABLE
-

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/data/license.txt (from rev 1974, trunk/org.maemo.esbox.vm.vmware/data/license.txt)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/data/license.txt	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/data/license.txt	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,251 @@
+IMPORTANT: READ CAREFULLY BEFORE INSTALLING, DOWNLOADING, OR USING
+THE SOFTWARE
+
+This Software includes some software copyrighted by Nokia Corporation or
+third parties and some Open Source Software in binary form.
+
+The Software copyrighted by Nokia or some third parties is licensed to you
+under the Nokia End-User License Agreement [see below] and distributed to
+you only in binary form.
+
+The Open Source Software is licensed and distributed under GNU General
+Public License (GPL, the GNU lesser General Public License (LGPL, aka. The GNU
+Library General Public License) and/or other copyright licenses, permissions,
+notices or disclaimers containing obligation or permission to provide the
+source code of such software with the binary / executable form delivery of
+the said software. The source code of such software are made available to
+you in accordance with the referred license terms and conditions on this
+page http://www.maemo.org. The exact license terms of GPL, LGPL and said
+certain other licenses, as well as the required copyright and other notices,
+permissions and acknowledgements are reproduced in and delivered to you as
+part of the referred source code.
+
+
+NOKIA CORPORATION END-USER SOFTWARE AGREEMENT
+
+This Software Agreement ("Agreement") is between You (either an
+individual or an entity), the End User, and Nokia Corporation ("Nokia").
+The Agreement authorizes You to use the Software specified in Clause 1
+below, which may be stored on a CD-ROM, sent to You by electronic mail,
+or downloaded from Nokia's Web pages or Servers or from other sources
+under the terms and conditions set forth below. This is an agreement on
+end-user rights and not an agreement for sale. Nokia continues to own
+the copy of the Software and the physical media contained in the sales
+package and any other copy that You are authorized to make pursuant to
+this Agreement.
+
+Read this Agreement carefully before installing, downloading, or using
+the Software.  By clicking on the "I Accept" button while installing,
+downloading, and/or using the Software, You agree to the terms and
+conditions of this Agreement.  If You do not agree to all of the
+terms and conditions of this Agreement, promptly click the "Decline"
+or "I Do Not Accept" button, cancel the installation or downloading,
+or destroy or return the Software and accompanying documentation to
+Nokia. YOU AGREE THAT YOUR USE OF THE SOFTWARE ACKNOWLEDGES THAT YOU
+HAVE READ THIS AGREEMENT, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS
+TERMS AND CONDITIONS.
+
+1. SOFTWARE.
+
+As used in this Agreement, the term "Software" means, collectively:
+(i) the software product identified above (ii) all the contents of the
+disk(s), CD-ROM(s), electronic mail and its file attachments, or other
+media with which this Agreement is provided, including the object code
+form of the software delivered via a CD-ROM, electronic mail, or Web page
+(iii) digital images, stock photographs, clip art, or other artistic
+works ("Stock Files") (iv) related explanatory written materials and
+any other possible documentation related thereto ("Documentation");
+(v) fonts, and (vi) upgrades, modified versions, updates, additions,
+and copies of the Software (collectively "Updates"), if any, licensed
+to You by Nokia under this Agreement.
+
+2. END-USER RIGHTS AND USE.
+
+Nokia grants to You non-exclusive, non-transferable end-user rights
+to install the Software on the local hard disk(s) or other permanent
+storage media of one computer and use the Software on a single computer
+or terminal at a time.
+
+3. LIMITATIONS ON END-USER RIGHTS.
+
+You may not copy, distribute, or make derivative works of the Software
+except as follows:
+
+(a) You may make one copy of the Software on magnetic media as an archival
+backup copy, provided Your archival backup copy is not installed or
+used on any computer. Any other copies You make of the Software are in
+violation of this Agreement.
+
+(b) You may not use, modify, translate, reproduce, or transfer the right
+to use the Software or copy the Software except as expressly provided
+in this Agreement.
+
+(c) You may not resell, sublicense, rent, lease, or lend the Software.
+
+(d) You may not reverse engineer, reverse compile, disassemble, or
+otherwise attempt to discover the source code of the Software (except
+to the extent that this restriction is expressly prohibited by law)
+or create derivative works based on the Software.
+
+(e) Unless stated otherwise in the Documentation, You shall not display,
+modify, reproduce, or distribute any of the Stock Files included with the
+Software. In the event that the Documentation allows You to display the
+Stock Files, You shall not distribute the Stock Files on a stand-alone
+basis, i.e., in circumstances in which the Stock Files constitute the
+primary value of the product being distributed. You should review the
+"Readme" files associated with the Stock Files that You use to ascertain
+what rights You have with respect to such materials. Stock Files may
+not be used in the production of libelous, defamatory, fraudulent,
+infringing, lewd, obscene, or pornographic material or in any otherwise
+illegal manner. You may not register or claim any rights in the Stock
+Files or derivative works thereof.
+
+(f) You agree that You shall only use the Software in a manner that
+complies with all applicable laws in the jurisdiction in which You use
+the Software, including, but not limited to, applicable restrictions
+concerning copyright and other intellectual property rights.
+
+4. COPYRIGHT.
+
+The Software and all rights, without limitation including proprietary
+rights therein, are owned by Nokia and/or its licensors and affiliates and
+are protected by international treaty provisions and all other applicable
+national laws of the country in which it is being used. The structure,
+organization, and code of the Software are the valuable trade secrets and
+confidential information of Nokia and/or its licensors and affiliates. You
+must not copy the Software, except as set forth in clause 3 (Limitations
+On End-User Rights). Any copies which You are permitted to make pursuant
+to this Agreement must contain the same copyright and other proprietary
+notices that appear on the Software.
+
+5. MULTIPLE ENVIRONMENT SOFTWARE / MULTIPLE LANGUAGE SOFTWARE / DUAL
+MEDIA SOFTWARE / MULTIPLE COPIES / UPDATES.
+
+If the Software supports multiple platforms or languages, if You receive
+the Software on multiple media, or if You otherwise receive multiple
+copies of the Software, the number of computers on which all versions
+of the Software are installed shall be one computer. You may not rent,
+lease, sublicense, lend, or transfer versions or copies of the Software
+You do not use. If the Software is an Update to a previous version of
+the Software, You must possess valid end-user rights to such a previous
+version in order to use the Update, and You may use the previous version
+for ninety (90) days after You receive the Update in order to assist
+You in the transition to the Update. After such time You no longer have
+a right to use the previous version, except for the sole purpose of
+enabling You to install the Update.
+
+6. COMMENCEMENT & TERMINATION.
+
+This Agreement is effective from the first date You install the
+Software. You may terminate this Agreement at any time by permanently
+deleting, destroying, and returning, at Your own costs, the Software, all
+backup copies, and all related materials provided by Nokia. Your end-user
+rights automatically and immediately terminate without notice from Nokia
+if You fail to comply with any provision of this Agreement. In such an
+event, You must immediately delete, destroy, or return at Your own cost,
+the Software, all backup copies, and all related material to Nokia.
+
+7. YOU ACKNOWLEDGE THAT THE SOFTWARE IS PROVIDED "AS IS" WITHOUT
+WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND TO THE MAXIMUM EXTENT
+PERMITTED BY APPLICABLE LAW NEITHER NOKIA, ITS LICENSORS OR AFFILIATES,
+NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR THAT THE SOFTWARE
+WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS, OR
+OTHER RIGHTS.  THERE IS NO WARRANTY BY NOKIA OR BY ANY OTHER PARTY THAT
+THE FUNCTIONS CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR
+THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE.
+YOU ASSUME ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE SOFTWARE
+TO ACHIEVE YOUR INTENDED RESULTS AND FOR THE INSTALLATION, USE, AND
+RESULTS OBTAINED FROM IT.
+
+8. NO OTHER OBLIGATIONS.
+
+This Agreement creates no obligations on the part of Nokia other than
+as specifically set forth herein.
+
+9. LIMITATION OF LIABILITY.
+
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL
+NOKIA, ITS EMPLOYEES OR LICENSORS OR AFFILIATES BE LIABLE FOR ANY LOST
+PROFITS, REVENUE, SALES, DATA, OR COSTS OF PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES, PROPERTY DAMAGE, PERSONAL INJURY, INTERRUPTION OF BUSINESS,
+LOSS OF BUSINESS INFORMATION, OR FOR ANY SPECIAL, DIRECT, INDIRECT,
+INCIDENTAL, ECONOMIC, COVER, PUNITIVE, SPECIAL, OR CONSEQUENTIAL
+DAMAGES, HOWEVER CAUSED AND WHETHER ARISING UNDER CONTRACT, TORT,
+NEGLIGENCE, OR OTHER THEORY OF LIABILITY ARISING OUT OF THE USE OF
+OR INABILITY TO USE THE SOFTWARE, EVEN IF NOKIA OR ITS LICENSORS OR
+AFFILIATES ARE ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE
+SOME COUNTRIES/STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF
+LIABILITY, BUT MAY ALLOW LIABILITY TO BE LIMITED, IN SUCH CASES, NOKIA,
+ITS EMPLOYEES OR LICENSORS OR AFFILIATES' LIABILITY SHALL BE LIMITED
+TO U.S. $50.  Nothing contained in this Agreement shall prejudice the
+statutory rights of any party dealing as a consumer.  Nothing contained
+in this Agreement limits Nokia's liability to You in the event of death
+or personal injury resulting from Nokia's negligence. Nokia is acting
+on behalf of its employees and licensors or affiliates for the purpose
+of disclaiming, excluding, and/or restricting obligations, warranties,
+and liability as provided in this clause 9, but in no other respects
+and for no other purpose.
+
+10. TECHNICAL SUPPORT.
+
+Nokia has no obligation to furnish You with technical support unless
+separately agreed in writing between You and Nokia.
+
+11. EXPORT CONTROL.
+
+The Software, including technical data, includes cryptographic software
+subject to export controls under the U.S. Export Administration
+Regulations ("EAR") and may be subject to import or export controls in
+other countries. The EAR prohibits the use of the Software and technical
+data by a Government End User, as defined hereafter, without a license
+from the U.S. government. A Government End User is defined in Part
+772 of the EAR as "any foreign central, regional, or local government
+department, agency, or other entity performing governmental functions;
+including governmental research institutions, governmental corporations,
+or their separate business units (as defined in part 772 of the EAR)
+which are engaged in the manufacture or distribution of items or
+services controlled on the Wassenaar Munitions List, and international
+governmental organizations. This term does not include: utilities
+(telecommunications companies and Internet service providers; banks
+and financial institutions; transportation; broadcast or entertainment;
+educational organizations; civil health and medical organizations; retail
+or wholesale firms; and manufacturing or industrial entities not engaged
+in the manufacture or distribution of items or services controlled on
+the Wassenaar Munitions List.)" You agree to strictly comply with all
+applicable import and export regulations and acknowledge that You have
+the responsibility to obtain licenses to export, re-export, transfer, or
+import the Software. You further represent that You are not a Government
+End User as defined above, and You will not transfer the Software to
+any Government End User without a license.
+
+12. NOTICES.
+
+All notices and return of the Software and Documentation should be
+delivered to:
+
+NOKIA CORPORATION 
+P.O. Box 100 
+FIN-00045 
+NOKIA GROUP FINLAND
+
+13.  APPLICABLE LAW & GENERAL PROVISIONS.
+
+This Agreement is governed by the laws of Finland.  All disputes
+arising from or relating to this Agreement shall be settled by a single
+arbitrator appointed by the Central Chamber of Commerce of Finland. The
+arbitration procedure shall take place in Helsinki, Finland in the English
+language. If any part of this Agreement is found void and unenforceable,
+it will not affect the validity of the balance of the Agreement, which
+shall remain valid and enforceable according to its terms. This Agreement
+may only be modified in writing by an authorized officer of Nokia.
+
+This is the entire agreement between Nokia and You relating to the
+Software, and it supersedes any prior representations, discussions,
+undertakings, end-user agreements, communications, or advertising relating
+to the Software.
+
+PLEASE SUBMIT ANY ACCOMPANYING REGISTRATION FORMS TO RECEIVE REGISTRATION
+BENEFITS WHERE APPLICABLE
+

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons/full)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16 (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons/full/etool16)

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine.png
===================================================================
(Binary files differ)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine.png (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine.png)
===================================================================
(Binary files differ)

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_48.png
===================================================================
(Binary files differ)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_48.png (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_48.png)
===================================================================
(Binary files differ)

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_64.png
===================================================================
(Binary files differ)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_64.png (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons/full/etool16/virtual_machine_64.png)
===================================================================
(Binary files differ)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/wizban (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons/full/wizban)

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/wizban/virtual_machine_wiz.png
===================================================================
(Binary files differ)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/icons/full/wizban/virtual_machine_wiz.png (from rev 1974, trunk/org.maemo.esbox.vm.vmware/icons/full/wizban/virtual_machine_wiz.png)
===================================================================
(Binary files differ)

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/plugin.xml	2009-08-19 16:15:11 UTC (rev 1975)
@@ -24,5 +24,20 @@
             class="org.maemo.esbox.internal.vm.vmware.VMwareMachineFactory">
       </machineFactory>
    </extension>
+    <extension
+          point="org.eclipse.ui.newWizards">
+       <wizard
+             canFinishEarly="false"
+             category="org.maemo.mica.maemosdk.ui.maemo_installer_wizard"
+             class="org.maemo.esbox.internal.vm.vmware.ui.wizards.NewMaemoSDKVMWizard"
+             hasPages="true"
+             icon="icons/full/etool16/virtual_machine.png"
+             id="org.maemo.esbox.vm.maemovm_installer"
+             name="Maemo SDK Virtual Image">
+          <description>
+             Installs Maemo SDK Virtual Image to be used with ESbox to build and launch applications.
+          </description>
+       </wizard>
+    </extension>
 
 </plugin>

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware)

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.api.vm.vmware;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.mica.common.core.MicaException;
-
-/**
- * This class wraps that download process of any Maemo SDK virtual image. If the
- * file has more than 1 part, it will properly downloaded by this executor.
- * 
- * @author raulherbster
- * 
- */
-public class DownloadExecution implements IRunnableWithProgress {
-
-	// File to download
-	private MaemoSDKVMInfo downloadFile;
-
-	// progress monitor to download process
-	private IProgressMonitor progressMonitor;
-
-	private static final int DOWNLOAD_TRIES = 3;
-	private static final int DOWNLOAD_WAIT = 3000; // 3 sec
-	
-	/**
-	 * Construtor.
-	 * 
-	 * @param downloadFile
-	 *            the file to download
-	 */
-	public DownloadExecution(MaemoSDKVMInfo downloadFile) {
-		this.downloadFile = downloadFile;
-	}
-
-	/**
-	 * Resume the download process. If the download process was previously
-	 * paused, it will be restart from the point it has stopped.
-	 */
-	public void resumeDownload() {
-		downloadFile.resume();
-	}
-
-	/**
-	 * Pause download process.
-	 */
-	public void pauseDonwload() {
-		downloadFile.pause();
-	}
-
-	/**
-	 * Cancel download process.
-	 */
-	public void cancelDonwload() {
-		downloadFile.cancel();
-	}
-	
-	/**
-	 * Download the file. The process to download the file is implemented by
-	 * this method. Basically, it gets the links from download webpage. Once the
-	 * links are properly saved, the download process started. If the download
-	 * has begun, it continous from the previous state.
-	 * @throws MicaException 
-	 */
-	public void downloadFile() throws MicaException {
-		
-		MicaException error = null;
-		IStatus status = null;
-		for (int i = 1; i <= DOWNLOAD_TRIES; i++) {
-			try {
-				Thread.sleep(i * DOWNLOAD_WAIT);
-			} catch (InterruptedException e) {
-
-			}
-						
-			try {
-				MaemoSDKVMDownloader downloader = new MaemoSDKVMDownloader(downloadFile, progressMonitor);
-				status = downloader.downloadMaemoSDKImageTool();
-			} catch (MicaException e) {
-				error = e;
-			}
-			
-			// If user cancels donwload, it does not tries anymore.
-			if (status != null && (status.matches(IStatus.CANCEL) || status.matches(IStatus.ERROR)))
-				break;
-			else if ((status != null && status.isOK()))
-				return;
-		}
-		
-		if (error != null) {
-			throw error;
-		} else {
-			// Should not come here.
-			throw new MicaException(status.getMessage());
-		}
-	}
-
-	/**
-	 * Run download process. The process continuous until the download file has
-	 * its state changed to Status.CANCELLED, Status.ERROR or STATUS.COMPLETE
-	 */
-	public void run(IProgressMonitor monitor) {
-		progressMonitor = monitor;
-
-		try {
-			downloadFile();
-		} catch (MicaException exception) {
-			Activator.getErrorLogger().logAndShowError("Cannot download Maemo SDK virtual image", exception);
-		}
-			
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadExecution.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.vm.vmware;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.mica.common.core.MicaException;
+
+/**
+ * This class wraps that download process of any Maemo SDK virtual image. If the
+ * file has more than 1 part, it will properly downloaded by this executor.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class DownloadExecution implements IRunnableWithProgress {
+
+	// File to download
+	private MaemoSDKVMInfo downloadFile;
+
+	// progress monitor to download process
+	private IProgressMonitor progressMonitor;
+
+	private static final int DOWNLOAD_TRIES = 3;
+	private static final int DOWNLOAD_WAIT = 3000; // 3 sec
+	
+	/**
+	 * Construtor.
+	 * 
+	 * @param downloadFile
+	 *            the file to download
+	 */
+	public DownloadExecution(MaemoSDKVMInfo downloadFile) {
+		this.downloadFile = downloadFile;
+	}
+
+	/**
+	 * Resume the download process. If the download process was previously
+	 * paused, it will be restart from the point it has stopped.
+	 */
+	public void resumeDownload() {
+		downloadFile.resume();
+	}
+
+	/**
+	 * Pause download process.
+	 */
+	public void pauseDonwload() {
+		downloadFile.pause();
+	}
+
+	/**
+	 * Cancel download process.
+	 */
+	public void cancelDonwload() {
+		downloadFile.cancel();
+	}
+	
+	/**
+	 * Download the file. The process to download the file is implemented by
+	 * this method. Basically, it gets the links from download webpage. Once the
+	 * links are properly saved, the download process started. If the download
+	 * has begun, it continous from the previous state.
+	 * @throws MicaException 
+	 */
+	public void downloadFile() throws MicaException {
+		
+		MicaException error = null;
+		IStatus status = null;
+		for (int i = 1; i <= DOWNLOAD_TRIES; i++) {
+			try {
+				Thread.sleep(i * DOWNLOAD_WAIT);
+			} catch (InterruptedException e) {
+
+			}
+						
+			try {
+				MaemoSDKVMDownloader downloader = new MaemoSDKVMDownloader(downloadFile, progressMonitor);
+				status = downloader.downloadMaemoSDKImageTool();
+			} catch (MicaException e) {
+				error = e;
+			}
+			
+			// If user cancels donwload, it does not tries anymore.
+			if (status != null && (status.matches(IStatus.CANCEL) || status.matches(IStatus.ERROR)))
+				break;
+			else if ((status != null && status.isOK()))
+				return;
+		}
+		
+		if (error != null) {
+			throw error;
+		} else {
+			// Should not come here.
+			throw new MicaException(status.getMessage());
+		}
+	}
+
+	/**
+	 * Run download process. The process continuous until the download file has
+	 * its state changed to Status.CANCELLED, Status.ERROR or STATUS.COMPLETE
+	 */
+	public void run(IProgressMonitor monitor) {
+		progressMonitor = monitor;
+
+		try {
+			downloadFile();
+		} catch (MicaException exception) {
+			Activator.getErrorLogger().logAndShowError("Cannot download Maemo SDK virtual image", exception);
+		}
+			
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.api.vm.vmware;
-
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * 
- * Progress monitor to download the file.
- * 
- * @author raulherbster
- * 
- */
-public class DownloadProgressMonitor extends ProgressMonitorDialog {
-
-	private Button pauseButton;
-	private Button resumeButton;
-
-	private DownloadExecution downloadWrapper;
-
-	public static final int PAUSE_ID = 22;
-	public static final int RESUME_ID = 23;
-
-	public static final String PAUSE_LABEL = "Pause";
-	public static final String RESUME_LABEL = "Resume";
-
-	/**
-	 * Constructor
-	 * 
-	 * @param parent
-	 *            parent shell
-	 */
-	public DownloadProgressMonitor(Shell parent,
-			DownloadExecution downloadWrapper) {
-		super(parent);
-		this.downloadWrapper = downloadWrapper;
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.dialogs.ProgressMonitorDialog#createButtonsForButtonBar
-	 * (org.eclipse.swt.widgets.Composite)
-	 */
-	@Override
-	protected void createButtonsForButtonBar(Composite parent) {
-		pauseButton = createButton(parent, PAUSE_ID, PAUSE_LABEL, true);
-		pauseButton.setEnabled(true);
-		pauseButton.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent arg0) {
-				// do nothing
-			}
-
-			public void widgetSelected(SelectionEvent arg0) {
-				resumeButton.setEnabled(true);
-				pauseButton.setEnabled(false);
-				pauseDownload();
-			}
-		});
-
-		resumeButton = createButton(parent, RESUME_ID, RESUME_LABEL, true);
-		resumeButton.setEnabled(false);
-		resumeButton.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent arg0) {
-				// do nothing
-			}
-
-			public void widgetSelected(SelectionEvent arg0) {
-				pauseButton.setEnabled(true);
-				resumeButton.setEnabled(false);
-				resumeDownload();
-			}
-		});
-
-		super.createButtonsForButtonBar(parent);
-		setOperationCancelButtonEnabled(true);
-	}
-
-	/**
-	 * Cancel download.
-	 */
-	protected void cancelPressed() {
-		super.cancelPressed();
-		cancelDownload();
-	}
-
-	/**
-	 * Resume download.
-	 */
-	protected void resumeDownload() {
-		downloadWrapper.resumeDownload();
-	}
-
-	/**
-	 * Pause download.
-	 */
-	protected void pauseDownload() {
-		downloadWrapper.pauseDonwload();
-	}
-
-	/**
-	 * Cancel download.
-	 */
-	protected void cancelDownload() {
-		downloadWrapper.cancelDonwload();
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/DownloadProgressMonitor.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.vm.vmware;
+
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * 
+ * Progress monitor to download the file.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class DownloadProgressMonitor extends ProgressMonitorDialog {
+
+	private Button pauseButton;
+	private Button resumeButton;
+
+	private DownloadExecution downloadWrapper;
+
+	public static final int PAUSE_ID = 22;
+	public static final int RESUME_ID = 23;
+
+	public static final String PAUSE_LABEL = "Pause";
+	public static final String RESUME_LABEL = "Resume";
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 */
+	public DownloadProgressMonitor(Shell parent,
+			DownloadExecution downloadWrapper) {
+		super(parent);
+		this.downloadWrapper = downloadWrapper;
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.ProgressMonitorDialog#createButtonsForButtonBar
+	 * (org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		pauseButton = createButton(parent, PAUSE_ID, PAUSE_LABEL, true);
+		pauseButton.setEnabled(true);
+		pauseButton.addSelectionListener(new SelectionListener() {
+			public void widgetDefaultSelected(SelectionEvent arg0) {
+				// do nothing
+			}
+
+			public void widgetSelected(SelectionEvent arg0) {
+				resumeButton.setEnabled(true);
+				pauseButton.setEnabled(false);
+				pauseDownload();
+			}
+		});
+
+		resumeButton = createButton(parent, RESUME_ID, RESUME_LABEL, true);
+		resumeButton.setEnabled(false);
+		resumeButton.addSelectionListener(new SelectionListener() {
+			public void widgetDefaultSelected(SelectionEvent arg0) {
+				// do nothing
+			}
+
+			public void widgetSelected(SelectionEvent arg0) {
+				pauseButton.setEnabled(true);
+				resumeButton.setEnabled(false);
+				resumeDownload();
+			}
+		});
+
+		super.createButtonsForButtonBar(parent);
+		setOperationCancelButtonEnabled(true);
+	}
+
+	/**
+	 * Cancel download.
+	 */
+	protected void cancelPressed() {
+		super.cancelPressed();
+		cancelDownload();
+	}
+
+	/**
+	 * Resume download.
+	 */
+	protected void resumeDownload() {
+		downloadWrapper.resumeDownload();
+	}
+
+	/**
+	 * Pause download.
+	 */
+	protected void pauseDownload() {
+		downloadWrapper.pauseDonwload();
+	}
+
+	/**
+	 * Cancel download.
+	 */
+	protected void cancelDownload() {
+		downloadWrapper.cancelDonwload();
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,472 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.api.vm.vmware;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.net.CookieHandler;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.Policy;
-import org.maemo.mica.common.ui.dialogs.DialogUtils;
-import org.maemo.mica.internal.api.common.core.filesystem.FilesystemUtils;
-import org.maemo.mica.internal.api.common.core.http.connection.CopyProgressMonitor;
-import org.maemo.mica.internal.api.common.core.http.connection.DownloadingThread;
-import org.maemo.mica.internal.api.common.core.http.connection.SessionHandler;
-
-import com.nokia.cpp.internal.api.utils.core.Tuple;
-
-/**
- * @author raulherbster
- *
- */
-public class MaemoSDKVMDownloader {
-
-	private MaemoSDKVMInfo downloadFile;
-	private IProgressMonitor monitor;
-	
-	/**
-	 * Construtor.
-	 * @param downloadFile
-	 * @param monitor
-	 */
-	protected MaemoSDKVMDownloader(MaemoSDKVMInfo downloadFile, IProgressMonitor monitor) {
-		this.downloadFile = downloadFile;
-		this.monitor = monitor;
-	}
-	
-	/**
-	 * Get URL and size of remote file.
-	 * @return URL and size of remote file.
-	 * @throws MicaException
-	 */
-	private Tuple getRemoteFileInfo() throws MicaException {
-		URL connectionURL = null;
-		try {
-			connectionURL = new URL(MaemoSDKVMInfo.DOWNLOAD_PAGE);
-		} catch (MalformedURLException e1) {
-			throw new MicaException("Cannot define URL for Maemo SDK virtual image");
-		}
-		
-		monitor.subTask("Retrieving  information from " + connectionURL.getHost());
-		
-		// Get the download page so links can be properly obtained
-		String downloadPage = openDownloadPage();
-		URL remoteURL;
-		int fileSize = 0;
-		try {
-			fileSize = getSizeFor(downloadPage, downloadFile.getDescription());
-			remoteURL = getLinkFor(downloadPage, downloadFile.getDescription());
-		} catch (MalformedURLException e) {
-			Activator.getErrorLogger().logAndShowError("Invalid file URL", e);
-			return null;
-		}
-				
-		return new Tuple(remoteURL, fileSize);
-	}
-	
-	/**
-	 * Return the download page.
-	 * 
-	 * @return the download page.
-	 */
-	private String openDownloadPage() {
-		String responsePage = null;
-		HttpURLConnection connection = null;
-				
-		try {
-			connection = connectWithPostMethod(new URL(
-					MaemoSDKVMInfo.DOWNLOAD_PAGE));
-			responsePage = getResponse(connection);
-			if (responsePage == null) {
-				throw new MicaException("Response page is empty"); //$NON-NLS-1$
-			}
-		} catch (Exception e) {
-			Activator.getErrorLogger().logAndShowError(
-					"Cannot connect with " + MaemoSDKVMInfo.DOWNLOAD_PAGE, e);
-			return null;
-		} finally {
-
-			if (connection != null)
-				connection.disconnect();
-
-		}
-		return responsePage;
-	}
-	
-	/**
-	 * Connect with post method on download page.
-	 * 
-	 * @param connectionUrl
-	 * @return
-	 * @throws MicaException
-	 */
-	private HttpURLConnection connectWithPostMethod(URL connectionUrl) throws MicaException {
-		// TODO refactor flasher on Mica so methods can be reused here.
-		OutputStreamWriter out = null;
-		HttpURLConnection conn = null;
-		try {
-			conn = (HttpURLConnection) connectionUrl.openConnection();
-			conn.setRequestMethod("POST"); //$NON-NLS-1$
-			conn.setDoOutput(true);
-			conn.setDoInput(true);
-			conn.setRequestProperty("Content-Type",
-			"application/x-www-form-urlencoded");
-			out = new OutputStreamWriter(conn.getOutputStream());
-			out.write("agree=I accept");
-			out.flush();
-			return conn;
-		} catch (MalformedURLException e) {
-			throw new MicaException("Malformed URL", e); //$NON-NLS-1$
-		} catch (IOException e) {
-			throw new MicaException("Cannot connect to " + connectionUrl, e);
-		} finally {
-			Policy.close(out);
-		}
-	}
-	
-	/**
-	 * 
-	 * @param conn
-	 * @return
-	 * @throws MicaException
-	 */
-	private String getResponse(HttpURLConnection conn) throws MicaException {
-		// TODO refactor flasher on Mica so methods can be reused here.
-		if (conn == null) {
-			throw new MicaException(new IllegalArgumentException(
-			"Connection cannot be null"));
-		}
-		BufferedReader bufReader = null;
-		try {
-			bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
-		} catch (Exception e) {
-			throw new MicaException("Cannot get input from server", e);
-		}
-		StringBuffer buffer = new StringBuffer();
-		if (bufReader != null) {
-			String inputLine;
-			try {
-				while ((inputLine = bufReader.readLine()) != null) {
-					buffer.append(inputLine);
-					buffer.append("\n"); //$NON-NLS-1$
-				}
-			} catch (IOException e) {
-				throw new MicaException("Cannot read data from server", e);
-			}
-		}
-		if (buffer.length() > 0) {
-			return buffer.toString();
-		} else {
-			return null;
-		}
-	}
-
-	
-	
-	/**
-	 * Get the links for a certain download file. It the file consists of more
-	 * than 1 file, its parts will be properly obtained.
-	 * 
-	 * @param htmlPage
-	 * @param downloadFileDescription
-	 * @return
-	 * @throws MalformedURLException
-	 */
-	private URL getLinkFor(String htmlPage, String downloadFileDescription) throws MalformedURLException {
-		final String DOWNLOAD_FILE_PATTERN = "<tr>\\s*<td class=\"filename\">(.*?)</td>\\s*</tr>";
-		final String LINK_PATTERN = "<a href=\"(.*?)\">";
-		Pattern fileEntryPattern = Pattern.compile(DOWNLOAD_FILE_PATTERN,
-				Pattern.DOTALL | Pattern.UNIX_LINES);
-		Matcher matcher = fileEntryPattern.matcher(htmlPage);
-		while (matcher.find()) {
-			String fileInfo = matcher.group(0);
-			if (fileInfo.contains(downloadFileDescription)) {
-				Pattern hrefPattern = Pattern.compile(LINK_PATTERN,
-						Pattern.DOTALL | Pattern.UNIX_LINES);
-				Matcher matcherLink = hrefPattern.matcher(fileInfo);
-				if (matcherLink.find()) {
-					String link = matcherLink.group(1);
-					return (new URL(MaemoSDKVMInfo.DOWNLOAD_PAGE
-							+ link.substring(link.indexOf("?"))));
-				}
-			}
-
-		}
-		return null;
-	}
-	
-	/**
-	 * Get the size of a certain remote file. The file is retrieved from html page description.
-	 * @param htmlPage
-	 * @param downloadFileDescription
-	 * @return
-	 */
-	private int getSizeFor(String htmlPage, String downloadFileDescription) {
-		final String DOWNLOAD_FILE_PATTERN = "<tr>\\s*<td class=\"filename\">(.*?)</td>\\s*</tr>";
-		final String SIZE_PATTERN = "<td class=\"filesize\">(.*?)</td>";
-		Pattern fileEntryPattern = Pattern.compile(DOWNLOAD_FILE_PATTERN,
-				Pattern.DOTALL | Pattern.UNIX_LINES);
-		Matcher matcher = fileEntryPattern.matcher(htmlPage);
-		while (matcher.find()) {
-			String fileInfo = matcher.group(0);
-			if (fileInfo.contains(downloadFileDescription)) {
-				Pattern sizePattern = Pattern.compile(SIZE_PATTERN,
-						Pattern.DOTALL | Pattern.UNIX_LINES);
-				Matcher matcherLink = sizePattern.matcher(fileInfo);
-				if (matcherLink.find()) {
-					String size = matcherLink.group(1);
-					return Integer.parseInt(size);
-				}
-			}
-
-		}
-		return 0;
-	}
-	
-	/**
-	 * Get file name of download file to be saved locally
-	 * 
-	 * @param remoteURL
-	 * @param localPath
-	 * @return the name of file to be saved locally
-	 */
-	private String getFileName(URL remoteURL, URL localPath) {
-		String fileName = (new Path(remoteURL.getFile())).lastSegment();
-		fileName = fileName.substring(fileName.lastIndexOf("=") + 1);
-		return (new Path(localPath.getFile())).append(fileName).toOSString();
-	}
-	
-	/**
-	 * Get the size of previously downloaded file.
-	 * @param localFileName
-	 * @return
-	 */
-	private long getPreviousDownloadSize(String localFileName) {
-		File previousFile = new File(localFileName);
-		if (previousFile.exists()) {
-			boolean canResumeDownload = DialogUtils.showQuestionDialog(DialogUtils.getShell(), 
-					"Previous download file founded", "The file " + localFileName + " already exists. Would you like to resume download?");
-			if (canResumeDownload) {
-				return previousFile.length();
-			} else {
-				previousFile.delete();
-				return 0L;
-			}			
-		}
-		return 0L;
-	}
-	
-	/**
-	 * Download a Maemo SDK virtual image.
-	 * @return the status reported from this operation.
-	 * @throws IOException
-	 * @throws MicaException
-	 */
-	private IStatus fileDownloader() throws IOException, MicaException {
-		// Check if file was downloaded before
-		monitor.subTask("Checking information about file to be downloaded ...");
-				
-		Tuple remoteFileInfo = getRemoteFileInfo();
-		URL remoteURL = (URL) remoteFileInfo.get(0);
-		
-		// Get link of remote file
-		String fileName = getFileName(remoteURL, downloadFile.getLocalURL());	
-		
-		downloadFile.setDownloadedSize(getPreviousDownloadSize(fileName));			
-		Integer remoteFileSize = (Integer) remoteFileInfo.get(1);
-		
-		if (downloadFile.getDownloadedSize() == remoteFileSize.intValue())
-			return Activator.createStatus(Status.OK, "Maemo SDK virtual image is already downloaded.");
-		
-		HttpURLConnection connection = null;
-		RandomFileOutputStream out = null;
-		InputStream in = null;
-		
-		try {
-		
-			// Open connection to URL.
-			monitor.subTask("Establishing connection with " + remoteURL.getHost());
-			connection = (HttpURLConnection) remoteURL.openConnection();
-			
-			// Specify what portion of file to download
-			connection.setRequestProperty("Range", "bytes=" + downloadFile.getDownloadedSize() + "-");
-			
-			// Connect to server
-			connection.connect();
-			monitor.subTask("Connected with " + remoteURL.getHost());
-	
-			IStatus connectionStatus = validateConnection(connection);
-			if (!connectionStatus.isOK()) {
-				cancelDownload(downloadFile,monitor);
-				return errorStatus(connectionStatus.getMessage());
-			}
-			
-			int contentLength = connection.getContentLength();			
-			if (!haveEnoughtFreeSpace(contentLength/1024, downloadFile.getLocalURL())) {
-				cancelDownload(downloadFile, monitor);
-				return errorStatus("There is not enought space to save Maemo SDK virtual machine in your computer.");
-			}
-			
-			// set the size for this download if it hasn't been already set.
-			if (downloadFile.getSize() == -1) {
-				downloadFile.setSize(contentLength);
-			}
-			
-			CopyProgressMonitor progressMonitor = new CopyProgressMonitor("Downloading Maemo SDK virtual image",remoteFileSize, monitor);
-			progressMonitor.addProgress(downloadFile.getDownloadedSize());
-			progressMonitor.start();
-	
-			out = new RandomFileOutputStream(fileName,true);
-			out.setFilePointer(downloadFile.getDownloadedSize());	
-			in = connection.getInputStream();
-			
-			// create and start to download
-			monitor.beginTask(remoteURL.getFile(), remoteFileSize != 0 ? remoteFileSize : IProgressMonitor.UNKNOWN);
-			monitor.worked((int)downloadFile.getDownloadedSize());
-			
-			DownloadingThread thread = new DownloadingThread(in, out,Activator.BUFFER_SIZE, progressMonitor, monitor);
-			thread.start();
-
-			while (!thread.isInterrupted() && thread.isAlive() ) {
-				try {
-					Thread.sleep(1000);
-				} catch (InterruptedException e) {
-					continue;
-				}
-				
-				if (monitor.isCanceled()) {
-					thread.stopDownloading();
-					downloadFile.cancel();
-					throw new MicaException("Maemo SDK virtual image download was cancelled by user.");
-				}
-				
-				if(downloadFile.getStatus() == MaemoSDKVMInfo.Status.PAUSED){
-					thread.doPause();
-				}
-				
-				if(downloadFile.getStatus() == MaemoSDKVMInfo.Status.DOWNLOADING){
-					thread.doResume();
-				}
-			}
-			
-			if (thread.isCompleted() &&
-					downloadFile.getDownloadedSize() == remoteFileSize.intValue()) {
-				downloadFile.complete();
-			}
-			
-			if (thread.getErrorMessage() != null) {
-				downloadFile.error();
-				throw new IOException(thread.getErrorMessage());
-			}
-		} finally {
-
-			// Close connection to server.
-			if (in != null) {
-				in.close();
-			}
-
-			if (connection != null)
-				connection.disconnect();
-		}
-		
-		return Status.OK_STATUS;
-	}
-	
-	/**
-	 * Creates an error status based with the given message.
-	 * @param message
-	 * @return
-	 */
-	private static IStatus errorStatus(String message) {
-		return Activator.createStatus(IStatus.ERROR, message);
-	}
-	
-	/**
-	 * Cancel download.
-	 * @param fileDownload
-	 * @param monitor
-	 */
-	private static void cancelDownload(MaemoSDKVMInfo fileDownload, IProgressMonitor monitor) {
-		fileDownload.error();
-		monitor.setCanceled(true);
-		monitor.done();
-	}
-	
-	/**
-	 * Check if there is enough space to uncompress the Maemo SDK virtual image. 
-	 * @param fileSize the size of file (in Kbytes)
-	 * @param localURL the destination path to uncompress the Maemo SDK virtual image.
-	 * @return boolean if there is enough space to uncompress the Maemo SDK virtual image (if the free space
-	 * available on disk is bigger than the size of uncompressed Maemo SDK virtual image); false, otherwise.
-	 */
-	private static boolean haveEnoughtFreeSpace(int fileSize, URL localURL) throws IOException {
-		long freeSpace = FilesystemUtils.freeSpaceOS(new Path(localURL.getPath()),true);
-		return freeSpace > fileSize;
-	}
-	
-	/**
-	 * Validate the http connection.
-	 * @param connection the connection to be validated.
-	 * @return an IStatus as result.
-	 * @throws IOException
-	 */
-	private static IStatus validateConnection(HttpURLConnection connection) throws IOException {
-		// Make sure response code is in the 200 range
-		if (connection.getResponseCode() / 100 != 2) {
-			return errorStatus("Invalid response from connection.");			
-		}
-
-		// Check for valid content length
-		if (connection.getContentLength() < 1) {
-			return errorStatus("Invalid content length.");
-		}
-
-		return Status.OK_STATUS;
-	}
-	
-	/**
-	 * Download the Maemo SDK virtual image.
-	 * @param downloadFile the file to be downloaded.
-	 * @param progressMonitor the progress monitor.
-	 * @return the status as result of installation process.
-	 * @throws MicaException
-	 */
-	public IStatus downloadMaemoSDKImageTool() throws MicaException {
-		try {
-			CookieHandler.setDefault(new SessionHandler());
-
-			try {
-				return fileDownloader();
-			} catch (IOException e) {
-				throw new MicaException("Cannot download Maemo SDK virtual image", e);
-			}
-			
-	    } finally {
-			CookieHandler.setDefault(null);
-		}
-		
-	}
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,472 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.vm.vmware;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.CookieHandler;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.Policy;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
+import org.maemo.mica.internal.api.common.core.filesystem.FilesystemUtils;
+import org.maemo.mica.internal.api.common.core.http.connection.CopyProgressMonitor;
+import org.maemo.mica.internal.api.common.core.http.connection.DownloadingThread;
+import org.maemo.mica.internal.api.common.core.http.connection.SessionHandler;
+
+import com.nokia.cpp.internal.api.utils.core.Tuple;
+
+/**
+ * @author raulherbster
+ *
+ */
+public class MaemoSDKVMDownloader {
+
+	private MaemoSDKVMInfo downloadFile;
+	private IProgressMonitor monitor;
+	
+	/**
+	 * Construtor.
+	 * @param downloadFile
+	 * @param monitor
+	 */
+	protected MaemoSDKVMDownloader(MaemoSDKVMInfo downloadFile, IProgressMonitor monitor) {
+		this.downloadFile = downloadFile;
+		this.monitor = monitor;
+	}
+	
+	/**
+	 * Get URL and size of remote file.
+	 * @return URL and size of remote file.
+	 * @throws MicaException
+	 */
+	private Tuple getRemoteFileInfo() throws MicaException {
+		URL connectionURL = null;
+		try {
+			connectionURL = new URL(MaemoSDKVMInfo.DOWNLOAD_PAGE);
+		} catch (MalformedURLException e1) {
+			throw new MicaException("Cannot define URL for Maemo SDK virtual image");
+		}
+		
+		monitor.subTask("Retrieving  information from " + connectionURL.getHost());
+		
+		// Get the download page so links can be properly obtained
+		String downloadPage = openDownloadPage();
+		URL remoteURL;
+		int fileSize = 0;
+		try {
+			fileSize = getSizeFor(downloadPage, downloadFile.getDescription());
+			remoteURL = getLinkFor(downloadPage, downloadFile.getDescription());
+		} catch (MalformedURLException e) {
+			Activator.getErrorLogger().logAndShowError("Invalid file URL", e);
+			return null;
+		}
+				
+		return new Tuple(remoteURL, fileSize);
+	}
+	
+	/**
+	 * Return the download page.
+	 * 
+	 * @return the download page.
+	 */
+	private String openDownloadPage() {
+		String responsePage = null;
+		HttpURLConnection connection = null;
+				
+		try {
+			connection = connectWithPostMethod(new URL(
+					MaemoSDKVMInfo.DOWNLOAD_PAGE));
+			responsePage = getResponse(connection);
+			if (responsePage == null) {
+				throw new MicaException("Response page is empty"); //$NON-NLS-1$
+			}
+		} catch (Exception e) {
+			Activator.getErrorLogger().logAndShowError(
+					"Cannot connect with " + MaemoSDKVMInfo.DOWNLOAD_PAGE, e);
+			return null;
+		} finally {
+
+			if (connection != null)
+				connection.disconnect();
+
+		}
+		return responsePage;
+	}
+	
+	/**
+	 * Connect with post method on download page.
+	 * 
+	 * @param connectionUrl
+	 * @return
+	 * @throws MicaException
+	 */
+	private HttpURLConnection connectWithPostMethod(URL connectionUrl) throws MicaException {
+		// TODO refactor flasher on Mica so methods can be reused here.
+		OutputStreamWriter out = null;
+		HttpURLConnection conn = null;
+		try {
+			conn = (HttpURLConnection) connectionUrl.openConnection();
+			conn.setRequestMethod("POST"); //$NON-NLS-1$
+			conn.setDoOutput(true);
+			conn.setDoInput(true);
+			conn.setRequestProperty("Content-Type",
+			"application/x-www-form-urlencoded");
+			out = new OutputStreamWriter(conn.getOutputStream());
+			out.write("agree=I accept");
+			out.flush();
+			return conn;
+		} catch (MalformedURLException e) {
+			throw new MicaException("Malformed URL", e); //$NON-NLS-1$
+		} catch (IOException e) {
+			throw new MicaException("Cannot connect to " + connectionUrl, e);
+		} finally {
+			Policy.close(out);
+		}
+	}
+	
+	/**
+	 * 
+	 * @param conn
+	 * @return
+	 * @throws MicaException
+	 */
+	private String getResponse(HttpURLConnection conn) throws MicaException {
+		// TODO refactor flasher on Mica so methods can be reused here.
+		if (conn == null) {
+			throw new MicaException(new IllegalArgumentException(
+			"Connection cannot be null"));
+		}
+		BufferedReader bufReader = null;
+		try {
+			bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+		} catch (Exception e) {
+			throw new MicaException("Cannot get input from server", e);
+		}
+		StringBuffer buffer = new StringBuffer();
+		if (bufReader != null) {
+			String inputLine;
+			try {
+				while ((inputLine = bufReader.readLine()) != null) {
+					buffer.append(inputLine);
+					buffer.append("\n"); //$NON-NLS-1$
+				}
+			} catch (IOException e) {
+				throw new MicaException("Cannot read data from server", e);
+			}
+		}
+		if (buffer.length() > 0) {
+			return buffer.toString();
+		} else {
+			return null;
+		}
+	}
+
+	
+	
+	/**
+	 * Get the links for a certain download file. It the file consists of more
+	 * than 1 file, its parts will be properly obtained.
+	 * 
+	 * @param htmlPage
+	 * @param downloadFileDescription
+	 * @return
+	 * @throws MalformedURLException
+	 */
+	private URL getLinkFor(String htmlPage, String downloadFileDescription) throws MalformedURLException {
+		final String DOWNLOAD_FILE_PATTERN = "<tr>\\s*<td class=\"filename\">(.*?)</td>\\s*</tr>";
+		final String LINK_PATTERN = "<a href=\"(.*?)\">";
+		Pattern fileEntryPattern = Pattern.compile(DOWNLOAD_FILE_PATTERN,
+				Pattern.DOTALL | Pattern.UNIX_LINES);
+		Matcher matcher = fileEntryPattern.matcher(htmlPage);
+		while (matcher.find()) {
+			String fileInfo = matcher.group(0);
+			if (fileInfo.contains(downloadFileDescription)) {
+				Pattern hrefPattern = Pattern.compile(LINK_PATTERN,
+						Pattern.DOTALL | Pattern.UNIX_LINES);
+				Matcher matcherLink = hrefPattern.matcher(fileInfo);
+				if (matcherLink.find()) {
+					String link = matcherLink.group(1);
+					return (new URL(MaemoSDKVMInfo.DOWNLOAD_PAGE
+							+ link.substring(link.indexOf("?"))));
+				}
+			}
+
+		}
+		return null;
+	}
+	
+	/**
+	 * Get the size of a certain remote file. The file is retrieved from html page description.
+	 * @param htmlPage
+	 * @param downloadFileDescription
+	 * @return
+	 */
+	private int getSizeFor(String htmlPage, String downloadFileDescription) {
+		final String DOWNLOAD_FILE_PATTERN = "<tr>\\s*<td class=\"filename\">(.*?)</td>\\s*</tr>";
+		final String SIZE_PATTERN = "<td class=\"filesize\">(.*?)</td>";
+		Pattern fileEntryPattern = Pattern.compile(DOWNLOAD_FILE_PATTERN,
+				Pattern.DOTALL | Pattern.UNIX_LINES);
+		Matcher matcher = fileEntryPattern.matcher(htmlPage);
+		while (matcher.find()) {
+			String fileInfo = matcher.group(0);
+			if (fileInfo.contains(downloadFileDescription)) {
+				Pattern sizePattern = Pattern.compile(SIZE_PATTERN,
+						Pattern.DOTALL | Pattern.UNIX_LINES);
+				Matcher matcherLink = sizePattern.matcher(fileInfo);
+				if (matcherLink.find()) {
+					String size = matcherLink.group(1);
+					return Integer.parseInt(size);
+				}
+			}
+
+		}
+		return 0;
+	}
+	
+	/**
+	 * Get file name of download file to be saved locally
+	 * 
+	 * @param remoteURL
+	 * @param localPath
+	 * @return the name of file to be saved locally
+	 */
+	private String getFileName(URL remoteURL, URL localPath) {
+		String fileName = (new Path(remoteURL.getFile())).lastSegment();
+		fileName = fileName.substring(fileName.lastIndexOf("=") + 1);
+		return (new Path(localPath.getFile())).append(fileName).toOSString();
+	}
+	
+	/**
+	 * Get the size of previously downloaded file.
+	 * @param localFileName
+	 * @return
+	 */
+	private long getPreviousDownloadSize(String localFileName) {
+		File previousFile = new File(localFileName);
+		if (previousFile.exists()) {
+			boolean canResumeDownload = DialogUtils.showQuestionDialog(DialogUtils.getShell(), 
+					"Previous download file founded", "The file " + localFileName + " already exists. Would you like to resume download?");
+			if (canResumeDownload) {
+				return previousFile.length();
+			} else {
+				previousFile.delete();
+				return 0L;
+			}			
+		}
+		return 0L;
+	}
+	
+	/**
+	 * Download a Maemo SDK virtual image.
+	 * @return the status reported from this operation.
+	 * @throws IOException
+	 * @throws MicaException
+	 */
+	private IStatus fileDownloader() throws IOException, MicaException {
+		// Check if file was downloaded before
+		monitor.subTask("Checking information about file to be downloaded ...");
+				
+		Tuple remoteFileInfo = getRemoteFileInfo();
+		URL remoteURL = (URL) remoteFileInfo.get(0);
+		
+		// Get link of remote file
+		String fileName = getFileName(remoteURL, downloadFile.getLocalURL());	
+		
+		downloadFile.setDownloadedSize(getPreviousDownloadSize(fileName));			
+		Integer remoteFileSize = (Integer) remoteFileInfo.get(1);
+		
+		if (downloadFile.getDownloadedSize() == remoteFileSize.intValue())
+			return Activator.createStatus(Status.OK, "Maemo SDK virtual image is already downloaded.");
+		
+		HttpURLConnection connection = null;
+		RandomFileOutputStream out = null;
+		InputStream in = null;
+		
+		try {
+		
+			// Open connection to URL.
+			monitor.subTask("Establishing connection with " + remoteURL.getHost());
+			connection = (HttpURLConnection) remoteURL.openConnection();
+			
+			// Specify what portion of file to download
+			connection.setRequestProperty("Range", "bytes=" + downloadFile.getDownloadedSize() + "-");
+			
+			// Connect to server
+			connection.connect();
+			monitor.subTask("Connected with " + remoteURL.getHost());
+	
+			IStatus connectionStatus = validateConnection(connection);
+			if (!connectionStatus.isOK()) {
+				cancelDownload(downloadFile,monitor);
+				return errorStatus(connectionStatus.getMessage());
+			}
+			
+			int contentLength = connection.getContentLength();			
+			if (!haveEnoughtFreeSpace(contentLength/1024, downloadFile.getLocalURL())) {
+				cancelDownload(downloadFile, monitor);
+				return errorStatus("There is not enought space to save Maemo SDK virtual machine in your computer.");
+			}
+			
+			// set the size for this download if it hasn't been already set.
+			if (downloadFile.getSize() == -1) {
+				downloadFile.setSize(contentLength);
+			}
+			
+			CopyProgressMonitor progressMonitor = new CopyProgressMonitor("Downloading Maemo SDK virtual image",remoteFileSize, monitor);
+			progressMonitor.addProgress(downloadFile.getDownloadedSize());
+			progressMonitor.start();
+	
+			out = new RandomFileOutputStream(fileName,true);
+			out.setFilePointer(downloadFile.getDownloadedSize());	
+			in = connection.getInputStream();
+			
+			// create and start to download
+			monitor.beginTask(remoteURL.getFile(), remoteFileSize != 0 ? remoteFileSize : IProgressMonitor.UNKNOWN);
+			monitor.worked((int)downloadFile.getDownloadedSize());
+			
+			DownloadingThread thread = new DownloadingThread(in, out,Activator.BUFFER_SIZE, progressMonitor, monitor);
+			thread.start();
+
+			while (!thread.isInterrupted() && thread.isAlive() ) {
+				try {
+					Thread.sleep(1000);
+				} catch (InterruptedException e) {
+					continue;
+				}
+				
+				if (monitor.isCanceled()) {
+					thread.stopDownloading();
+					downloadFile.cancel();
+					throw new MicaException("Maemo SDK virtual image download was cancelled by user.");
+				}
+				
+				if(downloadFile.getStatus() == MaemoSDKVMInfo.Status.PAUSED){
+					thread.doPause();
+				}
+				
+				if(downloadFile.getStatus() == MaemoSDKVMInfo.Status.DOWNLOADING){
+					thread.doResume();
+				}
+			}
+			
+			if (thread.isCompleted() &&
+					downloadFile.getDownloadedSize() == remoteFileSize.intValue()) {
+				downloadFile.complete();
+			}
+			
+			if (thread.getErrorMessage() != null) {
+				downloadFile.error();
+				throw new IOException(thread.getErrorMessage());
+			}
+		} finally {
+
+			// Close connection to server.
+			if (in != null) {
+				in.close();
+			}
+
+			if (connection != null)
+				connection.disconnect();
+		}
+		
+		return Status.OK_STATUS;
+	}
+	
+	/**
+	 * Creates an error status based with the given message.
+	 * @param message
+	 * @return
+	 */
+	private static IStatus errorStatus(String message) {
+		return Activator.createStatus(IStatus.ERROR, message);
+	}
+	
+	/**
+	 * Cancel download.
+	 * @param fileDownload
+	 * @param monitor
+	 */
+	private static void cancelDownload(MaemoSDKVMInfo fileDownload, IProgressMonitor monitor) {
+		fileDownload.error();
+		monitor.setCanceled(true);
+		monitor.done();
+	}
+	
+	/**
+	 * Check if there is enough space to uncompress the Maemo SDK virtual image. 
+	 * @param fileSize the size of file (in Kbytes)
+	 * @param localURL the destination path to uncompress the Maemo SDK virtual image.
+	 * @return boolean if there is enough space to uncompress the Maemo SDK virtual image (if the free space
+	 * available on disk is bigger than the size of uncompressed Maemo SDK virtual image); false, otherwise.
+	 */
+	private static boolean haveEnoughtFreeSpace(int fileSize, URL localURL) throws IOException {
+		long freeSpace = FilesystemUtils.freeSpaceOS(new Path(localURL.getPath()),true);
+		return freeSpace > fileSize;
+	}
+	
+	/**
+	 * Validate the http connection.
+	 * @param connection the connection to be validated.
+	 * @return an IStatus as result.
+	 * @throws IOException
+	 */
+	private static IStatus validateConnection(HttpURLConnection connection) throws IOException {
+		// Make sure response code is in the 200 range
+		if (connection.getResponseCode() / 100 != 2) {
+			return errorStatus("Invalid response from connection.");			
+		}
+
+		// Check for valid content length
+		if (connection.getContentLength() < 1) {
+			return errorStatus("Invalid content length.");
+		}
+
+		return Status.OK_STATUS;
+	}
+	
+	/**
+	 * Download the Maemo SDK virtual image.
+	 * @param downloadFile the file to be downloaded.
+	 * @param progressMonitor the progress monitor.
+	 * @return the status as result of installation process.
+	 * @throws MicaException
+	 */
+	public IStatus downloadMaemoSDKImageTool() throws MicaException {
+		try {
+			CookieHandler.setDefault(new SessionHandler());
+
+			try {
+				return fileDownloader();
+			} catch (IOException e) {
+				throw new MicaException("Cannot download Maemo SDK virtual image", e);
+			}
+			
+	    } finally {
+			CookieHandler.setDefault(null);
+		}
+		
+	}
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.api.vm.vmware;
-
-import java.net.URL;
-
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-/**
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMInfo {
-
-	public static final String DOWNLOAD_PAGE = "http://tablets-dev.nokia.com/maemo-dev-env-downloads.php";
-
-	// status for the file
-	public enum Status {
-		DOWNLOADING, // file is being downloaded
-		PAUSED, // download is waiting
-		COMPLETE, // download is complete
-		CANCELLED, // download was canceled
-		ERROR
-		// an error occurred
-	}
-
-	// main information
-	private String description;
-	private long size;
-	private long downloaded;
-	private Status status;
-
-	// urls for download and storage
-	private URL localPathURL;
-
-	private boolean hasMoreParts;
-
-	/**
-	 * Constructor.
-	 */
-	public MaemoSDKVMInfo() {
-		this(null);
-	}
-
-	/**
-	 * Constructor.
-	 * 
-	 * @param url
-	 */
-	public MaemoSDKVMInfo(URL localURL) {
-		this.localPathURL = localURL;
-		size = -1;
-		downloaded = 0;
-		description = "";
-		status = Status.DOWNLOADING;
-	}
-
-	/**
-	 * Get the description of this file.
-	 * 
-	 * @return the description of this file.
-	 */
-	public String getDescription() {
-		return description;
-	}
-
-	/**
-	 * Set the description of this file.
-	 * 
-	 * @param description
-	 *            the new description.
-	 */
-	public void setDescription(String description) {
-		this.description = description;
-	}
-
-	/**
-	 * Get this download's URL.
-	 * 
-	 * @return
-	 */
-	public URL getLocalURL() {
-		return localPathURL;
-	}
-
-	/**
-	 * Get this download's URL.
-	 * 
-	 * @return
-	 */
-	public void setLocalURL(URL localURL) {
-		this.localPathURL = localURL;
-	}
-
-	/**
-	 * Get this download's size.
-	 * 
-	 * @return
-	 */
-	public long getSize() {
-		return size;
-	}
-
-	/**
-	 * 
-	 * @param size
-	 */
-	public void setSize(long size) {
-		this.size = size;
-	}
-
-	/**
-	 * Get the number of bytes already downloaded.
-	 * 
-	 * @return
-	 */
-	public long getDownloadedSize() {
-		return downloaded;
-	}
-
-	/**
-	 * Set the number of downloaded bytes.
-	 * 
-	 * @param downloaded
-	 */
-	public void setDownloadedSize(long downloaded) {
-		this.downloaded = downloaded;
-	}
-
-	/**
-	 * Get progress of this download file
-	 * 
-	 * @return
-	 */
-	public float getProgress() {
-		return ((float) downloaded / size) * 100;
-	}
-
-	/**
-	 * Return the status of this download file
-	 * 
-	 * @return
-	 */
-	public Status getStatus() {
-		return status;
-	}
-
-	/**
-	 * Set download state to PAUSED.
-	 */
-	public void pause() {
-		status = Status.PAUSED;
-	}
-
-	/**
-	 * Resume the download.
-	 */
-	public void resume() {
-		status = Status.DOWNLOADING;
-	}
-
-	/**
-	 * Set download state to CANCELLED.
-	 */
-	public void cancel() {
-		status = Status.CANCELLED;
-	}
-
-	/**
-	 * Set download state to ERROR.
-	 */
-	public void error() {
-		status = Status.ERROR;
-	}
-
-	/**
-	 * Set download state to ERROR.
-	 */
-	public void complete() {
-		status = Status.COMPLETE;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (obj == null)
-			return false;
-		if (obj.getClass() != this.getClass())
-			return false;
-		MaemoSDKVMInfo downloadFile = (MaemoSDKVMInfo) obj;
-		return description.equals(downloadFile.getDescription());
-
-	}
-
-	/**
-	 * Check if the file has more than one part.
-	 * 
-	 * @return true, if the file has more than one part; false, otherwise.
-	 */
-	public boolean hasMoreParts() {
-		return this.hasMoreParts;
-	}
-
-	/**
-	 * Set if the file has more than one part.
-	 * 
-	 * @param hasMoreParts
-	 */
-	public void setHasMoreParts(boolean hasMoreParts) {
-		this.hasMoreParts = hasMoreParts;
-	}
-
-	/**
-	 * Download the file.
-	 * 
-	 * @return the runnable process
-	 */
-	public IRunnableWithProgress downloadFile() {
-		return new DownloadExecution(this);
-	}
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.vm.vmware;
+
+import java.net.URL;
+
+import org.eclipse.jface.operation.IRunnableWithProgress;
+
+/**
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMInfo {
+
+	public static final String DOWNLOAD_PAGE = "http://tablets-dev.nokia.com/maemo-dev-env-downloads.php";
+
+	// status for the file
+	public enum Status {
+		DOWNLOADING, // file is being downloaded
+		PAUSED, // download is waiting
+		COMPLETE, // download is complete
+		CANCELLED, // download was canceled
+		ERROR
+		// an error occurred
+	}
+
+	// main information
+	private String description;
+	private long size;
+	private long downloaded;
+	private Status status;
+
+	// urls for download and storage
+	private URL localPathURL;
+
+	private boolean hasMoreParts;
+
+	/**
+	 * Constructor.
+	 */
+	public MaemoSDKVMInfo() {
+		this(null);
+	}
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param url
+	 */
+	public MaemoSDKVMInfo(URL localURL) {
+		this.localPathURL = localURL;
+		size = -1;
+		downloaded = 0;
+		description = "";
+		status = Status.DOWNLOADING;
+	}
+
+	/**
+	 * Get the description of this file.
+	 * 
+	 * @return the description of this file.
+	 */
+	public String getDescription() {
+		return description;
+	}
+
+	/**
+	 * Set the description of this file.
+	 * 
+	 * @param description
+	 *            the new description.
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	/**
+	 * Get this download's URL.
+	 * 
+	 * @return
+	 */
+	public URL getLocalURL() {
+		return localPathURL;
+	}
+
+	/**
+	 * Get this download's URL.
+	 * 
+	 * @return
+	 */
+	public void setLocalURL(URL localURL) {
+		this.localPathURL = localURL;
+	}
+
+	/**
+	 * Get this download's size.
+	 * 
+	 * @return
+	 */
+	public long getSize() {
+		return size;
+	}
+
+	/**
+	 * 
+	 * @param size
+	 */
+	public void setSize(long size) {
+		this.size = size;
+	}
+
+	/**
+	 * Get the number of bytes already downloaded.
+	 * 
+	 * @return
+	 */
+	public long getDownloadedSize() {
+		return downloaded;
+	}
+
+	/**
+	 * Set the number of downloaded bytes.
+	 * 
+	 * @param downloaded
+	 */
+	public void setDownloadedSize(long downloaded) {
+		this.downloaded = downloaded;
+	}
+
+	/**
+	 * Get progress of this download file
+	 * 
+	 * @return
+	 */
+	public float getProgress() {
+		return ((float) downloaded / size) * 100;
+	}
+
+	/**
+	 * Return the status of this download file
+	 * 
+	 * @return
+	 */
+	public Status getStatus() {
+		return status;
+	}
+
+	/**
+	 * Set download state to PAUSED.
+	 */
+	public void pause() {
+		status = Status.PAUSED;
+	}
+
+	/**
+	 * Resume the download.
+	 */
+	public void resume() {
+		status = Status.DOWNLOADING;
+	}
+
+	/**
+	 * Set download state to CANCELLED.
+	 */
+	public void cancel() {
+		status = Status.CANCELLED;
+	}
+
+	/**
+	 * Set download state to ERROR.
+	 */
+	public void error() {
+		status = Status.ERROR;
+	}
+
+	/**
+	 * Set download state to ERROR.
+	 */
+	public void complete() {
+		status = Status.COMPLETE;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (obj == null)
+			return false;
+		if (obj.getClass() != this.getClass())
+			return false;
+		MaemoSDKVMInfo downloadFile = (MaemoSDKVMInfo) obj;
+		return description.equals(downloadFile.getDescription());
+
+	}
+
+	/**
+	 * Check if the file has more than one part.
+	 * 
+	 * @return true, if the file has more than one part; false, otherwise.
+	 */
+	public boolean hasMoreParts() {
+		return this.hasMoreParts;
+	}
+
+	/**
+	 * Set if the file has more than one part.
+	 * 
+	 * @param hasMoreParts
+	 */
+	public void setHasMoreParts(boolean hasMoreParts) {
+		this.hasMoreParts = hasMoreParts;
+	}
+
+	/**
+	 * Download the file.
+	 * 
+	 * @return the runnable process
+	 */
+	public IRunnableWithProgress downloadFile() {
+		return new DownloadExecution(this);
+	}
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,513 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.api.vm.vmware;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo.Status;
-import org.maemo.esbox.internal.scratchbox.sb1.ui.wizard.NewScratchbox1SDKWizard;
-import org.maemo.esbox.internal.scratchbox.sb1.ui.wizard.NewScratchbox1TargetWizard;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.esbox.internal.vm.vmware.ui.wizards.MaemoSDKVMInstallData;
-import org.maemo.esbox.vm.core.IVirtualMachine;
-import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-import org.maemo.esbox.vm.ui.SelectVirtualMachineDialog;
-import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
-import org.maemo.mica.common.core.Policy;
-import org.maemo.mica.common.core.machine.IBuildMachine;
-import org.maemo.mica.common.core.machine.IMachine;
-import org.maemo.mica.common.core.machine.MachineRegistry;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
-import org.maemo.mica.common.core.sdk.SDKManager;
-import org.maemo.mica.common.core.ui.IProgressReporter;
-import org.maemo.mica.internal.api.common.core.filesystem.FilesystemUtils;
-import org.maemo.mica.internal.api.linux.packages.core.aptinstall.AptInstallerHelper;
-
-import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
-
-/**
- * This class wraps the main methods used during installation of Maemo SDK
- * virtual image.
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMInstaller {
-
-	private MaemoSDKVMInstallData installData;
-	private IProgressReporter reporter;
-
-	/**
-	 * Constructor.
-	 * 
-	 * @param installData
-	 *            the installation data
-	 * @param reporter
-	 *            the progress reporter
-	 */
-	public MaemoSDKVMInstaller(MaemoSDKVMInstallData installData,
-			IProgressReporter reporter) {
-		this.installData = installData;
-		this.reporter = reporter;
-	}
-	
-	/**
-	 * Install component into virtual image based on installer data information
-	 * @param timeout the timeout
-	 * @param shell the shell
-	 * @param monitor the monitor
-	 * @return the result status as result for the installation process.
-	 */
-	public IStatus installVirtualImage(int timeout, Shell shell, IProgressMonitor monitor) {
-		IStatus status = Activator.createStatus(IStatus.OK, "Maemo SDK Virtual Image was properly installed.");
-		
-		if (!installData.canUsePreviousInstallation()) {
-			status = this.downloadVM(shell, monitor);
-		}
-		
-		if (canProceed(status))
-			status = this.uncompressVM(shell, monitor);
-		
-		if (canProceed(status) && installData.canInstallSbox()) {
-			promptPreferencesDialog(shell);
-			status = this.installScratchbox(shell,monitor);
-		}
-		
-		if (canProceed(status) && installData.canInstallTargets()) {
-			status = this.installScratchboxTargets(shell,monitor);
-		}
-
-		if (canProceed(status) && ((installData.canInstallCppEnv() || installData.canInstallPythonEnv()))) {
-			status = this.installPackages(shell, monitor);
-		}
-		
-		return status;
-	}
-
-	/**
-	 * Check if can go ahead on installation based on given status.
-	 * @param status the status.
-	 * @return true if can go ahead on installation process; false, otherwise.
-	 */
-	private boolean canProceed(IStatus status) {
-		return ! (status.matches(IStatus.CANCEL) || status.matches(IStatus.ERROR));
-	}
-	
-	/**
-	 * Download Maemo SDK virtual image. If the virtual image consists of more
-	 * than one file, the other will be also downloaded.
-	 * 
-	 * @return the result of download process as IStatus
-	 */
-	public IStatus downloadVM(final Shell shell, IProgressMonitor monitor) {
-		monitor.subTask("Downloading image...");
-		reporter.logInfo("Downloading Maemo SDK virtual image...");
-		
-		shell.getDisplay().syncExec(new Runnable() {
-
-			public void run() {
-				MaemoSDKVMInfo fileDownload = installData.getFileToDownload();
-				DownloadExecution downloadWrapper = (DownloadExecution) fileDownload.downloadFile();
-				try {
-					DownloadProgressMonitor progressMonitor = new DownloadProgressMonitor(shell, downloadWrapper);
-					progressMonitor.run(true, true, downloadWrapper);
-				} catch (Exception exception) {
-					Activator.getErrorLogger().logAndShowError("Error during Maemo SDK virtual image downloading", exception);
-				}
-			}
-
-		});
-		IStatus result = Policy.getCancelStatus(Activator.getDefault());
-		Status downloadStatus = installData.getFileToDownload().getStatus();
-		if (downloadStatus.equals(Status.CANCELLED))
-			result = Activator.createErrorStatus(
-					"Maemo SDK virtual image download was canceled.", null);
-		else if (downloadStatus.equals(Status.ERROR))
-			result = Activator.createErrorStatus(
-					"An error occured during Maemo SDK virtual image download.", null);
-		else if (downloadStatus.equals(Status.COMPLETE))
-			result = Activator.createStatus(IStatus.OK,
-					"Maemo SDK virtual image was properly downloaded.");
-		return result;
-
-	}
-
-	/**
-	 * Uncompress the Maemo SDK virtual image.
-	 * 
-	 * @return the result of process as IStatus.
-	 */
-	public IStatus uncompressVM(final Shell shell, IProgressMonitor monitor) {
-		monitor.subTask("Uncompressing image...");
-		reporter.logInfo("Uncompressing Maemo SDK virtual image...");
-		
-		final String fileName = installData.getPathOfExistentVM();
-		final String destinationPath = installData.getInstallationPath();
-		
-		final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "File " + fileName
-				+ " was properly uncompressed into " + destinationPath) } ;
-		
-		if (fileName == null || !haveEnoughFreeSpace(fileName,destinationPath) ) {
-			return Activator.createStatus(IStatus.ERROR,"Cannot retrieve information about zipped Maemo SDK virtual image.");
-		} 
-		
-		shell.getDisplay().syncExec(new Runnable() {
-
-			public void run() {
-				try {					
-					ProgressMonitorDialog progressMonitor = new ProgressMonitorDialog(shell);	
-					progressMonitor.run(true, true, new IRunnableWithProgress() {
-						
-						public void run(IProgressMonitor monitor)
-								throws InvocationTargetException,
-								InterruptedException {
-							
-														
-							byte[] buf = new byte[1024];
-							ZipInputStream zipInputStream = null;
-							ZipEntry zipEntry = null;
-							FileOutputStream fileOutputStream = null;
-
-							try {
-								zipInputStream = new ZipInputStream(new FileInputStream(fileName));	
-								zipEntry = zipInputStream.getNextEntry();
-								while (zipEntry != null) {						
-									
-									// for each entry to be extracted
-									String entryName = zipEntry.getName();
-									
-									monitor.beginTask("Uncompressing Maemo SDK virtual image", 100);
-									
-									long lenght = zipEntry.getSize();
-									
-									File newFile = new File(entryName);
-									String directory = newFile.getParent();
-									if (directory == null) {
-										if (newFile.isDirectory())
-											break;
-									}
-
-									fileOutputStream = new FileOutputStream(destinationPath
-											+ File.separator + entryName);
-									int n;
-									long totalRead = 0;
-									int previousProgressValue = 0;
-									while ((n = zipInputStream.read(buf, 0, 1024)) > -1) {
-										// write on file
-										fileOutputStream.write(buf, 0, n);
-										
-										// update progress monitor bar
-										totalRead += n;
-										int progressValue = ((int) getProgress(lenght,totalRead));
-										if (previousProgressValue < progressValue) {
-											previousProgressValue = progressValue;
-											monitor.worked(1);
-										}
-										monitor.subTask("Uncompressing " + zipEntry
-												+ "\t\t"
-												+ String.format(Locale.US, "%.2f", getProgress(lenght,totalRead)) + "%");
-									}
-									fileOutputStream.close();
-									zipInputStream.closeEntry();
-									zipEntry = zipInputStream.getNextEntry();
-								}
-
-							} catch (IOException ioe) {
-								statuses[0] = Activator.createErrorStatus("Cannot uncompress Maemo SDK virtual image: I/O error", ioe);
-								reporter.appendStreamText("Cannot uncompress Maemo SDK virtual image.", true);
-							} finally {
-
-								Policy.close(zipInputStream);
-
-								Policy.close(fileOutputStream);
-
-							}
-							
-						}
-						
-					});
-				} catch (Exception e) {
-					statuses[0] = Activator.createErrorStatus("Cannot uncompress Maemo SDK virtual image.", e);
-					reporter.appendStreamText("Cannot procced with Maemo SDK virtual image uncompressing.",true);
-				}
-			}
-		});				
-
-		return statuses[0];
-	}
-	
-	/**
-	 * Utility method to install Scratchbox into Maemo SDK virtual image.
-	 * @param shell the shell
-	 * @param monitor the progress monitor
-	 * @return the result status of process
-	 */
-	private IStatus installScratchbox(final Shell shell, IProgressMonitor monitor) {
-		monitor.subTask("Installing Scratchbox 1...");
-		reporter.logInfo("Installing Scratchbox 1 on Maemo SDK virtual image. This operation may take several minutes.");
-		
-		final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "Scratchbox was properly installed on Maemo SDK virtual image.") } ;
-		
-		shell.getDisplay().syncExec(new Runnable() {
-			
-			public void run() {
-				statuses[0] = NewScratchbox1SDKWizard.startWizard();					
-			}
-			
-		});	
-		
-		return statuses[0];
-	}
-	
-	/**
-	 * Utility method to install Scratchbox targets into Maemo SDK virtual image.
-	 * @param shell the shell
-	 * @param monitor the progress monitor
-	 * @return the result status of process
-	 */
-	private IStatus installScratchboxTargets(final Shell shell, IProgressMonitor monitor) {
-		monitor.subTask("Installing Scratchbox 1 targets...");
-		reporter.logInfo("Installing Scratchbox 1 Targets on Maemo SDK virtual image. This operation may take several minutes.");
-		
-		final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "Scratchbox targets was properly installed on Maemo SDK virtual image.") } ;
-		
-		shell.getDisplay().syncExec(new Runnable() {
-			
-			public void run() {
-				statuses[0] = NewScratchbox1TargetWizard.startWizard();					
-			}
-			
-		});	
-		
-		return statuses[0];
-	}
-	
-	/**
-	 * Get the progress value of uncompressing process.
-	 * @param total
-	 * @param read
-	 * @return
-	 */
-	private float getProgress(long total, long read) {
-		return ((float) read / total) * 100;
-	}
-	
-	/**
-	 * Show a preference dialog that points to virtual image preference page. It is necessary
-	 * to configure the new virtual image so the installation process can proceeed. 
-	 * @param shell
-	 * @return
-	 */
-	private IStatus promptPreferencesDialog(final Shell shell) {
-		configureInitialVMSettings();
-		
-		final IStatus statuses[] = new IStatus[] {Policy.getCancelStatus(Activator.getDefault())};
-		
-		shell.getDisplay().syncExec(new Runnable() {
-
-			public void run() {
-				SelectVirtualMachineDialog dialog = new SelectVirtualMachineDialog(
-						WorkbenchUtils.getActiveShell());
-				int result = dialog.open();
-				if (result != Window.OK)
-					statuses[0] = Activator.createErrorStatus("Virtual image was not properly configured.", null);
-				else
-					statuses[0] = Activator.createStatus(IStatus.OK, "Virtual image configured.");
-			}			
-			
-		});
-		
-		return statuses[0];
-	}
-	
-	/**
-	 * Configure initial VM settings, such as vmx file path.
-	 */
-	public void configureInitialVMSettings() {
-		List<IBuildMachine> availableMachines = new ArrayList<IBuildMachine>(
-				Arrays.asList(MachineRegistry.getInstance().getAvailableBuildMachines()));
-		
-		IBuildMachine vmwareMachine = null;
-		
-		for (IBuildMachine buildMachine : availableMachines) {
-			String machineName = buildMachine.getName();
-			if(machineName.contains("VMware")) {
-				vmwareMachine = buildMachine;
-				break;
-			}
-		}
-				
-		IVirtualMachineConfiguration machineConfig = ((IVirtualMachine)vmwareMachine).getConfiguration();
-		
-		MachineRegistry.getInstance().setCurrentBuildMachine(vmwareMachine);
-		
-		String vmxFileLocation = getLocationVMXFile();
-		if (vmxFileLocation != null) {
-			vmxFileLocation = installData.getInstallationPath() + File.separator + vmxFileLocation;
-		} else {
-			vmxFileLocation = "";
-		}
-			
-		
-		((IVMwareConfiguration)machineConfig).setVmxPath(vmxFileLocation);
-	}
-	
-	/**
-	 * Get the location of vmx file.
-	 * @return
-	 */
-	public String getLocationVMXFile() {
-		String result = null;
-		File installationPath = new File(installData.getInstallationPath());
-		if (installationPath != null && installationPath.exists() && installationPath.isDirectory()) {
-			String filesNames[] = installationPath.list();
-			for (String fileName : filesNames) {
-				String ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length());	
-				if (ext.equals("vmx")) {
-					result = fileName;
-					break;
-				}
-			}			
-		}
-		return result;
-	}
-	
-	/**
-	 * Install programming environment packages (python and c++) into Maemo SDK virtual image.
-	 * @param timeout
-	 * @param shell
-	 * @param monitor
-	 * @return
-	 */
-	private IStatus installPackages(Shell shell, IProgressMonitor monitor) {
-		monitor.subTask("Installing programming environment...");
-		reporter.logInfo("Installing Python/C++ programming environment on Maemo SDK virtual image. This operation may take several minutes.");
-		
-		IStatus status = Policy.getCancelStatus(Activator.getDefault());
-		
-		ISDKTarget[] sdkTargets = getBuildMachineTargets();
-		
-		String[] packages = checkPackagesToInstall();
-		
-		status = AptInstallerHelper.installPackages(sdkTargets, packages, true, shell, reporter, monitor);
-				
-		return status;
-	}
-	
-	/**
-	 * Get targets of current build machine.
-	 * @return
-	 */
-	private ISDKTarget[] getBuildMachineTargets() {
-		IMachine currentMachine = getBuildMachine();
-
-		if (currentMachine == null)
-			return new ISDKTarget[0];
-
-		List<ISDKTarget> machineTargets = new ArrayList<ISDKTarget>();
-
-		ISDKTarget[] sdkTargets = SDKManager.getInstance().getAllSDKTargets();
-		for (ISDKTarget target : sdkTargets) {
-			IMachine targetMachine = target.getMachine();
-			if (targetMachine.getName().equals(currentMachine.getName()))
-				machineTargets.add(target);
-		}
-
-		return machineTargets.toArray(new ISDKTarget[machineTargets.size()]);
-	}
-	
-	/**
-	 * Get current build machine.
-	 * @return current build machine or <b>null</b> if any build machine is properly configured.
-	 */
-	private IMachine getBuildMachine() {
-		IBuildMachine buildMachines[] =
-			MachineRegistry.getInstance().getBuildMachines();
-		IBuildMachine machine = null;
-		for (IBuildMachine buildMachine : buildMachines) {
-			if (buildMachine.isAlive()) {
-				machine = buildMachine;
-				break;
-			}
-		}		
-		return machine;
-	}
-	
-	/**
-	 * Get packages to be installed into Maemo SDK virtual image based on the given <i>MaemoSDKVMInstallData</i>.
-	 * @return an array of String with packages to be installed into Maemo SDK virtual image.
-	 */
-	private String[] checkPackagesToInstall() {
-		List<String> packagesToInstall = new ArrayList<String>();
-		
-		if (installData.canInstallCppEnv() || installData.canInstallPythonEnv()) {
-			packagesToInstall.add("maemo-debug-scripts");
-			packagesToInstall.add("maemo-c-debug-tools");
-			if (installData.canInstallCppEnv())
-				packagesToInstall.add("maemo-cplusplus-env");
-			if (installData.canInstallPythonEnv())
-				packagesToInstall.add("maemo-python-env");
-		} 
-		
-		return packagesToInstall.toArray(new String[packagesToInstall.size()]);
-	}
-	
-	/**
-	 * Check if there is enough space to uncompress the Maemo SDK virtual image. 
-	 * @param fileName the name of Maemo SDK virtual image.
-	 * @param destinationPath the destination path to uncompress the Maemo SDK virtual image.
-	 * @return boolean if there is enough space to uncompress the Maemo SDK virtual image (if the free space
-	 * available on disk is bigger than the size of uncompressed Maemo SDK virtual image); false, otherwise.
-	 */
-	private static boolean haveEnoughFreeSpace(String fileName, String destinationPath) {
-		ZipInputStream zipInputStream = null;
-		ZipEntry zipEntry;
-		
-		try {
-			long fileSize = 0;
-			zipInputStream = new ZipInputStream(new FileInputStream(fileName));
-			
-			// check the total size of zip file. It is necessary to check the size of each zip file entry.
-			while ((zipEntry = zipInputStream.getNextEntry()) != null) {
-				fileSize += zipEntry.getSize();
-			}		
-			fileSize = fileSize / 1024; //Kb
-			long freeSpace = FilesystemUtils.freeSpaceOS(new Path(destinationPath),true);
-			return freeSpace > fileSize;
-		} catch (IOException e) {
-			Activator.getErrorLogger().logError("Cannot retrieve information about zipped Maemo SDK virtual image. I/O error", e);
-			return false;
-			
-		} finally {			
-			Policy.close(zipInputStream);			
-		}
-		
-		
-	}
-	
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,513 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.vm.vmware;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo.Status;
+import org.maemo.esbox.internal.scratchbox.sb1.ui.wizard.NewScratchbox1SDKWizard;
+import org.maemo.esbox.internal.scratchbox.sb1.ui.wizard.NewScratchbox1TargetWizard;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.esbox.internal.vm.vmware.ui.wizards.MaemoSDKVMInstallData;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.esbox.vm.ui.SelectVirtualMachineDialog;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.Policy;
+import org.maemo.mica.common.core.machine.IBuildMachine;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
+import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.core.sdk.SDKManager;
+import org.maemo.mica.common.core.ui.IProgressReporter;
+import org.maemo.mica.internal.api.common.core.filesystem.FilesystemUtils;
+import org.maemo.mica.internal.api.linux.packages.core.aptinstall.AptInstallerHelper;
+
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
+/**
+ * This class wraps the main methods used during installation of Maemo SDK
+ * virtual image.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMInstaller {
+
+	private MaemoSDKVMInstallData installData;
+	private IProgressReporter reporter;
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param installData
+	 *            the installation data
+	 * @param reporter
+	 *            the progress reporter
+	 */
+	public MaemoSDKVMInstaller(MaemoSDKVMInstallData installData,
+			IProgressReporter reporter) {
+		this.installData = installData;
+		this.reporter = reporter;
+	}
+	
+	/**
+	 * Install component into virtual image based on installer data information
+	 * @param timeout the timeout
+	 * @param shell the shell
+	 * @param monitor the monitor
+	 * @return the result status as result for the installation process.
+	 */
+	public IStatus installVirtualImage(int timeout, Shell shell, IProgressMonitor monitor) {
+		IStatus status = Activator.createStatus(IStatus.OK, "Maemo SDK Virtual Image was properly installed.");
+		
+		if (!installData.canUsePreviousInstallation()) {
+			status = this.downloadVM(shell, monitor);
+		}
+		
+		if (canProceed(status))
+			status = this.uncompressVM(shell, monitor);
+		
+		if (canProceed(status) && installData.canInstallSbox()) {
+			promptPreferencesDialog(shell);
+			status = this.installScratchbox(shell,monitor);
+		}
+		
+		if (canProceed(status) && installData.canInstallTargets()) {
+			status = this.installScratchboxTargets(shell,monitor);
+		}
+
+		if (canProceed(status) && ((installData.canInstallCppEnv() || installData.canInstallPythonEnv()))) {
+			status = this.installPackages(shell, monitor);
+		}
+		
+		return status;
+	}
+
+	/**
+	 * Check if can go ahead on installation based on given status.
+	 * @param status the status.
+	 * @return true if can go ahead on installation process; false, otherwise.
+	 */
+	private boolean canProceed(IStatus status) {
+		return ! (status.matches(IStatus.CANCEL) || status.matches(IStatus.ERROR));
+	}
+	
+	/**
+	 * Download Maemo SDK virtual image. If the virtual image consists of more
+	 * than one file, the other will be also downloaded.
+	 * 
+	 * @return the result of download process as IStatus
+	 */
+	public IStatus downloadVM(final Shell shell, IProgressMonitor monitor) {
+		monitor.subTask("Downloading image...");
+		reporter.logInfo("Downloading Maemo SDK virtual image...");
+		
+		shell.getDisplay().syncExec(new Runnable() {
+
+			public void run() {
+				MaemoSDKVMInfo fileDownload = installData.getFileToDownload();
+				DownloadExecution downloadWrapper = (DownloadExecution) fileDownload.downloadFile();
+				try {
+					DownloadProgressMonitor progressMonitor = new DownloadProgressMonitor(shell, downloadWrapper);
+					progressMonitor.run(true, true, downloadWrapper);
+				} catch (Exception exception) {
+					Activator.getErrorLogger().logAndShowError("Error during Maemo SDK virtual image downloading", exception);
+				}
+			}
+
+		});
+		IStatus result = Policy.getCancelStatus(Activator.getDefault());
+		Status downloadStatus = installData.getFileToDownload().getStatus();
+		if (downloadStatus.equals(Status.CANCELLED))
+			result = Activator.createErrorStatus(
+					"Maemo SDK virtual image download was canceled.", null);
+		else if (downloadStatus.equals(Status.ERROR))
+			result = Activator.createErrorStatus(
+					"An error occured during Maemo SDK virtual image download.", null);
+		else if (downloadStatus.equals(Status.COMPLETE))
+			result = Activator.createStatus(IStatus.OK,
+					"Maemo SDK virtual image was properly downloaded.");
+		return result;
+
+	}
+
+	/**
+	 * Uncompress the Maemo SDK virtual image.
+	 * 
+	 * @return the result of process as IStatus.
+	 */
+	public IStatus uncompressVM(final Shell shell, IProgressMonitor monitor) {
+		monitor.subTask("Uncompressing image...");
+		reporter.logInfo("Uncompressing Maemo SDK virtual image...");
+		
+		final String fileName = installData.getPathOfExistentVM();
+		final String destinationPath = installData.getInstallationPath();
+		
+		final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "File " + fileName
+				+ " was properly uncompressed into " + destinationPath) } ;
+		
+		if (fileName == null || !haveEnoughFreeSpace(fileName,destinationPath) ) {
+			return Activator.createStatus(IStatus.ERROR,"Cannot retrieve information about zipped Maemo SDK virtual image.");
+		} 
+		
+		shell.getDisplay().syncExec(new Runnable() {
+
+			public void run() {
+				try {					
+					ProgressMonitorDialog progressMonitor = new ProgressMonitorDialog(shell);	
+					progressMonitor.run(true, true, new IRunnableWithProgress() {
+						
+						public void run(IProgressMonitor monitor)
+								throws InvocationTargetException,
+								InterruptedException {
+							
+														
+							byte[] buf = new byte[1024];
+							ZipInputStream zipInputStream = null;
+							ZipEntry zipEntry = null;
+							FileOutputStream fileOutputStream = null;
+
+							try {
+								zipInputStream = new ZipInputStream(new FileInputStream(fileName));	
+								zipEntry = zipInputStream.getNextEntry();
+								while (zipEntry != null) {						
+									
+									// for each entry to be extracted
+									String entryName = zipEntry.getName();
+									
+									monitor.beginTask("Uncompressing Maemo SDK virtual image", 100);
+									
+									long lenght = zipEntry.getSize();
+									
+									File newFile = new File(entryName);
+									String directory = newFile.getParent();
+									if (directory == null) {
+										if (newFile.isDirectory())
+											break;
+									}
+
+									fileOutputStream = new FileOutputStream(destinationPath
+											+ File.separator + entryName);
+									int n;
+									long totalRead = 0;
+									int previousProgressValue = 0;
+									while ((n = zipInputStream.read(buf, 0, 1024)) > -1) {
+										// write on file
+										fileOutputStream.write(buf, 0, n);
+										
+										// update progress monitor bar
+										totalRead += n;
+										int progressValue = ((int) getProgress(lenght,totalRead));
+										if (previousProgressValue < progressValue) {
+											previousProgressValue = progressValue;
+											monitor.worked(1);
+										}
+										monitor.subTask("Uncompressing " + zipEntry
+												+ "\t\t"
+												+ String.format(Locale.US, "%.2f", getProgress(lenght,totalRead)) + "%");
+									}
+									fileOutputStream.close();
+									zipInputStream.closeEntry();
+									zipEntry = zipInputStream.getNextEntry();
+								}
+
+							} catch (IOException ioe) {
+								statuses[0] = Activator.createErrorStatus("Cannot uncompress Maemo SDK virtual image: I/O error", ioe);
+								reporter.appendStreamText("Cannot uncompress Maemo SDK virtual image.", true);
+							} finally {
+
+								Policy.close(zipInputStream);
+
+								Policy.close(fileOutputStream);
+
+							}
+							
+						}
+						
+					});
+				} catch (Exception e) {
+					statuses[0] = Activator.createErrorStatus("Cannot uncompress Maemo SDK virtual image.", e);
+					reporter.appendStreamText("Cannot procced with Maemo SDK virtual image uncompressing.",true);
+				}
+			}
+		});				
+
+		return statuses[0];
+	}
+	
+	/**
+	 * Utility method to install Scratchbox into Maemo SDK virtual image.
+	 * @param shell the shell
+	 * @param monitor the progress monitor
+	 * @return the result status of process
+	 */
+	private IStatus installScratchbox(final Shell shell, IProgressMonitor monitor) {
+		monitor.subTask("Installing Scratchbox 1...");
+		reporter.logInfo("Installing Scratchbox 1 on Maemo SDK virtual image. This operation may take several minutes.");
+		
+		final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "Scratchbox was properly installed on Maemo SDK virtual image.") } ;
+		
+		shell.getDisplay().syncExec(new Runnable() {
+			
+			public void run() {
+				statuses[0] = NewScratchbox1SDKWizard.startWizard();					
+			}
+			
+		});	
+		
+		return statuses[0];
+	}
+	
+	/**
+	 * Utility method to install Scratchbox targets into Maemo SDK virtual image.
+	 * @param shell the shell
+	 * @param monitor the progress monitor
+	 * @return the result status of process
+	 */
+	private IStatus installScratchboxTargets(final Shell shell, IProgressMonitor monitor) {
+		monitor.subTask("Installing Scratchbox 1 targets...");
+		reporter.logInfo("Installing Scratchbox 1 Targets on Maemo SDK virtual image. This operation may take several minutes.");
+		
+		final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "Scratchbox targets was properly installed on Maemo SDK virtual image.") } ;
+		
+		shell.getDisplay().syncExec(new Runnable() {
+			
+			public void run() {
+				statuses[0] = NewScratchbox1TargetWizard.startWizard();					
+			}
+			
+		});	
+		
+		return statuses[0];
+	}
+	
+	/**
+	 * Get the progress value of uncompressing process.
+	 * @param total
+	 * @param read
+	 * @return
+	 */
+	private float getProgress(long total, long read) {
+		return ((float) read / total) * 100;
+	}
+	
+	/**
+	 * Show a preference dialog that points to virtual image preference page. It is necessary
+	 * to configure the new virtual image so the installation process can proceeed. 
+	 * @param shell
+	 * @return
+	 */
+	private IStatus promptPreferencesDialog(final Shell shell) {
+		configureInitialVMSettings();
+		
+		final IStatus statuses[] = new IStatus[] {Policy.getCancelStatus(Activator.getDefault())};
+		
+		shell.getDisplay().syncExec(new Runnable() {
+
+			public void run() {
+				SelectVirtualMachineDialog dialog = new SelectVirtualMachineDialog(
+						WorkbenchUtils.getActiveShell());
+				int result = dialog.open();
+				if (result != Window.OK)
+					statuses[0] = Activator.createErrorStatus("Virtual image was not properly configured.", null);
+				else
+					statuses[0] = Activator.createStatus(IStatus.OK, "Virtual image configured.");
+			}			
+			
+		});
+		
+		return statuses[0];
+	}
+	
+	/**
+	 * Configure initial VM settings, such as vmx file path.
+	 */
+	public void configureInitialVMSettings() {
+		List<IBuildMachine> availableMachines = new ArrayList<IBuildMachine>(
+				Arrays.asList(MachineRegistry.getInstance().getAvailableBuildMachines()));
+		
+		IBuildMachine vmwareMachine = null;
+		
+		for (IBuildMachine buildMachine : availableMachines) {
+			String machineName = buildMachine.getName();
+			if(machineName.contains("VMware")) {
+				vmwareMachine = buildMachine;
+				break;
+			}
+		}
+				
+		IVirtualMachineConfiguration machineConfig = ((IVirtualMachine)vmwareMachine).getConfiguration();
+		
+		MachineRegistry.getInstance().setCurrentBuildMachine(vmwareMachine);
+		
+		String vmxFileLocation = getLocationVMXFile();
+		if (vmxFileLocation != null) {
+			vmxFileLocation = installData.getInstallationPath() + File.separator + vmxFileLocation;
+		} else {
+			vmxFileLocation = "";
+		}
+			
+		
+		((IVMwareConfiguration)machineConfig).setVmxPath(vmxFileLocation);
+	}
+	
+	/**
+	 * Get the location of vmx file.
+	 * @return
+	 */
+	public String getLocationVMXFile() {
+		String result = null;
+		File installationPath = new File(installData.getInstallationPath());
+		if (installationPath != null && installationPath.exists() && installationPath.isDirectory()) {
+			String filesNames[] = installationPath.list();
+			for (String fileName : filesNames) {
+				String ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length());	
+				if (ext.equals("vmx")) {
+					result = fileName;
+					break;
+				}
+			}			
+		}
+		return result;
+	}
+	
+	/**
+	 * Install programming environment packages (python and c++) into Maemo SDK virtual image.
+	 * @param timeout
+	 * @param shell
+	 * @param monitor
+	 * @return
+	 */
+	private IStatus installPackages(Shell shell, IProgressMonitor monitor) {
+		monitor.subTask("Installing programming environment...");
+		reporter.logInfo("Installing Python/C++ programming environment on Maemo SDK virtual image. This operation may take several minutes.");
+		
+		IStatus status = Policy.getCancelStatus(Activator.getDefault());
+		
+		ISDKTarget[] sdkTargets = getBuildMachineTargets();
+		
+		String[] packages = checkPackagesToInstall();
+		
+		status = AptInstallerHelper.installPackages(sdkTargets, packages, true, shell, reporter, monitor);
+				
+		return status;
+	}
+	
+	/**
+	 * Get targets of current build machine.
+	 * @return
+	 */
+	private ISDKTarget[] getBuildMachineTargets() {
+		IMachine currentMachine = getBuildMachine();
+
+		if (currentMachine == null)
+			return new ISDKTarget[0];
+
+		List<ISDKTarget> machineTargets = new ArrayList<ISDKTarget>();
+
+		ISDKTarget[] sdkTargets = SDKManager.getInstance().getAllSDKTargets();
+		for (ISDKTarget target : sdkTargets) {
+			IMachine targetMachine = target.getMachine();
+			if (targetMachine.getName().equals(currentMachine.getName()))
+				machineTargets.add(target);
+		}
+
+		return machineTargets.toArray(new ISDKTarget[machineTargets.size()]);
+	}
+	
+	/**
+	 * Get current build machine.
+	 * @return current build machine or <b>null</b> if any build machine is properly configured.
+	 */
+	private IMachine getBuildMachine() {
+		IBuildMachine buildMachines[] =
+			MachineRegistry.getInstance().getBuildMachines();
+		IBuildMachine machine = null;
+		for (IBuildMachine buildMachine : buildMachines) {
+			if (buildMachine.isAlive()) {
+				machine = buildMachine;
+				break;
+			}
+		}		
+		return machine;
+	}
+	
+	/**
+	 * Get packages to be installed into Maemo SDK virtual image based on the given <i>MaemoSDKVMInstallData</i>.
+	 * @return an array of String with packages to be installed into Maemo SDK virtual image.
+	 */
+	private String[] checkPackagesToInstall() {
+		List<String> packagesToInstall = new ArrayList<String>();
+		
+		if (installData.canInstallCppEnv() || installData.canInstallPythonEnv()) {
+			packagesToInstall.add("maemo-debug-scripts");
+			packagesToInstall.add("maemo-c-debug-tools");
+			if (installData.canInstallCppEnv())
+				packagesToInstall.add("maemo-cplusplus-env");
+			if (installData.canInstallPythonEnv())
+				packagesToInstall.add("maemo-python-env");
+		} 
+		
+		return packagesToInstall.toArray(new String[packagesToInstall.size()]);
+	}
+	
+	/**
+	 * Check if there is enough space to uncompress the Maemo SDK virtual image. 
+	 * @param fileName the name of Maemo SDK virtual image.
+	 * @param destinationPath the destination path to uncompress the Maemo SDK virtual image.
+	 * @return boolean if there is enough space to uncompress the Maemo SDK virtual image (if the free space
+	 * available on disk is bigger than the size of uncompressed Maemo SDK virtual image); false, otherwise.
+	 */
+	private static boolean haveEnoughFreeSpace(String fileName, String destinationPath) {
+		ZipInputStream zipInputStream = null;
+		ZipEntry zipEntry;
+		
+		try {
+			long fileSize = 0;
+			zipInputStream = new ZipInputStream(new FileInputStream(fileName));
+			
+			// check the total size of zip file. It is necessary to check the size of each zip file entry.
+			while ((zipEntry = zipInputStream.getNextEntry()) != null) {
+				fileSize += zipEntry.getSize();
+			}		
+			fileSize = fileSize / 1024; //Kb
+			long freeSpace = FilesystemUtils.freeSpaceOS(new Path(destinationPath),true);
+			return freeSpace > fileSize;
+		} catch (IOException e) {
+			Activator.getErrorLogger().logError("Cannot retrieve information about zipped Maemo SDK virtual image. I/O error", e);
+			return false;
+			
+		} finally {			
+			Policy.close(zipInputStream);			
+		}
+		
+		
+	}
+	
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.api.vm.vmware;
-
-/**
- * Class that combines a RandonAccessFile and an OutputStream
- * so it can be used by other methods to download the file.
- * @author raulherbster
- *
- */
-import java.io.*;
-
-public class RandomFileOutputStream extends OutputStream {
-
-	protected RandomAccessFile randomFile; 
-	protected boolean sync;
-
-	/**
-	 * Constructor.
-	 * @param fileName the name of file 
-	 * @throws IOException
-	 */
-	public RandomFileOutputStream(String fileName) throws IOException {
-		this(fileName, false);
-	}
-
-	/**
-	 * Constructor.
-	 * @param fileName the name of file
-	 * @param syn
-	 * @throws IOException
-	 */
-	public RandomFileOutputStream(String fileName, boolean syn) throws IOException {
-		this(new File(fileName), syn);
-	}
-
-	/**
-	 * Constructor.
-	 * @param fileName the name of file
-	 * @throws IOException
-	 */
-	public RandomFileOutputStream(File fileName) throws IOException {
-		this(fileName, false);
-	}
-
-	/**
-	 * Constructor.
-	 * @param fileName the name of file
-	 * @param syn
-	 * @throws IOException
-	 */
-	public RandomFileOutputStream(File fileName, boolean syn) throws IOException {
-		super();
-
-		fileName = fileName.getAbsoluteFile();
-		
-		File par; // parent file
-		
-		if ((par = fileName.getParentFile()) != null) {
-			par.mkdir();
-		}
-		
-		randomFile = new RandomAccessFile(fileName, "rw");
-		sync = syn;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see java.io.OutputStream#write(int)
-	 */
-	public void write(int val) throws IOException {
-		randomFile.write(val);
-		if (sync) {
-			randomFile.getFD().sync();
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see java.io.OutputStream#write(byte[])
-	 */
-	public void write(byte[] val) throws IOException {
-		randomFile.write(val);
-		if (sync) {
-			randomFile.getFD().sync();
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see java.io.OutputStream#write(byte[], int, int)
-	 */
-	public void write(byte[] val, int off, int len) throws IOException {
-		randomFile.write(val, off, len);
-		if (sync) {
-			randomFile.getFD().sync();
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see java.io.OutputStream#flush()
-	 */
-	public void flush() throws IOException {
-		if (sync) {
-			randomFile.getFD().sync();
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see java.io.OutputStream#close()
-	 */
-	public void close() throws IOException {
-		randomFile.close();
-	}
-
-	/**
-	 * Get the position of file pointer.
-	 * @return the position of file pointer.
-	 * @throws IOException
-	 */
-	public long getFilePointer() throws IOException {
-		return randomFile.getFilePointer();
-	}
-
-	/**
-	 * Set the position of file pointer.
-	 * @param pos the position of file pointer.
-	 * @throws IOException
-	 */
-	public void setFilePointer(long pos) throws IOException {
-		randomFile.seek(pos);
-	}
-
-	/**
-	 * Get the size of this stream.
-	 * @return the size of this stream.
-	 * @throws IOException
-	 */
-	public long getFileSize() throws IOException {
-		return randomFile.length();
-	}
-
-	/**
-	 * Set the size of this stream.
-	 * @param len the new size of this stream
-	 * @throws IOException
-	 */
-	public void setFileSize(long len) throws IOException {
-		randomFile.setLength(len);
-	}
-
-	/**
-	 * Get the file descriptor of this stream.
-	 * @return the file descriptor of this stream.
-	 * @throws IOException
-	 */
-	public FileDescriptor getFD() throws IOException {
-		return randomFile.getFD();
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/RandomFileOutputStream.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.api.vm.vmware;
+
+/**
+ * Class that combines a RandonAccessFile and an OutputStream
+ * so it can be used by other methods to download the file.
+ * @author raulherbster
+ *
+ */
+import java.io.*;
+
+public class RandomFileOutputStream extends OutputStream {
+
+	protected RandomAccessFile randomFile; 
+	protected boolean sync;
+
+	/**
+	 * Constructor.
+	 * @param fileName the name of file 
+	 * @throws IOException
+	 */
+	public RandomFileOutputStream(String fileName) throws IOException {
+		this(fileName, false);
+	}
+
+	/**
+	 * Constructor.
+	 * @param fileName the name of file
+	 * @param syn
+	 * @throws IOException
+	 */
+	public RandomFileOutputStream(String fileName, boolean syn) throws IOException {
+		this(new File(fileName), syn);
+	}
+
+	/**
+	 * Constructor.
+	 * @param fileName the name of file
+	 * @throws IOException
+	 */
+	public RandomFileOutputStream(File fileName) throws IOException {
+		this(fileName, false);
+	}
+
+	/**
+	 * Constructor.
+	 * @param fileName the name of file
+	 * @param syn
+	 * @throws IOException
+	 */
+	public RandomFileOutputStream(File fileName, boolean syn) throws IOException {
+		super();
+
+		fileName = fileName.getAbsoluteFile();
+		
+		File par; // parent file
+		
+		if ((par = fileName.getParentFile()) != null) {
+			par.mkdir();
+		}
+		
+		randomFile = new RandomAccessFile(fileName, "rw");
+		sync = syn;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.io.OutputStream#write(int)
+	 */
+	public void write(int val) throws IOException {
+		randomFile.write(val);
+		if (sync) {
+			randomFile.getFD().sync();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.io.OutputStream#write(byte[])
+	 */
+	public void write(byte[] val) throws IOException {
+		randomFile.write(val);
+		if (sync) {
+			randomFile.getFD().sync();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.io.OutputStream#write(byte[], int, int)
+	 */
+	public void write(byte[] val, int off, int len) throws IOException {
+		randomFile.write(val, off, len);
+		if (sync) {
+			randomFile.getFD().sync();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.io.OutputStream#flush()
+	 */
+	public void flush() throws IOException {
+		if (sync) {
+			randomFile.getFD().sync();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.io.OutputStream#close()
+	 */
+	public void close() throws IOException {
+		randomFile.close();
+	}
+
+	/**
+	 * Get the position of file pointer.
+	 * @return the position of file pointer.
+	 * @throws IOException
+	 */
+	public long getFilePointer() throws IOException {
+		return randomFile.getFilePointer();
+	}
+
+	/**
+	 * Set the position of file pointer.
+	 * @param pos the position of file pointer.
+	 * @throws IOException
+	 */
+	public void setFilePointer(long pos) throws IOException {
+		randomFile.seek(pos);
+	}
+
+	/**
+	 * Get the size of this stream.
+	 * @return the size of this stream.
+	 * @throws IOException
+	 */
+	public long getFileSize() throws IOException {
+		return randomFile.length();
+	}
+
+	/**
+	 * Set the size of this stream.
+	 * @param len the new size of this stream
+	 * @throws IOException
+	 */
+	public void setFileSize(long len) throws IOException {
+		randomFile.setLength(len);
+	}
+
+	/**
+	 * Get the file descriptor of this stream.
+	 * @return the file descriptor of this stream.
+	 * @throws IOException
+	 */
+	public FileDescriptor getFD() throws IOException {
+		return randomFile.getFD();
+	}
+
+}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/ui (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/ui)

Modified: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -14,6 +14,8 @@
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.maemo.mica.common.core.ErrorLogger;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.Policy;
 import org.osgi.framework.BundleContext;
 
 import java.io.*;
@@ -25,6 +27,11 @@
 
 	// The plug-in ID
 	public static final String PLUGIN_ID = "org.maemo.esbox.vm.vmware";
+	
+	public static ImageDescriptor MAEMO_VM_WIZBAN_DESCRIPTOR = getImageDescriptor("./icons/full/wizban/virtual_machine_wiz.png");
+	public static ImageDescriptor MAEMO_VM_DESCRIPTOR = getImageDescriptor("./icons/full/etool16/virtual_machine.png");
+	
+	public static final int BUFFER_SIZE = 4096; // 4 KB
 
 	// The shared instance
 	private static Activator plugin;
@@ -137,5 +144,32 @@
 	public static ImageDescriptor getImageDescriptor(String path) {
 		return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
 	}
+	
+	/**
+	 * Read resource file
+	 * 
+	 * @param resouce
+	 *            file name
+	 * @return content of resource file
+	 * @throws MicaException
+	 */
+	public static String readResourceFile(String resouce) throws MicaException {
+		InputStream in = null;
+		try {
+			in = getPluginRelativeInputStream(resouce);
+			StringBuffer buf = new StringBuffer();
+			byte[] byteBuf = new byte[BUFFER_SIZE];
+			for (int n; (n = in.read(byteBuf)) > 0;) {
+				buf.append(new String(byteBuf, 0, n));
+			}
+			return buf.toString();
 
+		} catch (IOException e) {
+			throw new MicaException(e.getMessage(), e);
+		} finally {
+			Policy.close(in);
+		}
+	}
+
+
 }

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui)

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards)

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,292 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.wizard.WizardPage;
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-
-/**
- * This page displays information about Maemo SDK virtual machine configuration.
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMConfigurationWizardPage extends WizardPage {
-
-	private Button installEverything;
-
-	// installation details area
-	private Group installationDetailsGroup;
-	private Button installScratchbox;
-	private Button installScratchboxTargets;
-
-	// programming environment area
-	private Group programmingEnvGroup;
-	private Button installCPPEnv;
-	private Button installPythonEnv;
-
-	/**
-	 * Constructor.
-	 * 
-	 * @param wizard
-	 *            parent wizard.
-	 */
-	protected MaemoSDKVMConfigurationWizardPage(NewMaemoSDKVMWizard wizard) {
-		super("maemovm_postdonwload", "Maemo SDK Virtual Image Downloaded",
-				Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
-		setDescription("Select configuration options for Maemo SDK Virtual Image.");
-		setWizard(wizard);
-		setPageComplete(true);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
-	 * .Composite)
-	 */
-	public void createControl(Composite parent) {
-		Composite composite = new Composite(parent, SWT.NONE);
-		GridLayoutFactory.fillDefaults().numColumns(1).applyTo(composite);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
-		setControl(composite);
-
-		Label message = new Label(composite, SWT.NONE);
-		message
-				.setText("The virtual image XXX was properly saved on your machine");
-		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(message);
-
-		Label separator = new Label(composite, SWT.NONE);
-		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(separator);
-
-		installEverything = createButton(composite, SWT.CHECK,
-				"Install complete Maemo SDK programming environment");
-		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(installEverything);
-		installEverything
-				.setToolTipText("If checked, install the complete Maemo SDK programming environment on virtual image");
-		installEverything.setSelection(true);
-		installEverything.addSelectionListener(new SelectionAdapter() {
-
-			public void widgetSelected(SelectionEvent evt) {
-				boolean isInstallEverythingSelected = installEverything
-						.getSelection();
-				setInstallationDetailsButtonsSelection(isInstallEverythingSelected);
-				setInstallationDetailsGroupEnabled(!isInstallEverythingSelected);
-				setProgrammingEnvButtonsSelection(isInstallEverythingSelected);
-				setProgrammignEnvGroupEnabled(!isInstallEverythingSelected);
-				updateInstallData();
-			}
-
-		});
-
-		createInstallationDetailsArea(composite);
-
-		createProgrammingEnvironmentArea(composite);
-
-		setInstallationDetailsButtonsSelection(true);
-		setInstallationDetailsGroupEnabled(false);
-		setProgrammingEnvButtonsSelection(true);
-		setProgrammignEnvGroupEnabled(false);
-		
-		updateInstallData();
-	}
-
-	/**
-	 * Create contents of installation options area.
-	 * 
-	 * @param composite
-	 *            parent composite.
-	 */
-	private void createInstallationDetailsArea(Composite composite) {
-		installationDetailsGroup = new Group(composite, SWT.NONE);
-		installationDetailsGroup.setText("Installation Details");
-		installationDetailsGroup.setLayoutData(new GridData(
-				GridData.FILL_HORIZONTAL));
-		installationDetailsGroup.setLayout(new GridLayout(1, false));
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(
-				installationDetailsGroup);
-
-		installScratchbox = createButton(installationDetailsGroup, SWT.RADIO,
-				"Install Scratchbox");
-		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(installScratchbox);
-		installScratchbox
-				.setToolTipText("If checked, the wizard to install Scratchbox 1 is launched");
-		installScratchbox.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				updateInstallData();
-			}
-
-		});
-
-		installScratchboxTargets = createButton(installationDetailsGroup,
-				SWT.RADIO, "Install Scratchbox and Maemo SDK targets");
-		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(installScratchboxTargets);
-		installScratchboxTargets
-				.setToolTipText("If checked, the wizard to install Scratchbox 1 targets is launched");
-		installScratchboxTargets.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				updateInstallData();
-			}
-
-		});
-	}
-
-	/**
-	 * Create contents of programming environment contents area.
-	 * 
-	 * @param composite
-	 *            parent composite.
-	 */
-	private void createProgrammingEnvironmentArea(Composite composite) {
-		programmingEnvGroup = new Group(composite, SWT.NONE);
-		programmingEnvGroup.setText("Programming Environments");
-		programmingEnvGroup
-				.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		programmingEnvGroup.setLayout(new GridLayout(1, false));
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(
-				programmingEnvGroup);
-
-		installCPPEnv = createButton(programmingEnvGroup, SWT.CHECK,
-				"Install C/C++ programming environment");
-		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(installCPPEnv);
-		installCPPEnv
-				.setToolTipText("If checked, install C/C++ programming environment (maemo-c-debug-tools and maemo-debug-scripts and cplusplus-env)");
-		installCPPEnv.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
-				updateInstallData();				
-			}
-
-		});
-
-		installPythonEnv = createButton(programmingEnvGroup, SWT.CHECK,
-				"Install Python programming environment");
-		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(installPythonEnv);
-		installPythonEnv
-				.setToolTipText("If checked, install Python programming environment (maemo-python-env)");
-		installPythonEnv.addSelectionListener(new SelectionAdapter() {
-
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
-				updateInstallData();
-			}
-
-		});
-	}
-
-	/**
-	 * Utility method to create a button.
-	 * 
-	 * @param composite
-	 *            the parent composite.
-	 * @param style
-	 *            the style of the button.
-	 * @param text
-	 *            the button text.
-	 * @return
-	 */
-	private Button createButton(Composite composite, int style, String text) {
-		Button button = new Button(composite, style);
-		button.setText(text);
-		return button;
-	}
-
-	/**
-	 * Set selection of all buttons of details area.
-	 * 
-	 * @param isSelected
-	 */
-	private void setInstallationDetailsButtonsSelection(boolean isSelected) {
-		installScratchboxTargets.setSelection(isSelected);
-		if (isSelected) {
-			installScratchbox.setSelection(!isSelected);
-		}
-
-	}
-
-	/**
-	 * Set selection of all buttons of programming environment area.
-	 * 
-	 * @param isSelected
-	 */
-	private void setProgrammingEnvButtonsSelection(boolean isSelected) {
-		installCPPEnv.setSelection(isSelected);
-		installPythonEnv.setSelection(isSelected);
-	}
-
-	/**
-	 * Set select of installation details group if programming env is goind to be installed.
-	 * 
-	 * @param isSelected
-	 */
-	private void setButtonsForProgrammingEnvSelection(boolean isSelected) {
-		setInstallationDetailsGroupEnabled(!isSelected);
-		setInstallationDetailsButtonsSelection(isSelected);
-	}
-	
-	/**
-	 * Set enablement of all buttons of details area.
-	 * 
-	 * @param isEnabled
-	 */
-	private void setInstallationDetailsGroupEnabled(boolean isEnabled) {
-		installationDetailsGroup.setEnabled(isEnabled);
-	}
-
-	/**
-	 * Set enablement of all buttons of programming environment area.
-	 * 
-	 * @param isEnabled
-	 */
-	private void setProgrammignEnvGroupEnabled(boolean isEnabled) {
-		programmingEnvGroup.setEnabled(isEnabled);
-	}
-
-	/**
-	 * Update installation data based on selections of buttons.
-	 */
-	private void updateInstallData() {
-		MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard) getWizard())
-				.getInstallData();
-			installData.setInstallCppEnv(installCPPEnv.getSelection());
-			installData.setInstallPythonEnv(installPythonEnv.getSelection());
-			installData.setInstallTargets(installScratchboxTargets.getSelection() || installCPPEnv.getSelection() || 
-					installPythonEnv.getSelection());
-			installData.setInstallSbox(installScratchbox.getSelection() || installScratchboxTargets.getSelection());
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.WizardPage;
+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.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+
+/**
+ * This page displays information about Maemo SDK virtual machine configuration.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMConfigurationWizardPage extends WizardPage {
+
+	private Button installEverything;
+
+	// installation details area
+	private Group installationDetailsGroup;
+	private Button installScratchbox;
+	private Button installScratchboxTargets;
+
+	// programming environment area
+	private Group programmingEnvGroup;
+	private Button installCPPEnv;
+	private Button installPythonEnv;
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param wizard
+	 *            parent wizard.
+	 */
+	protected MaemoSDKVMConfigurationWizardPage(NewMaemoSDKVMWizard wizard) {
+		super("maemovm_postdonwload", "Maemo SDK Virtual Image Downloaded",
+				Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
+		setDescription("Select configuration options for Maemo SDK Virtual Image.");
+		setWizard(wizard);
+		setPageComplete(true);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite composite = new Composite(parent, SWT.NONE);
+		GridLayoutFactory.fillDefaults().numColumns(1).applyTo(composite);
+		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+		setControl(composite);
+
+		Label message = new Label(composite, SWT.NONE);
+		message
+				.setText("The virtual image XXX was properly saved on your machine");
+		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(message);
+
+		Label separator = new Label(composite, SWT.NONE);
+		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(separator);
+
+		installEverything = createButton(composite, SWT.CHECK,
+				"Install complete Maemo SDK programming environment");
+		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(installEverything);
+		installEverything
+				.setToolTipText("If checked, install the complete Maemo SDK programming environment on virtual image");
+		installEverything.setSelection(true);
+		installEverything.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent evt) {
+				boolean isInstallEverythingSelected = installEverything
+						.getSelection();
+				setInstallationDetailsButtonsSelection(isInstallEverythingSelected);
+				setInstallationDetailsGroupEnabled(!isInstallEverythingSelected);
+				setProgrammingEnvButtonsSelection(isInstallEverythingSelected);
+				setProgrammignEnvGroupEnabled(!isInstallEverythingSelected);
+				updateInstallData();
+			}
+
+		});
+
+		createInstallationDetailsArea(composite);
+
+		createProgrammingEnvironmentArea(composite);
+
+		setInstallationDetailsButtonsSelection(true);
+		setInstallationDetailsGroupEnabled(false);
+		setProgrammingEnvButtonsSelection(true);
+		setProgrammignEnvGroupEnabled(false);
+		
+		updateInstallData();
+	}
+
+	/**
+	 * Create contents of installation options area.
+	 * 
+	 * @param composite
+	 *            parent composite.
+	 */
+	private void createInstallationDetailsArea(Composite composite) {
+		installationDetailsGroup = new Group(composite, SWT.NONE);
+		installationDetailsGroup.setText("Installation Details");
+		installationDetailsGroup.setLayoutData(new GridData(
+				GridData.FILL_HORIZONTAL));
+		installationDetailsGroup.setLayout(new GridLayout(1, false));
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(
+				installationDetailsGroup);
+
+		installScratchbox = createButton(installationDetailsGroup, SWT.RADIO,
+				"Install Scratchbox");
+		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(installScratchbox);
+		installScratchbox
+				.setToolTipText("If checked, the wizard to install Scratchbox 1 is launched");
+		installScratchbox.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				updateInstallData();
+			}
+
+		});
+
+		installScratchboxTargets = createButton(installationDetailsGroup,
+				SWT.RADIO, "Install Scratchbox and Maemo SDK targets");
+		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(installScratchboxTargets);
+		installScratchboxTargets
+				.setToolTipText("If checked, the wizard to install Scratchbox 1 targets is launched");
+		installScratchboxTargets.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				updateInstallData();
+			}
+
+		});
+	}
+
+	/**
+	 * Create contents of programming environment contents area.
+	 * 
+	 * @param composite
+	 *            parent composite.
+	 */
+	private void createProgrammingEnvironmentArea(Composite composite) {
+		programmingEnvGroup = new Group(composite, SWT.NONE);
+		programmingEnvGroup.setText("Programming Environments");
+		programmingEnvGroup
+				.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		programmingEnvGroup.setLayout(new GridLayout(1, false));
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(
+				programmingEnvGroup);
+
+		installCPPEnv = createButton(programmingEnvGroup, SWT.CHECK,
+				"Install C/C++ programming environment");
+		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(installCPPEnv);
+		installCPPEnv
+				.setToolTipText("If checked, install C/C++ programming environment (maemo-c-debug-tools and maemo-debug-scripts and cplusplus-env)");
+		installCPPEnv.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
+				updateInstallData();				
+			}
+
+		});
+
+		installPythonEnv = createButton(programmingEnvGroup, SWT.CHECK,
+				"Install Python programming environment");
+		GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(installPythonEnv);
+		installPythonEnv
+				.setToolTipText("If checked, install Python programming environment (maemo-python-env)");
+		installPythonEnv.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
+				updateInstallData();
+			}
+
+		});
+	}
+
+	/**
+	 * Utility method to create a button.
+	 * 
+	 * @param composite
+	 *            the parent composite.
+	 * @param style
+	 *            the style of the button.
+	 * @param text
+	 *            the button text.
+	 * @return
+	 */
+	private Button createButton(Composite composite, int style, String text) {
+		Button button = new Button(composite, style);
+		button.setText(text);
+		return button;
+	}
+
+	/**
+	 * Set selection of all buttons of details area.
+	 * 
+	 * @param isSelected
+	 */
+	private void setInstallationDetailsButtonsSelection(boolean isSelected) {
+		installScratchboxTargets.setSelection(isSelected);
+		if (isSelected) {
+			installScratchbox.setSelection(!isSelected);
+		}
+
+	}
+
+	/**
+	 * Set selection of all buttons of programming environment area.
+	 * 
+	 * @param isSelected
+	 */
+	private void setProgrammingEnvButtonsSelection(boolean isSelected) {
+		installCPPEnv.setSelection(isSelected);
+		installPythonEnv.setSelection(isSelected);
+	}
+
+	/**
+	 * Set select of installation details group if programming env is goind to be installed.
+	 * 
+	 * @param isSelected
+	 */
+	private void setButtonsForProgrammingEnvSelection(boolean isSelected) {
+		setInstallationDetailsGroupEnabled(!isSelected);
+		setInstallationDetailsButtonsSelection(isSelected);
+	}
+	
+	/**
+	 * Set enablement of all buttons of details area.
+	 * 
+	 * @param isEnabled
+	 */
+	private void setInstallationDetailsGroupEnabled(boolean isEnabled) {
+		installationDetailsGroup.setEnabled(isEnabled);
+	}
+
+	/**
+	 * Set enablement of all buttons of programming environment area.
+	 * 
+	 * @param isEnabled
+	 */
+	private void setProgrammignEnvGroupEnabled(boolean isEnabled) {
+		programmingEnvGroup.setEnabled(isEnabled);
+	}
+
+	/**
+	 * Update installation data based on selections of buttons.
+	 */
+	private void updateInstallData() {
+		MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard) getWizard())
+				.getInstallData();
+			installData.setInstallCppEnv(installCPPEnv.getSelection());
+			installData.setInstallPythonEnv(installPythonEnv.getSelection());
+			installData.setInstallTargets(installScratchboxTargets.getSelection() || installCPPEnv.getSelection() || 
+					installPythonEnv.getSelection());
+			installData.setInstallSbox(installScratchbox.getSelection() || installScratchboxTargets.getSelection());
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import java.io.File;
-import java.net.MalformedURLException;
-
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-
-/**
- * This is a wrapper that contains information about Maemo SDK virtual image
- * installation process.
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMInstallData {
-
-	private MaemoSDKVMInfo fileToDownload;
-	private boolean usePreviousInstallation;
-	private String installationPath;
-	private String pathOfExistentVM;
-	private boolean licenseTermsAgreed;
-	private boolean installSbox;
-	private boolean installTargets;
-	private boolean installCppEnv;
-	private boolean installPythonEnv;
-
-	/**
-	 * Constructor.
-	 */
-	public MaemoSDKVMInstallData() {
-		fileToDownload = new MaemoSDKVMInfo();
-	}
-
-	/**
-	 * Set the file to download.
-	 * 
-	 * @param downloadFile
-	 */
-	public void setFileToDownload(MaemoSDKVMInfo downloadFile) {
-		if (downloadFile == null)
-			return;
-		this.fileToDownload = downloadFile;
-		if (fileToDownload.getLocalURL() == null && installationPath != null)
-			try {
-				fileToDownload.setLocalURL(new File(installationPath).toURL());
-			} catch (MalformedURLException e) {
-				Activator.getErrorLogger().logAndShowError(
-						"Cannot get location for file "
-								+ downloadFile.getDescription(), e);
-			}
-	}
-
-	/**
-	 * Return the file to download.
-	 * 
-	 * @return
-	 */
-	public MaemoSDKVMInfo getFileToDownload() {
-		return fileToDownload;
-	}
-
-	/**
-	 * @return the usePreviousInstallation
-	 */
-	public boolean canUsePreviousInstallation() {
-		return usePreviousInstallation;
-	}
-
-	/**
-	 * @param usePreviousInstallation
-	 *            the usePreviousInstallation to set
-	 */
-	public void setUsePreviousInstallation(boolean usePreviousInstallation) {
-		this.usePreviousInstallation = usePreviousInstallation;
-	}
-
-	/**
-	 * @return the installationPath
-	 */
-	public String getInstallationPath() {
-		return installationPath;
-	}
-
-	/**
-	 * @param installationPath
-	 *            the installationPath to set
-	 */
-	public void setInstallationPath(String installationPath) {
-		this.installationPath = installationPath;
-		try {
-			fileToDownload.setLocalURL(new File(installationPath).toURL());
-		} catch (MalformedURLException e) {
-			Activator.getErrorLogger().logAndShowError(
-					"Cannot get location for file "
-							+ fileToDownload.getDescription(), e);
-		}
-
-	}
-
-	/**
-	 * @return the pathOfExistentVM
-	 */
-	public String getPathOfExistentVM() {
-		return pathOfExistentVM;
-	}
-
-	/**
-	 * @param pathOfExistentVM
-	 *            the pathOfExistentVM to set
-	 */
-	public void setPathOfExistentVM(String pathOfExistentVM) {
-		this.pathOfExistentVM = pathOfExistentVM;
-	}
-
-	/**
-	 * @return the installSbox
-	 */
-	public boolean canInstallSbox() {
-		return installSbox;
-	}
-
-	/**
-	 * @param installSbox
-	 *            the installSbox to set
-	 */
-	public void setInstallSbox(boolean installSbox) {
-		this.installSbox = installSbox;
-	}
-
-	/**
-	 * @return the installTargets
-	 */
-	public boolean canInstallTargets() {
-		return installTargets;
-	}
-
-	/**
-	 * @param installTargets
-	 *            the installTargets to set
-	 */
-	public void setInstallTargets(boolean installTargets) {
-		this.installTargets = installTargets;
-	}
-
-	/**
-	 * @return true, if it is necessary to install Python programming
-	 *         environment; false, otherwise.
-	 */
-	public boolean canInstallPythonEnv() {
-		return installPythonEnv;
-	}
-
-	/**
-	 * @param installTargets
-	 *            the installTargets to set
-	 */
-	public void setInstallPythonEnv(boolean installPythonEnv) {
-		this.installPythonEnv = installPythonEnv;
-	}
-
-	/**
-	 * 
-	 * @return true, if it is necessary to install CPP programming environment;
-	 *         false, otherwise.
-	 */
-	public boolean canInstallCppEnv() {
-		return installCppEnv;
-	}
-
-	/**
-	 * @param installCppEnv
-	 *            the installTargets to set
-	 */
-	public void setInstallCppEnv(boolean installCppEnv) {
-		this.installCppEnv = installCppEnv;
-	}
-
-	/**
-	 * @return true, if license terms were agreed; false, otherwise.
-	 */
-	public boolean isLicenseTermsAgreed() {
-		return licenseTermsAgreed;
-	}
-
-	/**
-	 * @param licenseTermsAgreed
-	 *            the licenseTermsAgreed to set
-	 */
-	public void setLicenseTermsAgreed(boolean licenseTermsAgreed) {
-		this.licenseTermsAgreed = licenseTermsAgreed;
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+
+/**
+ * This is a wrapper that contains information about Maemo SDK virtual image
+ * installation process.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMInstallData {
+
+	private MaemoSDKVMInfo fileToDownload;
+	private boolean usePreviousInstallation;
+	private String installationPath;
+	private String pathOfExistentVM;
+	private boolean licenseTermsAgreed;
+	private boolean installSbox;
+	private boolean installTargets;
+	private boolean installCppEnv;
+	private boolean installPythonEnv;
+
+	/**
+	 * Constructor.
+	 */
+	public MaemoSDKVMInstallData() {
+		fileToDownload = new MaemoSDKVMInfo();
+	}
+
+	/**
+	 * Set the file to download.
+	 * 
+	 * @param downloadFile
+	 */
+	public void setFileToDownload(MaemoSDKVMInfo downloadFile) {
+		if (downloadFile == null)
+			return;
+		this.fileToDownload = downloadFile;
+		if (fileToDownload.getLocalURL() == null && installationPath != null)
+			try {
+				fileToDownload.setLocalURL(new File(installationPath).toURL());
+			} catch (MalformedURLException e) {
+				Activator.getErrorLogger().logAndShowError(
+						"Cannot get location for file "
+								+ downloadFile.getDescription(), e);
+			}
+	}
+
+	/**
+	 * Return the file to download.
+	 * 
+	 * @return
+	 */
+	public MaemoSDKVMInfo getFileToDownload() {
+		return fileToDownload;
+	}
+
+	/**
+	 * @return the usePreviousInstallation
+	 */
+	public boolean canUsePreviousInstallation() {
+		return usePreviousInstallation;
+	}
+
+	/**
+	 * @param usePreviousInstallation
+	 *            the usePreviousInstallation to set
+	 */
+	public void setUsePreviousInstallation(boolean usePreviousInstallation) {
+		this.usePreviousInstallation = usePreviousInstallation;
+	}
+
+	/**
+	 * @return the installationPath
+	 */
+	public String getInstallationPath() {
+		return installationPath;
+	}
+
+	/**
+	 * @param installationPath
+	 *            the installationPath to set
+	 */
+	public void setInstallationPath(String installationPath) {
+		this.installationPath = installationPath;
+		try {
+			fileToDownload.setLocalURL(new File(installationPath).toURL());
+		} catch (MalformedURLException e) {
+			Activator.getErrorLogger().logAndShowError(
+					"Cannot get location for file "
+							+ fileToDownload.getDescription(), e);
+		}
+
+	}
+
+	/**
+	 * @return the pathOfExistentVM
+	 */
+	public String getPathOfExistentVM() {
+		return pathOfExistentVM;
+	}
+
+	/**
+	 * @param pathOfExistentVM
+	 *            the pathOfExistentVM to set
+	 */
+	public void setPathOfExistentVM(String pathOfExistentVM) {
+		this.pathOfExistentVM = pathOfExistentVM;
+	}
+
+	/**
+	 * @return the installSbox
+	 */
+	public boolean canInstallSbox() {
+		return installSbox;
+	}
+
+	/**
+	 * @param installSbox
+	 *            the installSbox to set
+	 */
+	public void setInstallSbox(boolean installSbox) {
+		this.installSbox = installSbox;
+	}
+
+	/**
+	 * @return the installTargets
+	 */
+	public boolean canInstallTargets() {
+		return installTargets;
+	}
+
+	/**
+	 * @param installTargets
+	 *            the installTargets to set
+	 */
+	public void setInstallTargets(boolean installTargets) {
+		this.installTargets = installTargets;
+	}
+
+	/**
+	 * @return true, if it is necessary to install Python programming
+	 *         environment; false, otherwise.
+	 */
+	public boolean canInstallPythonEnv() {
+		return installPythonEnv;
+	}
+
+	/**
+	 * @param installTargets
+	 *            the installTargets to set
+	 */
+	public void setInstallPythonEnv(boolean installPythonEnv) {
+		this.installPythonEnv = installPythonEnv;
+	}
+
+	/**
+	 * 
+	 * @return true, if it is necessary to install CPP programming environment;
+	 *         false, otherwise.
+	 */
+	public boolean canInstallCppEnv() {
+		return installCppEnv;
+	}
+
+	/**
+	 * @param installCppEnv
+	 *            the installTargets to set
+	 */
+	public void setInstallCppEnv(boolean installCppEnv) {
+		this.installCppEnv = installCppEnv;
+	}
+
+	/**
+	 * @return true, if license terms were agreed; false, otherwise.
+	 */
+	public boolean isLicenseTermsAgreed() {
+		return licenseTermsAgreed;
+	}
+
+	/**
+	 * @param licenseTermsAgreed
+	 *            the licenseTermsAgreed to set
+	 */
+	public void setLicenseTermsAgreed(boolean licenseTermsAgreed) {
+		this.licenseTermsAgreed = licenseTermsAgreed;
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.maemo.mica.common.ui.TimeoutUI;
-import org.maemo.mica.internal.api.common.ui.wizards.WizardWorkProgressPageBase;
-
-/**
- * Work page for Maemo SDK virtual image installer.
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMInstallationWorkPage extends WizardWorkProgressPageBase {
-
-	private TimeoutUI timeoutUI;
-
-	/**
-	 * Constructor.
-	 * 
-	 * @param wizard
-	 *            parent wizard
-	 */
-	public MaemoSDKVMInstallationWorkPage(NewMaemoSDKVMWizard wizard) {
-		super(
-				"Install Maemo SDK Virtual Image",
-				"This page shows the installation process.  Before finishing, configure the settings and verify your network preferences.");
-		timeoutUI = new TimeoutUI();
-		timeoutUI.setTimeout(30);
-		setWizard(wizard);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jface.wizard.WizardPage#getWizard()
-	 */
-	@Override
-	public NewMaemoSDKVMWizard getWizard() {
-		return (NewMaemoSDKVMWizard) super.getWizard();
-	}
-
-	/**
-	 * @return the timeout in seconds
-	 */
-	public int getTimeout() {
-		return timeoutUI.getTimeout();
-	}
-
-	/**
-	 * @param timeout
-	 *            the timeout to set in seconds
-	 */
-	public void setTimeout(int timeout) {
-		timeoutUI.setTimeout(timeout);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @seeorg.maemo.mica.common.ui.wizards.WizardWorkProgressPageBase#
-	 * addControlsBelowProgress(org.eclipse.swt.widgets.Composite)
-	 */
-	@Override
-	protected void addControlsBelowProgress(Composite body) {
-		Composite options = new Composite(body, SWT.NONE);
-		options.setLayout(new GridLayout(2, true));
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(options);
-
-		Composite timeoutBlock = timeoutUI.createUI(options, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(timeoutBlock);
-
-		addStockNetworkSettingHyperlink(body);
-
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.mica.common.ui.TimeoutUI;
+import org.maemo.mica.internal.api.common.ui.wizards.WizardWorkProgressPageBase;
+
+/**
+ * Work page for Maemo SDK virtual image installer.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMInstallationWorkPage extends WizardWorkProgressPageBase {
+
+	private TimeoutUI timeoutUI;
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param wizard
+	 *            parent wizard
+	 */
+	public MaemoSDKVMInstallationWorkPage(NewMaemoSDKVMWizard wizard) {
+		super(
+				"Install Maemo SDK Virtual Image",
+				"This page shows the installation process.  Before finishing, configure the settings and verify your network preferences.");
+		timeoutUI = new TimeoutUI();
+		timeoutUI.setTimeout(30);
+		setWizard(wizard);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.wizard.WizardPage#getWizard()
+	 */
+	@Override
+	public NewMaemoSDKVMWizard getWizard() {
+		return (NewMaemoSDKVMWizard) super.getWizard();
+	}
+
+	/**
+	 * @return the timeout in seconds
+	 */
+	public int getTimeout() {
+		return timeoutUI.getTimeout();
+	}
+
+	/**
+	 * @param timeout
+	 *            the timeout to set in seconds
+	 */
+	public void setTimeout(int timeout) {
+		timeoutUI.setTimeout(timeout);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.maemo.mica.common.ui.wizards.WizardWorkProgressPageBase#
+	 * addControlsBelowProgress(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected void addControlsBelowProgress(Composite body) {
+		Composite options = new Composite(body, SWT.NONE);
+		options.setLayout(new GridLayout(2, true));
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(options);
+
+		Composite timeoutBlock = timeoutUI.createUI(options, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(timeoutBlock);
+
+		addStockNetworkSettingHyperlink(body);
+
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.swt.graphics.Image;
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.mica.internal.api.common.ui.LazyLoadingThreadTableContentProvider;
-
-import com.nokia.cpp.internal.api.utils.core.FileUtils;
-
-/**
- * Content and label provider for table that shows available Maemo SDK virtual
- * images.
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMInstallerContentLabelProvider extends
-		LazyLoadingThreadTableContentProvider {
-
-	/**
-	 * Thread to access information about available Maemo SDK virtual images on
-	 * website.
-	 * 
-	 * @author raulherbster
-	 * 
-	 */
-	protected class MaemoVMInstallScriptFetcherThread extends Thread {
-		protected Object newInput;
-
-		/**
-		 * Construtor.
-		 * 
-		 * @param newInput
-		 */
-		public MaemoVMInstallScriptFetcherThread(Object newInput) {
-			this.newInput = newInput;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.lang.Thread#run()
-		 */
-		public void run() {
-			doFetchScripts();
-
-			contents.remove(LOADING_LABEL);
-			doFireContentChanged();
-		}
-
-		/**
-		 * Implement by querying the input and/or calling fetchScriptsFromUrl()
-		 * and adding them to contents.
-		 */
-		protected void doFetchScripts() {
-			List<String> virtualImagesNames = fetchVMNamesFromUrl("http://tablets-dev.nokia.com/maemo-dev-env-downloads.php");
-			for (String name : virtualImagesNames) {
-				MaemoSDKVMInfo downloadFile = new MaemoSDKVMInfo();
-				downloadFile.setDescription(name);
-				if (!contents.contains(downloadFile))
-					contents.add(downloadFile);
-				else {
-					int indexOfExistingDownloadFile = contents
-							.indexOf(downloadFile);
-					((MaemoSDKVMInfo) contents.get(indexOfExistingDownloadFile))
-							.setHasMoreParts(true);
-				}
-			}
-		}
-
-		/**
-		 * Get available Maemo SDK virtual image from given URL.
-		 * 
-		 * @param urlString
-		 *            the url of website that contains information about
-		 *            available Maemo SDK virtual images.
-		 * @return a list with the names of available Maemo SDK virtual images.
-		 */
-		protected List<String> fetchVMNamesFromUrl(String urlString) {
-			URL url;
-			try {
-				url = new URL(urlString);
-			} catch (MalformedURLException e) {
-				Activator.getErrorLogger().logAndShowError(
-						"Invalid URL: " + urlString, e);
-				return Collections.emptyList();
-			}
-
-			List<String> virtualImagesNames = new ArrayList<String>();
-			try {
-
-				URLConnection connection = url.openConnection();
-				connection.setConnectTimeout(1000 * 10);
-				connection.connect();
-
-				// apparently this fetches the HTML...
-				String content = new String(FileUtils.readInputStreamContents(
-						connection.getInputStream(), "UTF-8"));
-
-				/*
-				 * The names of virtual images are on
-				 * http://tablets-dev.nokia.com/maemo-dev-env-downloads.php
-				 * (front-page). Basically, they list have the following format:
-				 * Maemo ANY_WORD Virtual ANY_WORD Image ANY_WORD Also, we
-				 * filter duplicated entries, for example, files split into two
-				 * parts.
-				 */
-				Pattern maemoVMPattern = Pattern
-						.compile("Maemo([\\w\\s]*)Virtual([\\w\\s]*)Image([\\w\\s]*)");
-				Matcher matcher = maemoVMPattern.matcher(content);
-				while (matcher.find()) {
-					String virtualImageName = matcher.group(0);
-					virtualImageName = processVirtualImageName(virtualImageName);
-					virtualImagesNames.add(virtualImageName);
-				}
-			} catch (Exception e) {
-				if (e instanceof InterruptedException)
-					return virtualImagesNames;
-
-				if (!isInterrupted())
-					Activator.getErrorLogger().logAndShowError(
-							"Could not fetch listing from " + url, e);
-			}
-
-			return virtualImagesNames;
-		}
-
-		/**
-		 * Process the description of Maemo SDK virtual image and only returns
-		 * the main description.
-		 * 
-		 * @param virtualImageName
-		 *            the complete description of a certain Maemo SDK virtual
-		 *            image.
-		 * @return the main description of a certain Maemo SDK virtual image.
-		 */
-		private String processVirtualImageName(String virtualImageName) {
-			int indexOfPar = virtualImageName.indexOf("(");
-			if (indexOfPar < 0)
-				return virtualImageName;
-			return virtualImageName.substring(0, indexOfPar).trim();
-		}
-	}
-
-	private Image vmImage;
-
-	/**
-	 * Construtor.
-	 */
-	public MaemoSDKVMInstallerContentLabelProvider() {
-		super();
-		vmImage = Activator.MAEMO_VM_DESCRIPTOR.createImage();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.maemo.mica.common.ui.common.LazyLoadingThreadTableContentProvider
-	 * #createContentFetchThread(java.lang.Object)
-	 */
-	@Override
-	protected Thread createContentFetchThread(Object newInput) {
-		return new MaemoVMInstallScriptFetcherThread(newInput);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
-	 * Object)
-	 */
-	public Object[] getChildren(Object parentElement) {
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
-	 * )
-	 */
-	public Object getParent(Object element) {
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
-	 * Object)
-	 */
-	public boolean hasChildren(Object element) {
-		return false;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
-	 */
-	public String getColumnText(Object element, int column) {
-		if (element == LOADING_LABEL)
-			return super.getColumnText(element, column);
-
-		if (element instanceof MaemoSDKVMInfo) {
-			MaemoSDKVMInfo data = (MaemoSDKVMInfo) element;
-			if (column == 0)
-				return data.getDescription();
-		}
-		return "";
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
-	 */
-	public Image getColumnImage(Object element, int column) {
-		if (element instanceof MaemoSDKVMInfo) {
-			if (column == 0)
-				return vmImage;
-		}
-		return null;
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.swt.graphics.Image;
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.mica.internal.api.common.ui.LazyLoadingThreadTableContentProvider;
+
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+
+/**
+ * Content and label provider for table that shows available Maemo SDK virtual
+ * images.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMInstallerContentLabelProvider extends
+		LazyLoadingThreadTableContentProvider {
+
+	/**
+	 * Thread to access information about available Maemo SDK virtual images on
+	 * website.
+	 * 
+	 * @author raulherbster
+	 * 
+	 */
+	protected class MaemoVMInstallScriptFetcherThread extends Thread {
+		protected Object newInput;
+
+		/**
+		 * Construtor.
+		 * 
+		 * @param newInput
+		 */
+		public MaemoVMInstallScriptFetcherThread(Object newInput) {
+			this.newInput = newInput;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.lang.Thread#run()
+		 */
+		public void run() {
+			doFetchScripts();
+
+			contents.remove(LOADING_LABEL);
+			doFireContentChanged();
+		}
+
+		/**
+		 * Implement by querying the input and/or calling fetchScriptsFromUrl()
+		 * and adding them to contents.
+		 */
+		protected void doFetchScripts() {
+			List<String> virtualImagesNames = fetchVMNamesFromUrl("http://tablets-dev.nokia.com/maemo-dev-env-downloads.php");
+			for (String name : virtualImagesNames) {
+				MaemoSDKVMInfo downloadFile = new MaemoSDKVMInfo();
+				downloadFile.setDescription(name);
+				if (!contents.contains(downloadFile))
+					contents.add(downloadFile);
+				else {
+					int indexOfExistingDownloadFile = contents
+							.indexOf(downloadFile);
+					((MaemoSDKVMInfo) contents.get(indexOfExistingDownloadFile))
+							.setHasMoreParts(true);
+				}
+			}
+		}
+
+		/**
+		 * Get available Maemo SDK virtual image from given URL.
+		 * 
+		 * @param urlString
+		 *            the url of website that contains information about
+		 *            available Maemo SDK virtual images.
+		 * @return a list with the names of available Maemo SDK virtual images.
+		 */
+		protected List<String> fetchVMNamesFromUrl(String urlString) {
+			URL url;
+			try {
+				url = new URL(urlString);
+			} catch (MalformedURLException e) {
+				Activator.getErrorLogger().logAndShowError(
+						"Invalid URL: " + urlString, e);
+				return Collections.emptyList();
+			}
+
+			List<String> virtualImagesNames = new ArrayList<String>();
+			try {
+
+				URLConnection connection = url.openConnection();
+				connection.setConnectTimeout(1000 * 10);
+				connection.connect();
+
+				// apparently this fetches the HTML...
+				String content = new String(FileUtils.readInputStreamContents(
+						connection.getInputStream(), "UTF-8"));
+
+				/*
+				 * The names of virtual images are on
+				 * http://tablets-dev.nokia.com/maemo-dev-env-downloads.php
+				 * (front-page). Basically, they list have the following format:
+				 * Maemo ANY_WORD Virtual ANY_WORD Image ANY_WORD Also, we
+				 * filter duplicated entries, for example, files split into two
+				 * parts.
+				 */
+				Pattern maemoVMPattern = Pattern
+						.compile("Maemo([\\w\\s]*)Virtual([\\w\\s]*)Image([\\w\\s]*)");
+				Matcher matcher = maemoVMPattern.matcher(content);
+				while (matcher.find()) {
+					String virtualImageName = matcher.group(0);
+					virtualImageName = processVirtualImageName(virtualImageName);
+					virtualImagesNames.add(virtualImageName);
+				}
+			} catch (Exception e) {
+				if (e instanceof InterruptedException)
+					return virtualImagesNames;
+
+				if (!isInterrupted())
+					Activator.getErrorLogger().logAndShowError(
+							"Could not fetch listing from " + url, e);
+			}
+
+			return virtualImagesNames;
+		}
+
+		/**
+		 * Process the description of Maemo SDK virtual image and only returns
+		 * the main description.
+		 * 
+		 * @param virtualImageName
+		 *            the complete description of a certain Maemo SDK virtual
+		 *            image.
+		 * @return the main description of a certain Maemo SDK virtual image.
+		 */
+		private String processVirtualImageName(String virtualImageName) {
+			int indexOfPar = virtualImageName.indexOf("(");
+			if (indexOfPar < 0)
+				return virtualImageName;
+			return virtualImageName.substring(0, indexOfPar).trim();
+		}
+	}
+
+	private Image vmImage;
+
+	/**
+	 * Construtor.
+	 */
+	public MaemoSDKVMInstallerContentLabelProvider() {
+		super();
+		vmImage = Activator.MAEMO_VM_DESCRIPTOR.createImage();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.maemo.mica.common.ui.common.LazyLoadingThreadTableContentProvider
+	 * #createContentFetchThread(java.lang.Object)
+	 */
+	@Override
+	protected Thread createContentFetchThread(Object newInput) {
+		return new MaemoVMInstallScriptFetcherThread(newInput);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
+	 * Object)
+	 */
+	public Object[] getChildren(Object parentElement) {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
+	 * )
+	 */
+	public Object getParent(Object element) {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
+	 * Object)
+	 */
+	public boolean hasChildren(Object element) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+	 */
+	public String getColumnText(Object element, int column) {
+		if (element == LOADING_LABEL)
+			return super.getColumnText(element, column);
+
+		if (element instanceof MaemoSDKVMInfo) {
+			MaemoSDKVMInfo data = (MaemoSDKVMInfo) element;
+			if (column == 0)
+				return data.getDescription();
+		}
+		return "";
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+	 */
+	public Image getColumnImage(Object element, int column) {
+		if (element instanceof MaemoSDKVMInfo) {
+			if (column == 0)
+				return vmImage;
+		}
+		return null;
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-
-/**
- * Page that display license contents.
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMLicenseWizardPage extends WizardPage {
-
-	private String license;
-	private boolean licenseTermsAgreed = false;
-	private boolean ok = false;
-
-	/**
-	 * Constructor
-	 * 
-	 * @param wizard
-	 *            parent wizard.
-	 */
-	protected MaemoSDKVMLicenseWizardPage(NewMaemoSDKVMWizard wizard) {
-		super("maemovm_licensepage", "License",
-				Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
-		try {
-			license = Activator.readResourceFile("./data/license.txt");
-		} catch (Exception e) {
-			Activator.getErrorLogger().logAndShowError(
-					"Cannot open license terms file.", e);
-		}
-		setWizard(wizard);
-		ok = true;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
-	 * .Composite)
-	 */
-	public void createControl(Composite parent) {
-		if (license != null) {
-			Composite container = new Composite(parent, SWT.NULL);
-			GridLayout layout = new GridLayout(1, false);
-			container.setLayout(layout);
-			GridData licenseGridData = new GridData(GridData.BEGINNING
-					| GridData.FILL_BOTH);
-			licenseGridData.widthHint = 500;
-			licenseGridData.heightHint = 300;
-			Text licenseText = new Text(container, SWT.BORDER | SWT.V_SCROLL
-					| SWT.WRAP);
-
-			StringBuffer licenseTextBuffer = new StringBuffer();
-			licenseTextBuffer
-					.append("THIS LICENSE COVERS THE FOLLOWING COMPONENTS\n\n");
-			// licenseTextBuffer.append(image.getDescription() + "\n");
-			// licenseTextBuffer.append(flasher.getDescription() + "\n");
-			licenseTextBuffer.append("\n");
-
-			licenseTextBuffer.append(license);
-			licenseText.setLayoutData(licenseGridData);
-			licenseText.setEditable(false);
-			// licenseText.setBackground(FlasherUtil.COLOR_WHITE);
-
-			licenseText.setText(licenseTextBuffer.toString());
-			licenseText.setTopIndex(0);
-
-			Button agreeButton = new Button(container, SWT.RADIO);
-			agreeButton.setText("I accept the terms of the license agreements"); //$NON-NLS-1$
-			agreeButton.addSelectionListener(new SelectionListener() {
-				public void widgetDefaultSelected(SelectionEvent event) {
-					// do nothing
-				}
-
-				public void widgetSelected(SelectionEvent event) {
-					licenseTermsAgreed = true;
-					setPageComplete(licenseTermsAgreed);
-				}
-			});
-			Button disagreeButton = new Button(container, SWT.RADIO);
-			disagreeButton
-					.setText("I do not accept the terms of the license agreements"); //$NON-NLS-1$
-			disagreeButton.setSelection(true);
-			disagreeButton.addSelectionListener(new SelectionListener() {
-				public void widgetDefaultSelected(SelectionEvent event) {
-					// do nothing
-				}
-
-				public void widgetSelected(SelectionEvent event) {
-					licenseTermsAgreed = false;
-					((NewMaemoSDKVMWizard) getWizard()).getInstallData()
-							.setLicenseTermsAgreed(licenseTermsAgreed);
-					setPageComplete(licenseTermsAgreed);
-				}
-			});
-
-			setControl(container);
-		} else {
-			ok = false;
-			final String message = "Cannot fetch license terms";
-			Activator.getErrorLogger().logAndShowError(message, null); //$NON-NLS-1$
-		}
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
-	 */
-	@Override
-	public boolean canFlipToNextPage() {
-		return ok && licenseTermsAgreed;
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+
+/**
+ * Page that display license contents.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMLicenseWizardPage extends WizardPage {
+
+	private String license;
+	private boolean licenseTermsAgreed = false;
+	private boolean ok = false;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param wizard
+	 *            parent wizard.
+	 */
+	protected MaemoSDKVMLicenseWizardPage(NewMaemoSDKVMWizard wizard) {
+		super("maemovm_licensepage", "License",
+				Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
+		try {
+			license = Activator.readResourceFile("./data/license.txt");
+		} catch (Exception e) {
+			Activator.getErrorLogger().logAndShowError(
+					"Cannot open license terms file.", e);
+		}
+		setWizard(wizard);
+		ok = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	public void createControl(Composite parent) {
+		if (license != null) {
+			Composite container = new Composite(parent, SWT.NULL);
+			GridLayout layout = new GridLayout(1, false);
+			container.setLayout(layout);
+			GridData licenseGridData = new GridData(GridData.BEGINNING
+					| GridData.FILL_BOTH);
+			licenseGridData.widthHint = 500;
+			licenseGridData.heightHint = 300;
+			Text licenseText = new Text(container, SWT.BORDER | SWT.V_SCROLL
+					| SWT.WRAP);
+
+			StringBuffer licenseTextBuffer = new StringBuffer();
+			licenseTextBuffer
+					.append("THIS LICENSE COVERS THE FOLLOWING COMPONENTS\n\n");
+			// licenseTextBuffer.append(image.getDescription() + "\n");
+			// licenseTextBuffer.append(flasher.getDescription() + "\n");
+			licenseTextBuffer.append("\n");
+
+			licenseTextBuffer.append(license);
+			licenseText.setLayoutData(licenseGridData);
+			licenseText.setEditable(false);
+			// licenseText.setBackground(FlasherUtil.COLOR_WHITE);
+
+			licenseText.setText(licenseTextBuffer.toString());
+			licenseText.setTopIndex(0);
+
+			Button agreeButton = new Button(container, SWT.RADIO);
+			agreeButton.setText("I accept the terms of the license agreements"); //$NON-NLS-1$
+			agreeButton.addSelectionListener(new SelectionListener() {
+				public void widgetDefaultSelected(SelectionEvent event) {
+					// do nothing
+				}
+
+				public void widgetSelected(SelectionEvent event) {
+					licenseTermsAgreed = true;
+					setPageComplete(licenseTermsAgreed);
+				}
+			});
+			Button disagreeButton = new Button(container, SWT.RADIO);
+			disagreeButton
+					.setText("I do not accept the terms of the license agreements"); //$NON-NLS-1$
+			disagreeButton.setSelection(true);
+			disagreeButton.addSelectionListener(new SelectionListener() {
+				public void widgetDefaultSelected(SelectionEvent event) {
+					// do nothing
+				}
+
+				public void widgetSelected(SelectionEvent event) {
+					licenseTermsAgreed = false;
+					((NewMaemoSDKVMWizard) getWizard()).getInstallData()
+							.setLicenseTermsAgreed(licenseTermsAgreed);
+					setPageComplete(licenseTermsAgreed);
+				}
+			});
+
+			setControl(container);
+		} else {
+			ok = false;
+			final String message = "Cannot fetch license terms";
+			Activator.getErrorLogger().logAndShowError(message, null); //$NON-NLS-1$
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
+	 */
+	@Override
+	public boolean canFlipToNextPage() {
+		return ok && licenseTermsAgreed;
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,412 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import java.io.File;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.wizard.WizardPage;
-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.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.mica.common.ui.NetworkSettingsUI;
-import org.maemo.mica.common.ui.dialogs.DialogUtils;
-
-/**
- * Page that displays general information about the Maemo SDK virtual image to
- * be installed.
- * 
- * @author raulherbster
- * 
- */
-public class MaemoSDKVMSelectionWizardPage extends WizardPage {
-
-	private static final MaemoSDKVMInfo latestVMInstallData = getLatestVMInstallFile();
-
-	private static MaemoSDKVMInfo getLatestVMInstallFile() {
-		MaemoSDKVMInfo downloadFile = new MaemoSDKVMInfo();
-		downloadFile
-				.setDescription("Maemo Diablo SDK Virtual Image with Ubuntu Intrepid Server");
-		return downloadFile;
-	}
-
-	// Virtual images area
-	private Button downloadLatest;
-	private TableViewer virtualImagesTable;
-
-	// options area
-	private Button usePreviousDownloadButton;
-	private Text destinationTextField;
-
-	// advanced area
-	private Button advancedButton;
-	private Composite advancedContent;
-	private Text existingVirtualImageTextField;
-
-	/**
-	 * Constructor.
-	 * 
-	 * @param wizard
-	 *            the parent wizard.
-	 */
-	protected MaemoSDKVMSelectionWizardPage(NewMaemoSDKVMWizard wizard) {
-		super("maemovm_selection", "Select Maemo SDK Virtual Image",
-				Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
-		setDescription("Select the Maemo SDK Virtual Image you want to install.");
-		setPageComplete(false);
-		setWizard(wizard);
-		// set latest maemo SDK VM
-		wizard.getInstallData().setFileToDownload(latestVMInstallData);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
-	 * .Composite)
-	 */
-	public void createControl(Composite parent) {
-		Composite composite = new Composite(parent, SWT.NONE);
-		GridLayoutFactory.fillDefaults().numColumns(4).applyTo(composite);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
-		setControl(composite);
-
-		createVirtualImagesSelector(composite);
-
-		createOptionsContent(composite);
-
-		createAdvancedContent(composite);
-
-		virtualImagesTable.setInput(new Object[0]);
-
-		for (TableColumn column : virtualImagesTable.getTable().getColumns()) {
-			column.pack();
-		}
-	}
-
-	/**
-	 * Create table that displays available Maemo SDK virtual image.
-	 * 
-	 * @param composite
-	 *            parent composite.
-	 */
-	private void createVirtualImagesSelector(Composite composite) {
-		Label label = new Label(composite, SWT.NONE);
-		label.setText("Select an image:");
-		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1)
-				.applyTo(label);
-		Link link = NetworkSettingsUI
-				.createStockNetworkSettingHyperlink(composite);
-		GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(2, 1)
-				.applyTo(link);
-
-		downloadLatest = createButton(composite, SWT.CHECK ,
-				"Download latest empty server image for Maemo");
-		downloadLatest.setSelection(true);
-		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
-				.applyTo(downloadLatest);
-		downloadLatest.addSelectionListener(new SelectionAdapter() {
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				virtualImagesTable.getTable().setEnabled(
-						!downloadLatest.getSelection());
-				if (downloadLatest.getSelection())
-					doChangeVMChoice(latestVMInstallData);
-				validatePage();
-			}
-		});
-
-		virtualImagesTable = new TableViewer(composite, SWT.BORDER | SWT.SCROLL_PAGE);
-		virtualImagesTable
-				.addSelectionChangedListener(new ISelectionChangedListener() {
-
-					public void selectionChanged(SelectionChangedEvent event) {
-						Object element = ((IStructuredSelection) event
-								.getSelection()).getFirstElement();
-						if (element instanceof MaemoSDKVMInfo) {
-							doChangeVMChoice((MaemoSDKVMInfo) element);
-							validatePage();
-						}
-					}
-
-				});
-
-		MaemoSDKVMInstallerContentLabelProvider platformProvider = new MaemoSDKVMInstallerContentLabelProvider();
-
-		virtualImagesTable.setContentProvider(platformProvider);
-		virtualImagesTable.setLabelProvider(platformProvider);
-
-		platformProvider.addListener(new ILabelProviderListener() {
-
-			public void labelProviderChanged(LabelProviderChangedEvent event) {
-				Display.getDefault().asyncExec(new Runnable() {
-					public void run() {
-						if (!virtualImagesTable.getTable().isDisposed()) {
-							for (TableColumn column : virtualImagesTable
-									.getTable().getColumns()) {
-								column.pack();
-							}
-						}
-					}
-				});
-			}
-		});
-
-		Table table = virtualImagesTable.getTable();
-		GridDataFactory.fillDefaults().grab(true, true).span(4, 1).applyTo(
-				table);
-
-		table.setHeaderVisible(true);
-		table.setLinesVisible(true);
-		table.setEnabled(false);
-
-		TableColumn column = new TableColumn(table, SWT.LEFT);
-		column.setText("Name");
-
-	}
-
-	/**
-	 * Create the contents with options to install Maemo SDK virtual image.
-	 * 
-	 * @param composite
-	 *            parent composite.
-	 */
-	public void createOptionsContent(Composite composite) {
-		usePreviousDownloadButton = createButton(composite, SWT.CHECK,
-				"Use previous download");
-		GridDataFactory.swtDefaults().span(4, 1).align(SWT.LEFT, SWT.CENTER)
-				.applyTo(usePreviousDownloadButton);
-		usePreviousDownloadButton
-				.setToolTipText("If checked, continue from a previous download of the virtual image if possible, else, always download.");
-		usePreviousDownloadButton.addSelectionListener(new SelectionAdapter() {
-
-			public void widgetSelected(SelectionEvent evt) {
-				boolean usePreviousDownload = usePreviousDownloadButton
-						.getSelection();
-				downloadLatest.setEnabled(!usePreviousDownload);
-				virtualImagesTable.getTable().setEnabled(
-						!usePreviousDownload && !downloadLatest.getSelection());
-				advancedButton.setEnabled(usePreviousDownload);
-				((NewMaemoSDKVMWizard) getWizard()).getInstallData()
-						.setUsePreviousInstallation(usePreviousDownload);
-			}
-
-		});
-
-		Label label = new Label(composite, SWT.NONE);
-		label.setText("Virtual image destination:");
-		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
-				.applyTo(label);
-
-		destinationTextField = new Text(composite, SWT.BORDER);
-		destinationTextField
-				.setToolTipText("Specify the location of Maemo SDK Virtual Image.");
-		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
-				destinationTextField);
-
-		Button browserButton = createButton(composite, SWT.PUSH ,
-				"Browse...");
-		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(
-				browserButton);
-		browserButton.addSelectionListener(new SelectionAdapter() {
-
-			public void widgetSelected(SelectionEvent evt) {
-				DirectoryDialog dialog = new DirectoryDialog(DialogUtils
-						.getShell(), SWT.OPEN);
-				dialog
-						.setText("Select the directory to save the Maemo SDK Virtual Image");
-				String pathDirectory = dialog.open();
-				if (pathDirectory != null) {
-					destinationTextField.setText(pathDirectory);
-					setDownloadFileLocalURL(pathDirectory);
-					validatePage();
-				}
-			}
-		});
-	}
-
-	/**
-	 * Create the contents of advanced area.
-	 * 
-	 * @param composite
-	 *            the parent composite.
-	 */
-	private void createAdvancedContent(Composite composite) {
-		Label label = new Label(composite, SWT.NONE);
-		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
-				.applyTo(label);
-
-		advancedButton = new Button(composite, SWT.TOGGLE);
-		GridDataFactory.swtDefaults().span(4, 1).applyTo(advancedButton);
-		advancedButton.setText("Advanced >>");
-		advancedButton.setSelection(false);
-		advancedButton.setEnabled(false);
-
-		advancedContent = new Composite(composite, SWT.NONE);
-		GridLayoutFactory.fillDefaults().numColumns(4).applyTo(advancedContent);
-
-		GridDataFactory.fillDefaults().grab(true, false).span(4, 1).applyTo(
-				advancedContent);
-		enableAdvancedContent(false);
-
-		label = new Label(advancedContent, SWT.NONE);
-		label.setText("Existing virtual image location:");
-		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
-				.applyTo(label);
-
-		existingVirtualImageTextField = new Text(advancedContent, SWT.BORDER);
-		existingVirtualImageTextField
-				.setToolTipText("Specify the location of existing compressed Maemo SDK Virtual Image.");
-		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
-				existingVirtualImageTextField);
-
-		Button browserButton = createButton(advancedContent, SWT.PUSH, "Browse...");
-		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(
-				browserButton);
-		browserButton.addSelectionListener(new SelectionAdapter() {
-
-			public void widgetSelected(SelectionEvent evt) {
-				FileDialog dialog = new FileDialog(DialogUtils.getShell(),
-						SWT.OPEN);
-				dialog.setFilterExtensions(new String[] { "*.zip" });
-				dialog
-						.setText("Select the location of compressed virtual image");
-				String pathDirectory = dialog.open();
-				if (pathDirectory != null) {
-					existingVirtualImageTextField.setText(pathDirectory);
-					((NewMaemoSDKVMWizard) getWizard()).getInstallData()
-							.setPathOfExistentVM(pathDirectory);
-					validatePage();
-				}
-			}
-		});
-
-		advancedButton.addSelectionListener(new SelectionAdapter() {
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				if (advancedButton.getSelection()) {
-					advancedButton.setText("<< Advanced");
-				} else {
-					advancedButton.setText("Advanced >>");
-				}
-				enableAdvancedContent(advancedButton.getSelection());
-			}
-		});
-	}
-
-	/**
-	 * Validate information of the wizard page, so we can check if it is
-	 * possible to proceed or not.
-	 */
-	private void validatePage() {
-		String imageLocation = destinationTextField.getText();
-		String errorMessage = null;
-		errorMessage = validatePathLocation(imageLocation);
-		if (!downloadLatest.getSelection()
-				&& virtualImagesTable.getSelection().isEmpty()
-				&& !usePreviousDownloadButton.getSelection()) {
-			errorMessage = "Select a virtual image to be installed on your host machine";
-		}
-		if (usePreviousDownloadButton.getSelection()) {
-			String existingVirtualImageLocation = existingVirtualImageTextField
-					.getText().trim();
-			errorMessage = validatePathLocation(existingVirtualImageLocation);
-		}
-		setErrorMessage(errorMessage);
-		setPageComplete(errorMessage == null);
-	}
-
-	/**
-	 * Check if the given path is valid.
-	 * 
-	 * @param path
-	 * @return
-	 */
-	private String validatePathLocation(String path) {
-		String errorMessage = null;
-		if (path.trim().equals("")) {
-			errorMessage = "Please, insert a valid location.";
-		} else {
-			File imageLocationPath = new File(path);
-			if (!imageLocationPath.exists())
-				errorMessage = "The path inserted " + path
-						+ " does not exist. Please, insert a valid location.";
-		}
-		return errorMessage;
-	}
-
-	/**
-	 * Utility method to create button.
-	 * 
-	 * @param composite
-	 *            parent composite.
-	 * @param style
-	 *            sytle of button.
-	 * @param text
-	 *            the text of the button.
-	 * @return a button created from the given options.
-	 */
-	private Button createButton(Composite composite, int style, String text) {
-		Button button = new Button(composite, style);
-		button.setText(text);
-		return button;
-	}
-
-	private void doChangeVMChoice(MaemoSDKVMInfo data) {
-		if (data != null) {
-			MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard) getWizard())
-					.getInstallData();
-			installData.setFileToDownload(data);
-			String localURL = destinationTextField.getText();
-			setDownloadFileLocalURL(localURL);
-		}
-	}
-
-	private void setDownloadFileLocalURL(String pathDirectory) {
-		if (pathDirectory != null) {
-			File imageLocationPath = new File(pathDirectory);
-			if (imageLocationPath.exists() && imageLocationPath.isDirectory())
-				((NewMaemoSDKVMWizard) getWizard()).getInstallData()
-						.setInstallationPath(pathDirectory);
-		}
-	}
-
-	/**
-	 * @param selection
-	 */
-	protected void enableAdvancedContent(boolean selection) {
-		advancedContent.setVisible(selection);
-		((GridData) advancedContent.getLayoutData()).exclude = !selection;
-		getShell().pack();
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,412 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import java.io.File;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.wizard.WizardPage;
+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.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.mica.common.ui.NetworkSettingsUI;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
+
+/**
+ * Page that displays general information about the Maemo SDK virtual image to
+ * be installed.
+ * 
+ * @author raulherbster
+ * 
+ */
+public class MaemoSDKVMSelectionWizardPage extends WizardPage {
+
+	private static final MaemoSDKVMInfo latestVMInstallData = getLatestVMInstallFile();
+
+	private static MaemoSDKVMInfo getLatestVMInstallFile() {
+		MaemoSDKVMInfo downloadFile = new MaemoSDKVMInfo();
+		downloadFile
+				.setDescription("Maemo Diablo SDK Virtual Image with Ubuntu Intrepid Server");
+		return downloadFile;
+	}
+
+	// Virtual images area
+	private Button downloadLatest;
+	private TableViewer virtualImagesTable;
+
+	// options area
+	private Button usePreviousDownloadButton;
+	private Text destinationTextField;
+
+	// advanced area
+	private Button advancedButton;
+	private Composite advancedContent;
+	private Text existingVirtualImageTextField;
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param wizard
+	 *            the parent wizard.
+	 */
+	protected MaemoSDKVMSelectionWizardPage(NewMaemoSDKVMWizard wizard) {
+		super("maemovm_selection", "Select Maemo SDK Virtual Image",
+				Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
+		setDescription("Select the Maemo SDK Virtual Image you want to install.");
+		setPageComplete(false);
+		setWizard(wizard);
+		// set latest maemo SDK VM
+		wizard.getInstallData().setFileToDownload(latestVMInstallData);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite composite = new Composite(parent, SWT.NONE);
+		GridLayoutFactory.fillDefaults().numColumns(4).applyTo(composite);
+		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+		setControl(composite);
+
+		createVirtualImagesSelector(composite);
+
+		createOptionsContent(composite);
+
+		createAdvancedContent(composite);
+
+		virtualImagesTable.setInput(new Object[0]);
+
+		for (TableColumn column : virtualImagesTable.getTable().getColumns()) {
+			column.pack();
+		}
+	}
+
+	/**
+	 * Create table that displays available Maemo SDK virtual image.
+	 * 
+	 * @param composite
+	 *            parent composite.
+	 */
+	private void createVirtualImagesSelector(Composite composite) {
+		Label label = new Label(composite, SWT.NONE);
+		label.setText("Select an image:");
+		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1)
+				.applyTo(label);
+		Link link = NetworkSettingsUI
+				.createStockNetworkSettingHyperlink(composite);
+		GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(2, 1)
+				.applyTo(link);
+
+		downloadLatest = createButton(composite, SWT.CHECK ,
+				"Download latest empty server image for Maemo");
+		downloadLatest.setSelection(true);
+		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
+				.applyTo(downloadLatest);
+		downloadLatest.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				virtualImagesTable.getTable().setEnabled(
+						!downloadLatest.getSelection());
+				if (downloadLatest.getSelection())
+					doChangeVMChoice(latestVMInstallData);
+				validatePage();
+			}
+		});
+
+		virtualImagesTable = new TableViewer(composite, SWT.BORDER | SWT.SCROLL_PAGE);
+		virtualImagesTable
+				.addSelectionChangedListener(new ISelectionChangedListener() {
+
+					public void selectionChanged(SelectionChangedEvent event) {
+						Object element = ((IStructuredSelection) event
+								.getSelection()).getFirstElement();
+						if (element instanceof MaemoSDKVMInfo) {
+							doChangeVMChoice((MaemoSDKVMInfo) element);
+							validatePage();
+						}
+					}
+
+				});
+
+		MaemoSDKVMInstallerContentLabelProvider platformProvider = new MaemoSDKVMInstallerContentLabelProvider();
+
+		virtualImagesTable.setContentProvider(platformProvider);
+		virtualImagesTable.setLabelProvider(platformProvider);
+
+		platformProvider.addListener(new ILabelProviderListener() {
+
+			public void labelProviderChanged(LabelProviderChangedEvent event) {
+				Display.getDefault().asyncExec(new Runnable() {
+					public void run() {
+						if (!virtualImagesTable.getTable().isDisposed()) {
+							for (TableColumn column : virtualImagesTable
+									.getTable().getColumns()) {
+								column.pack();
+							}
+						}
+					}
+				});
+			}
+		});
+
+		Table table = virtualImagesTable.getTable();
+		GridDataFactory.fillDefaults().grab(true, true).span(4, 1).applyTo(
+				table);
+
+		table.setHeaderVisible(true);
+		table.setLinesVisible(true);
+		table.setEnabled(false);
+
+		TableColumn column = new TableColumn(table, SWT.LEFT);
+		column.setText("Name");
+
+	}
+
+	/**
+	 * Create the contents with options to install Maemo SDK virtual image.
+	 * 
+	 * @param composite
+	 *            parent composite.
+	 */
+	public void createOptionsContent(Composite composite) {
+		usePreviousDownloadButton = createButton(composite, SWT.CHECK,
+				"Use previous download");
+		GridDataFactory.swtDefaults().span(4, 1).align(SWT.LEFT, SWT.CENTER)
+				.applyTo(usePreviousDownloadButton);
+		usePreviousDownloadButton
+				.setToolTipText("If checked, continue from a previous download of the virtual image if possible, else, always download.");
+		usePreviousDownloadButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent evt) {
+				boolean usePreviousDownload = usePreviousDownloadButton
+						.getSelection();
+				downloadLatest.setEnabled(!usePreviousDownload);
+				virtualImagesTable.getTable().setEnabled(
+						!usePreviousDownload && !downloadLatest.getSelection());
+				advancedButton.setEnabled(usePreviousDownload);
+				((NewMaemoSDKVMWizard) getWizard()).getInstallData()
+						.setUsePreviousInstallation(usePreviousDownload);
+			}
+
+		});
+
+		Label label = new Label(composite, SWT.NONE);
+		label.setText("Virtual image destination:");
+		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
+				.applyTo(label);
+
+		destinationTextField = new Text(composite, SWT.BORDER);
+		destinationTextField
+				.setToolTipText("Specify the location of Maemo SDK Virtual Image.");
+		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
+				destinationTextField);
+
+		Button browserButton = createButton(composite, SWT.PUSH ,
+				"Browse...");
+		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(
+				browserButton);
+		browserButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent evt) {
+				DirectoryDialog dialog = new DirectoryDialog(DialogUtils
+						.getShell(), SWT.OPEN);
+				dialog
+						.setText("Select the directory to save the Maemo SDK Virtual Image");
+				String pathDirectory = dialog.open();
+				if (pathDirectory != null) {
+					destinationTextField.setText(pathDirectory);
+					setDownloadFileLocalURL(pathDirectory);
+					validatePage();
+				}
+			}
+		});
+	}
+
+	/**
+	 * Create the contents of advanced area.
+	 * 
+	 * @param composite
+	 *            the parent composite.
+	 */
+	private void createAdvancedContent(Composite composite) {
+		Label label = new Label(composite, SWT.NONE);
+		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
+				.applyTo(label);
+
+		advancedButton = new Button(composite, SWT.TOGGLE);
+		GridDataFactory.swtDefaults().span(4, 1).applyTo(advancedButton);
+		advancedButton.setText("Advanced >>");
+		advancedButton.setSelection(false);
+		advancedButton.setEnabled(false);
+
+		advancedContent = new Composite(composite, SWT.NONE);
+		GridLayoutFactory.fillDefaults().numColumns(4).applyTo(advancedContent);
+
+		GridDataFactory.fillDefaults().grab(true, false).span(4, 1).applyTo(
+				advancedContent);
+		enableAdvancedContent(false);
+
+		label = new Label(advancedContent, SWT.NONE);
+		label.setText("Existing virtual image location:");
+		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
+				.applyTo(label);
+
+		existingVirtualImageTextField = new Text(advancedContent, SWT.BORDER);
+		existingVirtualImageTextField
+				.setToolTipText("Specify the location of existing compressed Maemo SDK Virtual Image.");
+		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
+				existingVirtualImageTextField);
+
+		Button browserButton = createButton(advancedContent, SWT.PUSH, "Browse...");
+		GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(
+				browserButton);
+		browserButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent evt) {
+				FileDialog dialog = new FileDialog(DialogUtils.getShell(),
+						SWT.OPEN);
+				dialog.setFilterExtensions(new String[] { "*.zip" });
+				dialog
+						.setText("Select the location of compressed virtual image");
+				String pathDirectory = dialog.open();
+				if (pathDirectory != null) {
+					existingVirtualImageTextField.setText(pathDirectory);
+					((NewMaemoSDKVMWizard) getWizard()).getInstallData()
+							.setPathOfExistentVM(pathDirectory);
+					validatePage();
+				}
+			}
+		});
+
+		advancedButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (advancedButton.getSelection()) {
+					advancedButton.setText("<< Advanced");
+				} else {
+					advancedButton.setText("Advanced >>");
+				}
+				enableAdvancedContent(advancedButton.getSelection());
+			}
+		});
+	}
+
+	/**
+	 * Validate information of the wizard page, so we can check if it is
+	 * possible to proceed or not.
+	 */
+	private void validatePage() {
+		String imageLocation = destinationTextField.getText();
+		String errorMessage = null;
+		errorMessage = validatePathLocation(imageLocation);
+		if (!downloadLatest.getSelection()
+				&& virtualImagesTable.getSelection().isEmpty()
+				&& !usePreviousDownloadButton.getSelection()) {
+			errorMessage = "Select a virtual image to be installed on your host machine";
+		}
+		if (usePreviousDownloadButton.getSelection()) {
+			String existingVirtualImageLocation = existingVirtualImageTextField
+					.getText().trim();
+			errorMessage = validatePathLocation(existingVirtualImageLocation);
+		}
+		setErrorMessage(errorMessage);
+		setPageComplete(errorMessage == null);
+	}
+
+	/**
+	 * Check if the given path is valid.
+	 * 
+	 * @param path
+	 * @return
+	 */
+	private String validatePathLocation(String path) {
+		String errorMessage = null;
+		if (path.trim().equals("")) {
+			errorMessage = "Please, insert a valid location.";
+		} else {
+			File imageLocationPath = new File(path);
+			if (!imageLocationPath.exists())
+				errorMessage = "The path inserted " + path
+						+ " does not exist. Please, insert a valid location.";
+		}
+		return errorMessage;
+	}
+
+	/**
+	 * Utility method to create button.
+	 * 
+	 * @param composite
+	 *            parent composite.
+	 * @param style
+	 *            sytle of button.
+	 * @param text
+	 *            the text of the button.
+	 * @return a button created from the given options.
+	 */
+	private Button createButton(Composite composite, int style, String text) {
+		Button button = new Button(composite, style);
+		button.setText(text);
+		return button;
+	}
+
+	private void doChangeVMChoice(MaemoSDKVMInfo data) {
+		if (data != null) {
+			MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard) getWizard())
+					.getInstallData();
+			installData.setFileToDownload(data);
+			String localURL = destinationTextField.getText();
+			setDownloadFileLocalURL(localURL);
+		}
+	}
+
+	private void setDownloadFileLocalURL(String pathDirectory) {
+		if (pathDirectory != null) {
+			File imageLocationPath = new File(pathDirectory);
+			if (imageLocationPath.exists() && imageLocationPath.isDirectory())
+				((NewMaemoSDKVMWizard) getWizard()).getInstallData()
+						.setInstallationPath(pathDirectory);
+		}
+	}
+
+	/**
+	 * @param selection
+	 */
+	protected void enableAdvancedContent(boolean selection) {
+		advancedContent.setVisible(selection);
+		((GridData) advancedContent.getLayoutData()).exclude = !selection;
+		getShell().pack();
+	}
+
+}

Deleted: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java
===================================================================
--- trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java	2009-08-19 15:25:13 UTC (rev 1974)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInstaller;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.mica.common.core.Policy;
-import org.maemo.mica.common.core.ui.IProgressReporter;
-import org.maemo.mica.internal.api.common.ui.wizards.WizardWorkProgressPageBase;
-
-/**
- * The Maemo SDK Virtual Image wizard provides an easy method to install SDK
- * Virtual Image for pre-installed VMWare Player/Fusion (download, install and
- * configure latest empty server image for Maemo)
- * 
- * @author raulherbster
- * 
- */
-public class NewMaemoSDKVMWizard extends Wizard implements INewWizard {
-
-	private MaemoSDKVMSelectionWizardPage targetPage;
-	private MaemoSDKVMInstallationWorkPage downloadUncompressWorkPage;
-	private MaemoSDKVMConfigurationWizardPage configurationPage;
-	private MaemoSDKVMLicenseWizardPage licensePage;
-	private MaemoSDKVMInstallData installData;
-
-	/**
-	 * Constructor
-	 */
-	public NewMaemoSDKVMWizard() {
-		initialize();
-		// create an empty install data
-		installData = new MaemoSDKVMInstallData();
-	}
-
-	/**
-	 * Initialize main information about this wizard.
-	 */
-	private void initialize() {
-		setNeedsProgressMonitor(true);
-		setWindowTitle("Install Maemo SDK Virtual Machine");
-		ImageDescriptor image = Activator.MAEMO_VM_WIZBAN_DESCRIPTOR;
-		setDefaultPageImageDescriptor(image);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jface.wizard.Wizard#addPages()
-	 */
-	public void addPages() {
-		targetPage = new MaemoSDKVMSelectionWizardPage(this);
-		addPage(targetPage);
-		configurationPage = new MaemoSDKVMConfigurationWizardPage(this);
-		addPage(configurationPage);
-		licensePage = new MaemoSDKVMLicenseWizardPage(this);
-		addPage(licensePage);
-		downloadUncompressWorkPage = new MaemoSDKVMInstallationWorkPage(this);
-		addPage(downloadUncompressWorkPage);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
-	 * org.eclipse.jface.viewers.IStructuredSelection)
-	 */
-	public void init(IWorkbench workbench, IStructuredSelection selection) {
-		// TODO Auto-generated method stub
-
-	}
-
-	/**
-	 * Get the work page to show information about installation process.
-	 * 
-	 * @return the work page of this wizard.
-	 */
-	public WizardWorkProgressPageBase getWorkPage() {
-		return downloadUncompressWorkPage;
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
-	 */
-	public boolean performFinish() {
-		final IStatus status = doWork();
-
-		final boolean success = (status.isOK() || status.matches(IStatus.INFO));
-
-		String message = success ? "Installation succeeded"
-				: "Installation encountered some errors";
-
-		boolean goOn = getWorkPage().reportOperationStatus(
-				"Maemo SDK Virtual Image installation results", message,
-				status, true)
-				&& !status.matches(IStatus.CANCEL);
-
-		return goOn;
-	}
-	
-	protected IStatus doWork() {
-
-		getWorkPage().showAndClearLog();
-
-		final IStatus[] statuses = { Policy.getCancelStatus(Activator
-				.getDefault()) };
-		try {
-			getContainer().run(true, true, new IRunnableWithProgress() {
-
-				public void run(IProgressMonitor monitor)
-						throws InvocationTargetException, InterruptedException {
-					
-					IStatus status = null;
-					
-					IProgressReporter reporter = getWorkPage().getProgressReporter();
-					
-					MaemoSDKVMInstaller vmInstaller = new MaemoSDKVMInstaller(installData, reporter);
-					
-					status = vmInstaller.installVirtualImage(((MaemoSDKVMInstallationWorkPage)getWorkPage()).getTimeout(), getShell(), monitor);
-					
-					if (status.matches(IStatus.CANCEL))
-						status = Activator.createErrorStatus("The Maemo SDK virtual image installation was canceled.", null);
-
-					if (status.matches(IStatus.CANCEL) || status.matches(IStatus.ERROR))
-						reporter.appendStreamText(status.getMessage(), true);
-					
-					statuses[0] = status;
-				}
-
-			});
-		} catch (Exception e) {
-			Activator.getErrorLogger().logAndShowError(e.getMessage(),
-					e.getCause());
-			statuses[0] = Activator.createErrorStatus("Maemo SDK virtual image installation failed unexpectedly",
-					e);
-		}
-		return statuses[0];
-	}
-
-	/**
-	 * Get the installation data that contains information to install Maemo SDK
-	 * virtual image.
-	 * 
-	 * @return the installation data.
-	 */
-	public MaemoSDKVMInstallData getInstallData() {
-		return installData;
-	}
-
-}

Copied: branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java (from rev 1974, trunk/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java)
===================================================================
--- branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java	                        (rev 0)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java	2009-08-19 16:15:11 UTC (rev 1975)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInstaller;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.mica.common.core.Policy;
+import org.maemo.mica.common.core.ui.IProgressReporter;
+import org.maemo.mica.internal.api.common.ui.wizards.WizardWorkProgressPageBase;
+
+/**
+ * The Maemo SDK Virtual Image wizard provides an easy method to install SDK
+ * Virtual Image for pre-installed VMWare Player/Fusion (download, install and
+ * configure latest empty server image for Maemo)
+ * 
+ * @author raulherbster
+ * 
+ */
+public class NewMaemoSDKVMWizard extends Wizard implements INewWizard {
+
+	private MaemoSDKVMSelectionWizardPage targetPage;
+	private MaemoSDKVMInstallationWorkPage downloadUncompressWorkPage;
+	private MaemoSDKVMConfigurationWizardPage configurationPage;
+	private MaemoSDKVMLicenseWizardPage licensePage;
+	private MaemoSDKVMInstallData installData;
+
+	/**
+	 * Constructor
+	 */
+	public NewMaemoSDKVMWizard() {
+		initialize();
+		// create an empty install data
+		installData = new MaemoSDKVMInstallData();
+	}
+
+	/**
+	 * Initialize main information about this wizard.
+	 */
+	private void initialize() {
+		setNeedsProgressMonitor(true);
+		setWindowTitle("Install Maemo SDK Virtual Machine");
+		ImageDescriptor image = Activator.MAEMO_VM_WIZBAN_DESCRIPTOR;
+		setDefaultPageImageDescriptor(image);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.wizard.Wizard#addPages()
+	 */
+	public void addPages() {
+		targetPage = new MaemoSDKVMSelectionWizardPage(this);
+		addPage(targetPage);
+		configurationPage = new MaemoSDKVMConfigurationWizardPage(this);
+		addPage(configurationPage);
+		licensePage = new MaemoSDKVMLicenseWizardPage(this);
+		addPage(licensePage);
+		downloadUncompressWorkPage = new MaemoSDKVMInstallationWorkPage(this);
+		addPage(downloadUncompressWorkPage);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+	 * org.eclipse.jface.viewers.IStructuredSelection)
+	 */
+	public void init(IWorkbench workbench, IStructuredSelection selection) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/**
+	 * Get the work page to show information about installation process.
+	 * 
+	 * @return the work page of this wizard.
+	 */
+	public WizardWorkProgressPageBase getWorkPage() {
+		return downloadUncompressWorkPage;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
+	 */
+	public boolean performFinish() {
+		final IStatus status = doWork();
+
+		final boolean success = (status.isOK() || status.matches(IStatus.INFO));
+
+		String message = success ? "Installation succeeded"
+				: "Installation encountered some errors";
+
+		boolean goOn = getWorkPage().reportOperationStatus(
+				"Maemo SDK Virtual Image installation results", message,
+				status, true)
+				&& !status.matches(IStatus.CANCEL);
+
+		return goOn;
+	}
+	
+	protected IStatus doWork() {
+
+		getWorkPage().showAndClearLog();
+
+		final IStatus[] statuses = { Policy.getCancelStatus(Activator
+				.getDefault()) };
+		try {
+			getContainer().run(true, true, new IRunnableWithProgress() {
+
+				public void run(IProgressMonitor monitor)
+						throws InvocationTargetException, InterruptedException {
+					
+					IStatus status = null;
+					
+					IProgressReporter reporter = getWorkPage().getProgressReporter();
+					
+					MaemoSDKVMInstaller vmInstaller = new MaemoSDKVMInstaller(installData, reporter);
+					
+					status = vmInstaller.installVirtualImage(((MaemoSDKVMInstallationWorkPage)getWorkPage()).getTimeout(), getShell(), monitor);
+					
+					if (status.matches(IStatus.CANCEL))
+						status = Activator.createErrorStatus("The Maemo SDK virtual image installation was canceled.", null);
+
+					if (status.matches(IStatus.CANCEL) || status.matches(IStatus.ERROR))
+						reporter.appendStreamText(status.getMessage(), true);
+					
+					statuses[0] = status;
+				}
+
+			});
+		} catch (Exception e) {
+			Activator.getErrorLogger().logAndShowError(e.getMessage(),
+					e.getCause());
+			statuses[0] = Activator.createErrorStatus("Maemo SDK virtual image installation failed unexpectedly",
+					e);
+		}
+		return statuses[0];
+	}
+
+	/**
+	 * Get the installation data that contains information to install Maemo SDK
+	 * virtual image.
+	 * 
+	 * @return the installation data.
+	 */
+	public MaemoSDKVMInstallData getInstallData() {
+		return installData;
+	}
+
+}



More information about the Esbox-commits mailing list