[Esbox-commits] r2038 - in branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal: api/vm/vmware vm/vmware/ui/wizards
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Fri Aug 28 00:57:03 EEST 2009
Author: eswartz
Date: 2009-08-28 00:57:02 +0300 (Fri, 28 Aug 2009)
New Revision: 2038
Modified:
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/MaemoSDKVMInstaller.java
branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java
Log:
Merge revs 2031:2037 from trunk
Modified: 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/MaemoSDKVMDownloader.java 2009-08-27 20:41:58 UTC (rev 2037)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMDownloader.java 2009-08-27 21:57:02 UTC (rev 2038)
@@ -297,7 +297,8 @@
URL remoteURL = (URL) remoteFileInfo.get(0);
// Get link of remote file
- String fileName = getFileName(remoteURL, downloadFile.getLocalURL());
+ String fileName = getFileName(remoteURL, downloadFile.getLocalURL());
+ downloadFile.setLocalURL(new File(fileName).toURL());
downloadFile.setDownloadedSize(getPreviousDownloadSize(fileName));
Integer remoteFileSize = (Integer) remoteFileInfo.get(1);
@@ -378,8 +379,7 @@
}
}
- if (thread.isCompleted() &&
- downloadFile.getDownloadedSize() == remoteFileSize.intValue()) {
+ if (thread.isCompleted()) {
downloadFile.complete();
}
Modified: 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/MaemoSDKVMInstaller.java 2009-08-27 20:41:58 UTC (rev 2037)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInstaller.java 2009-08-27 21:57:02 UTC (rev 2038)
@@ -85,25 +85,23 @@
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()) {
+ if (!installData.canUsePreviousInstallation())
status = this.downloadVM(shell, monitor);
- }
if (canProceed(status))
status = this.uncompressVM(shell, monitor);
- if (canProceed(status) && installData.canInstallSbox()) {
- promptPreferencesDialog(shell);
+ if (canProceed(status))
+ status = promptPreferencesDialog(shell);
+
+ if (canProceed(status) && installData.canInstallSbox())
status = this.installScratchbox(shell,monitor);
- }
- if (canProceed(status) && installData.canInstallTargets()) {
+ if (canProceed(status) && installData.canInstallTargets())
status = this.installScratchboxTargets(shell,monitor);
- }
- if (canProceed(status) && ((installData.canInstallCppEnv() || installData.canInstallPythonEnv()))) {
+ if (canProceed(status) && ((installData.canInstallCppEnv() || installData.canInstallPythonEnv())))
status = this.installPackages(shell, monitor);
- }
return status;
}
@@ -165,7 +163,8 @@
monitor.subTask("Uncompressing image...");
reporter.logInfo("Uncompressing Maemo SDK virtual image...");
- final String fileName = installData.getPathOfExistentVM();
+ final String fileName = installData.getPathOfExistentVM() == null ? installData.getFileToDownload().getLocalURL().getFile() :
+ installData.getPathOfExistentVM();
final String destinationPath = installData.getInstallationPath();
final IStatus[] statuses = { Activator.createStatus(IStatus.OK, "File " + fileName
@@ -325,52 +324,43 @@
* @param shell
* @return
*/
- private IStatus promptPreferencesDialog(final Shell shell) {
- configureInitialVMSettings();
-
+ private IStatus promptPreferencesDialog(final Shell shell) {
final IStatus statuses[] = new IStatus[] {Policy.getCancelStatus(Activator.getDefault())};
- shell.getDisplay().syncExec(new Runnable() {
+ String vmLocation = configureInitialVMSettings();
+
+ if (!vmLocation.trim().equals("")) {
- public void run() {
- PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
- null, /* do not tie to a shell to avoid #4438 */
- MaemoSDKPreferenceIds.BUILD_MACHINE_PREFS_ID,
- new String[] {
- MaemoSDKPreferenceIds.ESBOX_PREFERENCE_CATEGORY_ID,
- MaemoSDKPreferenceIds.BUILD_MACHINE_PREFS_ID,
- },
- null);
- dialog.open();
-
- // check for valid build machine
- if (MachineRegistry.getInstance().getCurrentBuildMachines().length == 0)
- statuses[0] = Activator.createErrorStatus("Virtual image was not properly configured.", null);
- else
- statuses[0] = Activator.createStatus(IStatus.OK, "Virtual image configured.");
- }
+ shell.getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
+ null, /* do not tie to a shell to avoid #4438 */
+ MaemoSDKPreferenceIds.BUILD_MACHINE_PREFS_ID,
+ new String[] {
+ MaemoSDKPreferenceIds.ESBOX_PREFERENCE_CATEGORY_ID,
+ MaemoSDKPreferenceIds.BUILD_MACHINE_PREFS_ID,
+ },
+ null);
+ dialog.open();
+
+ // check for valid build machine
+ if (MachineRegistry.getInstance().getCurrentBuildMachines().length == 0)
+ 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;
- }
- }
+ public String configureInitialVMSettings() {
+ IBuildMachine vmwareMachine = getVMWareMachine();
IVirtualMachineConfiguration machineConfig = ((IVirtualMachine)vmwareMachine).getConfiguration();
@@ -382,12 +372,34 @@
} else {
vmxFileLocation = "";
}
-
((IVMwareConfiguration)machineConfig).setVmxPath(vmxFileLocation);
+
+ return vmxFileLocation;
}
/**
+ * Get current VMWare build machine.
+ * @return VMWare build machine.
+ */
+ private IBuildMachine getVMWareMachine() {
+ 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;
+ }
+ }
+
+ return vmwareMachine;
+ }
+
+ /**
* Get the location of vmx file.
* @return
*/
Modified: 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/MaemoSDKVMSelectionWizardPage.java 2009-08-27 20:41:58 UTC (rev 2037)
+++ branches/work_Ed/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java 2009-08-27 21:57:02 UTC (rev 2038)
@@ -267,7 +267,6 @@
String pathDirectory = dialog.open();
if (pathDirectory != null) {
destinationTextField.setText(pathDirectory);
- setDownloadFileLocalURL(pathDirectory);
validatePage();
}
}
@@ -326,8 +325,6 @@
String pathDirectory = dialog.open();
if (pathDirectory != null) {
existingVirtualImageTextField.setText(pathDirectory);
- ((NewMaemoSDKVMWizard) getWizard()).getInstallData()
- .setPathOfExistentVM(pathDirectory);
validatePage();
}
}
@@ -404,9 +401,11 @@
File file = new File(destination);
if (!file.exists() || !file.isDirectory()){
errorMessage = "Invalid location for Maemo SDK virtual image. Please, select a valid directory.";
+ } else {
+ setDownloadFileLocalURL(destination);
}
}
-
+
String existingVirtualImageLocation = "";
if (errorMessage == null && usePreviousDownloadButton.getSelection()) {
existingVirtualImageLocation = existingVirtualImageTextField.getText().trim();
@@ -416,6 +415,8 @@
File file = new File(existingVirtualImageLocation);
if (!file.exists() || file.isDirectory()){
errorMessage = "Invalid Maemo SDK virtual image. You must select a zipped file that contains Maemo SDK virtual image.";
+ } else {
+ ((NewMaemoSDKVMWizard) getWizard()).getInstallData().setPathOfExistentVM(existingVirtualImageLocation);
}
}
}
More information about the Esbox-commits
mailing list