[Esbox-commits] r2119 - in branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox: internal/vm/vmware internal/vm/vmware/ui/wizards vm/vmware
fabricioepa at garage.maemo.org
fabricioepa at garage.maemo.org
Tue Sep 8 20:56:25 EEST 2009
Author: fabricioepa
Date: 2009-09-08 20:56:21 +0300 (Tue, 08 Sep 2009)
New Revision: 2119
Modified:
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareConfiguration.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstantsPrivate.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceMigrator.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareTargetInterfaceAddressProvider.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareUtils.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMUncompressInfoWizardPage.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java
Log:
setting svn:eol-style=native property
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,175 +1,175 @@
-/*******************************************************************************
- * Copyright (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware;
-
-import org.eclipse.core.runtime.*;
-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.*;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // 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;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * @param object
- * @param e
- * @return
- */
- public static IStatus createErrorStatus(String msg, Throwable t) {
- return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
- }
-
- /**
- * @param warning
- * @param format
- * @param e
- * @return
- */
- public static IStatus createStatus(int severity, String msg,
- Throwable t) {
- return new Status(severity, PLUGIN_ID, msg, t);
- }
-
- /**
- * @param warning
- * @param string
- * @return
- */
- public static IStatus createStatus(int severity, String string) {
- return new Status(severity, PLUGIN_ID, string);
- }
-
- /**
- * Return the error logger instance of this plug-in.
- *
- * @return the error logger instance of this plug-in.
- */
- public static ErrorLogger getErrorLogger() {
- class CoreErrorLogger extends ErrorLogger {
-
- @Override
- public String getPluginID() {
- return PLUGIN_ID;
- }
- @Override
- public Plugin getPlugin() {
- return Activator.getDefault();
- }
-
- }
-
- return new CoreErrorLogger();
- }
-
- /**
- * Find a file relative to the plugin, either in a running
- * workspace or a standalone unit test (assumed to run relative
- * to a plugin)
- * @param path
- */
- public static InputStream getPluginRelativeInputStream(String path) throws IOException {
- if (getDefault() != null) {
- return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
- } else {
- return new FileInputStream("../" + path);
- }
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @param path the path
- * @return the image descriptor
- */
- 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);
- }
- }
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.core.runtime.*;
+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.*;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // 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;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param object
+ * @param e
+ * @return
+ */
+ public static IStatus createErrorStatus(String msg, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param format
+ * @param e
+ * @return
+ */
+ public static IStatus createStatus(int severity, String msg,
+ Throwable t) {
+ return new Status(severity, PLUGIN_ID, msg, t);
+ }
+
+ /**
+ * @param warning
+ * @param string
+ * @return
+ */
+ public static IStatus createStatus(int severity, String string) {
+ return new Status(severity, PLUGIN_ID, string);
+ }
+
+ /**
+ * Return the error logger instance of this plug-in.
+ *
+ * @return the error logger instance of this plug-in.
+ */
+ public static ErrorLogger getErrorLogger() {
+ class CoreErrorLogger extends ErrorLogger {
+
+ @Override
+ public String getPluginID() {
+ return PLUGIN_ID;
+ }
+ @Override
+ public Plugin getPlugin() {
+ return Activator.getDefault();
+ }
+
+ }
+
+ return new CoreErrorLogger();
+ }
+
+ /**
+ * Find a file relative to the plugin, either in a running
+ * workspace or a standalone unit test (assumed to run relative
+ * to a plugin)
+ * @param path
+ */
+ public static InputStream getPluginRelativeInputStream(String path) throws IOException {
+ if (getDefault() != null) {
+ return FileLocator.openStream(getDefault().getBundle(), new Path(path), false);
+ } else {
+ return new FileInputStream("../" + path);
+ }
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ 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);
+ }
+ }
+
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware;
-
-import org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineConfiguration;
-import org.maemo.mica.common.core.machine.IBuildMachineFactory;
-import org.maemo.mica.internal.api.common.core.machine.IBuildMachineImpl;
-
-/**
- * This factory creates virtual build machines hosted on VMware.
- * We support only one such machine at a time, using preferences to store its settings.
- * @author eswartz
- *
- */
-public class VMwareBuildMachineFactory implements IBuildMachineFactory {
-
- public final static String NAME = "VMware Linux Build Machine";
- public VMwareBuildMachineFactory() {
- }
-
-
- /* (non-Javadoc)
- * @see org.maemo.mica.common.core.machine.IMachineFactory#createMachine(java.lang.String)
- */
- public synchronized IBuildMachineImpl[] getMachines() {
- // for now, one global VMware settings block
- IBuildMachineImpl machine = new VMwareMachine(NAME,
- new VMwareConfiguration(
- BaseVirtualMachineConfiguration.getChildSettings(
- BaseVirtualMachineConfiguration.getVMSettings(),
- "vmware")
- ));
- return new IBuildMachineImpl[] { machine };
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineConfiguration;
+import org.maemo.mica.common.core.machine.IBuildMachineFactory;
+import org.maemo.mica.internal.api.common.core.machine.IBuildMachineImpl;
+
+/**
+ * This factory creates virtual build machines hosted on VMware.
+ * We support only one such machine at a time, using preferences to store its settings.
+ * @author eswartz
+ *
+ */
+public class VMwareBuildMachineFactory implements IBuildMachineFactory {
+
+ public final static String NAME = "VMware Linux Build Machine";
+ public VMwareBuildMachineFactory() {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.machine.IMachineFactory#createMachine(java.lang.String)
+ */
+ public synchronized IBuildMachineImpl[] getMachines() {
+ // for now, one global VMware settings block
+ IBuildMachineImpl machine = new VMwareMachine(NAME,
+ new VMwareConfiguration(
+ BaseVirtualMachineConfiguration.getChildSettings(
+ BaseVirtualMachineConfiguration.getVMSettings(),
+ "vmware")
+ ));
+ return new IBuildMachineImpl[] { machine };
+ }
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareConfiguration.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareConfiguration.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareConfiguration.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineConfiguration;
-import org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineURIQueryDecoder;
-import org.maemo.esbox.internal.api.vm.core.URIQueryParser.IURIQueryDecoder;
-import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.filesystem.ISharedFilesystemProvider;
-
-import java.net.URI;
-
-/**
- * @author eswartz
- *
- */
-public class VMwareConfiguration extends BaseVirtualMachineConfiguration implements IVMwareConfiguration {
-
- protected VMwareConfiguration(IDialogSettings settings) {
- super(settings);
- }
-
- /**
- * @param settings
- * @param uri
- * @param sharedFilesystemProvider
- * @throws MicaException
- */
- public VMwareConfiguration(IDialogSettings settings,
- URI uri, ISharedFilesystemProvider sharedFilesystemProvider)
- throws MicaException {
- super(settings, uri, sharedFilesystemProvider);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.BasePreferenceVirtualMachineConfiguration#initializeDefaults()
- */
- @Override
- protected void initializeDefaults() {
- super.initializeDefaults();
- initializeKeysForClass(VMwarePreferenceConstants.class);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#setupDefaults()
- */
- @Override
- protected void applySettingsFrom(IVirtualMachineConfiguration baseConfig) {
- super.applySettingsFrom(baseConfig);
- if (baseConfig instanceof IVMwareConfiguration) {
- applySettingsForKeysForClass(baseConfig, VMwarePreferenceConstants.class);
- }
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#getURIQueryDecoder()
- */
- @Override
- protected IURIQueryDecoder getURIQueryDecoder() {
- return new BaseVirtualMachineURIQueryDecoder(this) {
- private static final String VMX_PATH = "vmxPath";
- private static final String COMMAND_LAUNCH_PATTERN = "commandLaunchPattern";
- private static final String EXECUTABLE = "executable";
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineURIQueryDecoder#decode(java.lang.String, java.lang.String)
- */
- @Override
- public boolean decode(String key, String value) {
- if (super.decode(key, value))
- return true;
-
- if (key.equals(VMX_PATH)) {
- getSettings().put(VMwarePreferenceConstants.VMWARE_VMX_PATH, value);
- } else if (key.equals(COMMAND_LAUNCH_PATTERN)) {
- getSettings().put(VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN, value);
- } else if (key.equals(EXECUTABLE)) {
- getSettings().put(VMwarePreferenceConstants.VMWARE_EXE_NAME, value);
- } else {
- return false;
- }
- return true;
- }
- };
- }
-
- public String getVmxPath() {
- return getPreference(VMwarePreferenceConstants.VMWARE_VMX_PATH);
- }
-
- public void setVmxPath(String vmx) {
- setPreference(VMwarePreferenceConstants.VMWARE_VMX_PATH, vmx);
- }
- public String getExecutable() {
- return getPreference(VMwarePreferenceConstants.VMWARE_EXE_NAME);
- }
- public void setExecutable(String exe) {
- setPreference(VMwarePreferenceConstants.VMWARE_EXE_NAME, exe);
- }
-
- public String getCommandLaunchPattern() {
- return getPreference(VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN);
- }
- public void setCommandLaunchPattern(String pattern) {
- setPreference(VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN, pattern);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineConfiguration;
+import org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineURIQueryDecoder;
+import org.maemo.esbox.internal.api.vm.core.URIQueryParser.IURIQueryDecoder;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.filesystem.ISharedFilesystemProvider;
+
+import java.net.URI;
+
+/**
+ * @author eswartz
+ *
+ */
+public class VMwareConfiguration extends BaseVirtualMachineConfiguration implements IVMwareConfiguration {
+
+ protected VMwareConfiguration(IDialogSettings settings) {
+ super(settings);
+ }
+
+ /**
+ * @param settings
+ * @param uri
+ * @param sharedFilesystemProvider
+ * @throws MicaException
+ */
+ public VMwareConfiguration(IDialogSettings settings,
+ URI uri, ISharedFilesystemProvider sharedFilesystemProvider)
+ throws MicaException {
+ super(settings, uri, sharedFilesystemProvider);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BasePreferenceVirtualMachineConfiguration#initializeDefaults()
+ */
+ @Override
+ protected void initializeDefaults() {
+ super.initializeDefaults();
+ initializeKeysForClass(VMwarePreferenceConstants.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#setupDefaults()
+ */
+ @Override
+ protected void applySettingsFrom(IVirtualMachineConfiguration baseConfig) {
+ super.applySettingsFrom(baseConfig);
+ if (baseConfig instanceof IVMwareConfiguration) {
+ applySettingsForKeysForClass(baseConfig, VMwarePreferenceConstants.class);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseCustomVirtualMachineConfiguration#getURIQueryDecoder()
+ */
+ @Override
+ protected IURIQueryDecoder getURIQueryDecoder() {
+ return new BaseVirtualMachineURIQueryDecoder(this) {
+ private static final String VMX_PATH = "vmxPath";
+ private static final String COMMAND_LAUNCH_PATTERN = "commandLaunchPattern";
+ private static final String EXECUTABLE = "executable";
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineURIQueryDecoder#decode(java.lang.String, java.lang.String)
+ */
+ @Override
+ public boolean decode(String key, String value) {
+ if (super.decode(key, value))
+ return true;
+
+ if (key.equals(VMX_PATH)) {
+ getSettings().put(VMwarePreferenceConstants.VMWARE_VMX_PATH, value);
+ } else if (key.equals(COMMAND_LAUNCH_PATTERN)) {
+ getSettings().put(VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN, value);
+ } else if (key.equals(EXECUTABLE)) {
+ getSettings().put(VMwarePreferenceConstants.VMWARE_EXE_NAME, value);
+ } else {
+ return false;
+ }
+ return true;
+ }
+ };
+ }
+
+ public String getVmxPath() {
+ return getPreference(VMwarePreferenceConstants.VMWARE_VMX_PATH);
+ }
+
+ public void setVmxPath(String vmx) {
+ setPreference(VMwarePreferenceConstants.VMWARE_VMX_PATH, vmx);
+ }
+ public String getExecutable() {
+ return getPreference(VMwarePreferenceConstants.VMWARE_EXE_NAME);
+ }
+ public void setExecutable(String exe) {
+ setPreference(VMwarePreferenceConstants.VMWARE_EXE_NAME, exe);
+ }
+
+ public String getCommandLaunchPattern() {
+ return getPreference(VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN);
+ }
+ public void setCommandLaunchPattern(String pattern) {
+ setPreference(VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN, pattern);
+ }
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareConfiguration.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware;
-
-import java.net.URI;
-
-import org.eclipse.core.runtime.Platform;
-import org.maemo.esbox.internal.api.vm.core.BaseVirtualBuildMachine;
-import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
-import org.maemo.mica.common.core.machine.IComposablePreferencePage;
-import org.maemo.mica.internal.api.common.core.filesystem.BaseSharedFilesystemProvider;
-
-
-/**
- * This is a build machine running under QEMU.
- * @author eswartz
- *
- */
-public class VMwareMachine extends BaseVirtualBuildMachine {
-
- public final static String ID = Activator.PLUGIN_ID + ".vmware_machine";
- //
- private IVMwareConfiguration configuration;
-
- public VMwareMachine(String name, IVMwareConfiguration configuration) {
- super(ID, name, Platform.OS_LINUX, Platform.ARCH_X86,
- new VMwareMachineController(configuration),
- configuration.getSSHConfiguration(),
- new BaseSharedFilesystemProvider(configuration.getSharedFolders()));
- this.configuration = configuration;
- }
-
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.vm.core.IVirtualMachine#createPreferencePage(org.eclipse.swt.widgets.Composite)
- */
- public IComposablePreferencePage createPreferencePage() {
- return new VMwarePreferencePage(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.vm.core.IVirtualMachine#getConfiguration()
- */
- public IVirtualMachineConfiguration getConfiguration() {
- return configuration;
- }
-
- /* (non-Javadoc)
- * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineBackend#getURI()
- */
- @Override
- public URI getURI() {
- return URI.create("vmware+ssh://"
- + getSshConfiguration().getTargetAddress()
- + ":"
- + getSshConfiguration().getTargetPort());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+import java.net.URI;
+
+import org.eclipse.core.runtime.Platform;
+import org.maemo.esbox.internal.api.vm.core.BaseVirtualBuildMachine;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.machine.IComposablePreferencePage;
+import org.maemo.mica.internal.api.common.core.filesystem.BaseSharedFilesystemProvider;
+
+
+/**
+ * This is a build machine running under QEMU.
+ * @author eswartz
+ *
+ */
+public class VMwareMachine extends BaseVirtualBuildMachine {
+
+ public final static String ID = Activator.PLUGIN_ID + ".vmware_machine";
+ //
+ private IVMwareConfiguration configuration;
+
+ public VMwareMachine(String name, IVMwareConfiguration configuration) {
+ super(ID, name, Platform.OS_LINUX, Platform.ARCH_X86,
+ new VMwareMachineController(configuration),
+ configuration.getSSHConfiguration(),
+ new BaseSharedFilesystemProvider(configuration.getSharedFolders()));
+ this.configuration = configuration;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.vm.core.IVirtualMachine#createPreferencePage(org.eclipse.swt.widgets.Composite)
+ */
+ public IComposablePreferencePage createPreferencePage() {
+ return new VMwarePreferencePage(configuration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.vm.core.IVirtualMachine#getConfiguration()
+ */
+ public IVirtualMachineConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineBackend#getURI()
+ */
+ @Override
+ public URI getURI() {
+ return URI.create("vmware+ssh://"
+ + getSshConfiguration().getTargetAddress()
+ + ":"
+ + getSshConfiguration().getTargetPort());
+ }
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,193 +1,193 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware;
-
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-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.eclipse.core.runtime.SubProgressMonitor;
-import org.maemo.esbox.internal.api.vm.core.BaseLaunchableVirtualMachineController;
-import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
-import org.maemo.mica.common.core.HostUtils;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.machine.IProcess;
-import org.maemo.mica.common.core.machine.MachineException;
-import org.maemo.mica.common.core.process.CommandLineArguments;
-import org.maemo.mica.common.core.process.ProcessLauncherParameters;
-import org.maemo.mica.common.core.process.ShellTemplateSubstitutor;
-
-/**
- * This is the basic implementation of a QEMU machine
- * @author eswartz
- *
- */
-public class VMwareMachineController extends BaseLaunchableVirtualMachineController {
- /**
- * @param name
- * @param configuration
- */
- public VMwareMachineController(IVMwareConfiguration configuration) {
- super("VMware", configuration);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.IVirtualMachineController#isMachineRunning()
- */
- public boolean isMachineRunning() {
- // we can't tell if the machine stopped running just based on the process stopping
- // (VMware may have used another instance to host the machine)
- if (launchInfo != null && launchInfo.isAlive()) {
- return true;
- }
-
- try {
- // TODO: check the product and use vmrun if possible (or not... that utility
- // is not available widely enough to be of any use)
- IVMwareConfiguration config = (IVMwareConfiguration) machineConfiguration;
-
- File exe = new File(config.getExecutable());
- IProcess[] runningVMwares = getRunningProcesses(exe, null);
- if (runningVMwares.length == 0)
- return false;
-
- if (!HostUtils.isWindows()) {
- // we can't tell anything on Windows
- File vmx = new File(config.getVmxPath());
- IProcess[] runningExactInstances = getRunningProcesses(exe, vmx);
- return runningExactInstances.length > 0;
- } else {
- return true;
- }
- } catch (MicaException e) {
- Activator.getErrorLogger().logError("Can't check running VMWare processes", e);
- return false;
- }
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController#constructLaunchParameters()
- */
- @Override
- protected ProcessLauncherParameters constructLaunchParameters() {
- IVMwareConfiguration vmwareConfiguration = (IVMwareConfiguration) machineConfiguration;
-
- String launchPattern = vmwareConfiguration.getCommandLaunchPattern();
- ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
-
- IPath launchPath = new Path(vmwareConfiguration.getExecutable());
- substitutor.define("VMWARE", launchPath.toOSString());
- substitutor.define("VMX_PATH", new Path(vmwareConfiguration.getVmxPath()).toOSString());
-
- launchPattern = substitutor.substitute(launchPattern);
- List<String> cmdLine = CommandLineArguments.createFromHostCommandLine(launchPattern);
-
- return ProcessLauncherParameters.create(cmdLine);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController#doStartMachineImpl(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected IStatus doStartVirtualMachine(IProgressMonitor monitor)
- throws MachineException {
-
- monitor.beginTask("Starting VMware...", 10);
- monitor.subTask("Checking existing VMware instances...");
-
- // first, see if we recognize any other VMware instances
- IVMwareConfiguration config = (IVMwareConfiguration) machineConfiguration;
- File exe = new File(config.getExecutable());
- IProcess[] runningEngines;
- try {
- runningEngines = getRunningProcesses(exe, null);
- } catch (MicaException e) {
- runningEngines = new IProcess[0];
- }
- monitor.worked(1);
-
- IStatus status;
- try {
- launchInfo = launchMachine();
- } catch (MicaException e) {
- throw new MachineException("Failed to launch VMware", e);
- }
-
- launchInfo.monitor.runNonBlocking();
-
- // depending on whether others were running, it's either important or not
- // if the subsequent launch succeeds
- LaunchedMachineInfo watchStatus = null;
- if (runningEngines.length == 0)
- watchStatus = launchInfo;
-
- status = probeUntilConnect(
- watchStatus,
- new SubProgressMonitor(monitor, 8));
-
- if (monitor.isCanceled() || status.getSeverity() == IStatus.CANCEL) {
- launchInfo.cancel();
- return CANCEL_STATUS;
- }
-
- if (!status.isOK()) {
- launchInfo.setFailed(status);
- return status;
- }
-
- return status;
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController#doStopMachineImpl(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected IStatus doStopVirtualMachine(IProgressMonitor monitor) {
-
- // don't waste time if not running
- try {
- doHaltMachine(monitor);
- } catch (MachineException e) {
- return Activator.createErrorStatus(null, e);
- }
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
-
- // then be mean if we launched it ourselves
- if (launchInfo != null) {
-
- Process process = launchInfo.launcher.getLastCreatedProcess();
- if (process != null)
- process.destroy();
- launchInfo = null;
- }
- return Status.OK_STATUS;
- }
-
- /* (non-Javadoc)
- * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineControllerBase#doProbeMachine(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected synchronized IStatus doProbeMachine(IProgressMonitor monitor) {
- if (launchInfo != null && !launchInfo.isAlive()) {
- // re-check if things might be fishy
- scheduleProbe();
- }
- IStatus status = super.doProbeMachine(monitor);
- return status;
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware;
+
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+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.eclipse.core.runtime.SubProgressMonitor;
+import org.maemo.esbox.internal.api.vm.core.BaseLaunchableVirtualMachineController;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.HostUtils;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.machine.IProcess;
+import org.maemo.mica.common.core.machine.MachineException;
+import org.maemo.mica.common.core.process.CommandLineArguments;
+import org.maemo.mica.common.core.process.ProcessLauncherParameters;
+import org.maemo.mica.common.core.process.ShellTemplateSubstitutor;
+
+/**
+ * This is the basic implementation of a QEMU machine
+ * @author eswartz
+ *
+ */
+public class VMwareMachineController extends BaseLaunchableVirtualMachineController {
+ /**
+ * @param name
+ * @param configuration
+ */
+ public VMwareMachineController(IVMwareConfiguration configuration) {
+ super("VMware", configuration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.IVirtualMachineController#isMachineRunning()
+ */
+ public boolean isMachineRunning() {
+ // we can't tell if the machine stopped running just based on the process stopping
+ // (VMware may have used another instance to host the machine)
+ if (launchInfo != null && launchInfo.isAlive()) {
+ return true;
+ }
+
+ try {
+ // TODO: check the product and use vmrun if possible (or not... that utility
+ // is not available widely enough to be of any use)
+ IVMwareConfiguration config = (IVMwareConfiguration) machineConfiguration;
+
+ File exe = new File(config.getExecutable());
+ IProcess[] runningVMwares = getRunningProcesses(exe, null);
+ if (runningVMwares.length == 0)
+ return false;
+
+ if (!HostUtils.isWindows()) {
+ // we can't tell anything on Windows
+ File vmx = new File(config.getVmxPath());
+ IProcess[] runningExactInstances = getRunningProcesses(exe, vmx);
+ return runningExactInstances.length > 0;
+ } else {
+ return true;
+ }
+ } catch (MicaException e) {
+ Activator.getErrorLogger().logError("Can't check running VMWare processes", e);
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController#constructLaunchParameters()
+ */
+ @Override
+ protected ProcessLauncherParameters constructLaunchParameters() {
+ IVMwareConfiguration vmwareConfiguration = (IVMwareConfiguration) machineConfiguration;
+
+ String launchPattern = vmwareConfiguration.getCommandLaunchPattern();
+ ShellTemplateSubstitutor substitutor = new ShellTemplateSubstitutor();
+
+ IPath launchPath = new Path(vmwareConfiguration.getExecutable());
+ substitutor.define("VMWARE", launchPath.toOSString());
+ substitutor.define("VMX_PATH", new Path(vmwareConfiguration.getVmxPath()).toOSString());
+
+ launchPattern = substitutor.substitute(launchPattern);
+ List<String> cmdLine = CommandLineArguments.createFromHostCommandLine(launchPattern);
+
+ return ProcessLauncherParameters.create(cmdLine);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController#doStartMachineImpl(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IStatus doStartVirtualMachine(IProgressMonitor monitor)
+ throws MachineException {
+
+ monitor.beginTask("Starting VMware...", 10);
+ monitor.subTask("Checking existing VMware instances...");
+
+ // first, see if we recognize any other VMware instances
+ IVMwareConfiguration config = (IVMwareConfiguration) machineConfiguration;
+ File exe = new File(config.getExecutable());
+ IProcess[] runningEngines;
+ try {
+ runningEngines = getRunningProcesses(exe, null);
+ } catch (MicaException e) {
+ runningEngines = new IProcess[0];
+ }
+ monitor.worked(1);
+
+ IStatus status;
+ try {
+ launchInfo = launchMachine();
+ } catch (MicaException e) {
+ throw new MachineException("Failed to launch VMware", e);
+ }
+
+ launchInfo.monitor.runNonBlocking();
+
+ // depending on whether others were running, it's either important or not
+ // if the subsequent launch succeeds
+ LaunchedMachineInfo watchStatus = null;
+ if (runningEngines.length == 0)
+ watchStatus = launchInfo;
+
+ status = probeUntilConnect(
+ watchStatus,
+ new SubProgressMonitor(monitor, 8));
+
+ if (monitor.isCanceled() || status.getSeverity() == IStatus.CANCEL) {
+ launchInfo.cancel();
+ return CANCEL_STATUS;
+ }
+
+ if (!status.isOK()) {
+ launchInfo.setFailed(status);
+ return status;
+ }
+
+ return status;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.core.BaseVirtualMachineController#doStopMachineImpl(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IStatus doStopVirtualMachine(IProgressMonitor monitor) {
+
+ // don't waste time if not running
+ try {
+ doHaltMachine(monitor);
+ } catch (MachineException e) {
+ return Activator.createErrorStatus(null, e);
+ }
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+
+ // then be mean if we launched it ourselves
+ if (launchInfo != null) {
+
+ Process process = launchInfo.launcher.getLastCreatedProcess();
+ if (process != null)
+ process.destroy();
+ launchInfo = null;
+ }
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.internal.api.protocol.ssh.SSHMachineControllerBase#doProbeMachine(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected synchronized IStatus doProbeMachine(IProgressMonitor monitor) {
+ if (launchInfo != null && !launchInfo.isAlive()) {
+ // re-check if things might be fishy
+ scheduleProbe();
+ }
+ IStatus status = super.doProbeMachine(monitor);
+ return status;
+
+ }
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-
-package org.maemo.esbox.internal.vm.vmware;
-
-import org.eclipse.jface.dialogs.DialogSettings;
-import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.filesystem.ISharedFilesystemProvider;
-import org.maemo.mica.common.core.machine.*;
-
-import java.net.URI;
-
-/**
- * This factory creates VMware virtual machines.
- * @author eswartz
- *
- */
-public class VMwareMachineFactory implements IMachineFactory {
-
- /**
- * Scheme for VMware
- */
- private static final String VMWARE_SCHEME = "vmware+ssh";
-
- /* (non-Javadoc)
- * @see org.maemo.mica.common.core.machine.IMachineFactory#createMachine(java.net.URI)
- */
- public IMachine createMachine(String name, URI uri, ISharedFilesystemProvider sharedFilesystemProvider) throws MicaException {
- if (!uri.getScheme().equals(VMWARE_SCHEME))
- return null;
-
- IVMwareConfiguration qemuConfig = new VMwareConfiguration(
- new DialogSettings("Custom"),
- uri,
- sharedFilesystemProvider);
- return new VMwareMachine(name, qemuConfig);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.mica.common.core.machine.IMachineFactory#getScheme()
- */
- public String getScheme() {
- return VMWARE_SCHEME;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.jface.dialogs.DialogSettings;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.filesystem.ISharedFilesystemProvider;
+import org.maemo.mica.common.core.machine.*;
+
+import java.net.URI;
+
+/**
+ * This factory creates VMware virtual machines.
+ * @author eswartz
+ *
+ */
+public class VMwareMachineFactory implements IMachineFactory {
+
+ /**
+ * Scheme for VMware
+ */
+ private static final String VMWARE_SCHEME = "vmware+ssh";
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.machine.IMachineFactory#createMachine(java.net.URI)
+ */
+ public IMachine createMachine(String name, URI uri, ISharedFilesystemProvider sharedFilesystemProvider) throws MicaException {
+ if (!uri.getScheme().equals(VMWARE_SCHEME))
+ return null;
+
+ IVMwareConfiguration qemuConfig = new VMwareConfiguration(
+ new DialogSettings("Custom"),
+ uri,
+ sharedFilesystemProvider);
+ return new VMwareMachine(name, qemuConfig);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.machine.IMachineFactory#getScheme()
+ */
+ public String getScheme() {
+ return VMWARE_SCHEME;
+ }
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-
-package org.maemo.esbox.internal.vm.vmware;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.maemo.esbox.vm.core.IVirtualMachine;
-
-/**
- * This class encapsulates the keys for preference constants for VMware configuration.
- * <p>
- * NOTE: use {@link IVirtualMachine#getConfiguration()} to access the values
- * for an actual VM configuration, not CorePreferenceManager, which stores only
- * defaults.
- * @author eswartz
- *
- */
-public class VMwarePreferenceConstants {
- public static final int VERSION_MAJOR = 1;
- public static final int VERSION_MINOR = 1;
-
- public static final String VMWARE_EXE_NAME = "VMWARE_EXE_NAME";
- public static final String VMWARE_LAUNCH_PATTERN = "VMWARE_LAUNCH_PATTERN";
- public static final String VMWARE_VMX_PATH = "VMWARE_VMX_PATH";
-
- /** product type, see VMwareUtils */
- public static final String VMWARE_PRODUCT = "VMWARE_PRODUCT";
-
- static final Class<?> privateKeysClass = VMwarePreferenceConstantsPrivate.class;
-
- /**
- * Return <code>null</code>. We store preferences in {@link IVirtualMachine#getConfiguration()}
- * and provide this method to make CorePreferenceManager happy.
- * @return null
- */
- public static IPreferenceStore getPreferenceStore() { return null; }
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+
+/**
+ * This class encapsulates the keys for preference constants for VMware configuration.
+ * <p>
+ * NOTE: use {@link IVirtualMachine#getConfiguration()} to access the values
+ * for an actual VM configuration, not CorePreferenceManager, which stores only
+ * defaults.
+ * @author eswartz
+ *
+ */
+public class VMwarePreferenceConstants {
+ public static final int VERSION_MAJOR = 1;
+ public static final int VERSION_MINOR = 1;
+
+ public static final String VMWARE_EXE_NAME = "VMWARE_EXE_NAME";
+ public static final String VMWARE_LAUNCH_PATTERN = "VMWARE_LAUNCH_PATTERN";
+ public static final String VMWARE_VMX_PATH = "VMWARE_VMX_PATH";
+
+ /** product type, see VMwareUtils */
+ public static final String VMWARE_PRODUCT = "VMWARE_PRODUCT";
+
+ static final Class<?> privateKeysClass = VMwarePreferenceConstantsPrivate.class;
+
+ /**
+ * Return <code>null</code>. We store preferences in {@link IVirtualMachine#getConfiguration()}
+ * and provide this method to make CorePreferenceManager happy.
+ * @return null
+ */
+ public static IPreferenceStore getPreferenceStore() { return null; }
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstantsPrivate.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceMigrator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,249 +1,249 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-
-package org.maemo.esbox.internal.vm.vmware;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.DialogSettings;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.maemo.esbox.internal.api.vm.ui.preferences.AddressProvider;
-import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
-import org.maemo.esbox.internal.api.vm.ui.preferences.HostInterfaceAddressProvider;
-import org.maemo.esbox.internal.api.vm.ui.preferences.IHostTargetAddressReconciler;
-import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineAddressConfigurator;
-import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage;
-import org.maemo.esbox.internal.api.vm.ui.preferences.SameSubnetHostTargetAddressConciler;
-import org.maemo.esbox.vm.core.IVirtualMachine;
-import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
-import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.ui.IProgressReporter;
-import org.maemo.mica.internal.api.common.core.IPNetmaskFilter;
-
-/**
- * Configure VMware preferences. This page is NOT registered at the top level
- * of preference page UI but is nested inside the ESbox Build Machine preference UI.
- * @author eswartz
- *
- */
-public class VMwarePreferencePage extends BaseVirtualMachinePreferencePage {
-
- private VMwareSettingsPreferencePage settingsPage;
-
- /**
- * @param settings
- */
- public VMwarePreferencePage(IVMwareConfiguration config) {
- super(config);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createMachine()
- */
- @Override
- protected IVirtualMachine createMachine() {
- IVMwareConfiguration config = new VMwareConfiguration(new DialogSettings("temp"));
- commonPrefPage.saveTo(config);
- config.setSharedFolders(sharedFoldersPrefPage.getSharedFolders());
- vmPrefPage.saveTo(config);
- return new VMwareMachine("Test VMWare Machine", config);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createVirtualMachinePreferencePage()
- */
- @Override
- protected IVirtualMachineSettingsPreferencePage createVirtualMachinePreferencePage(IPreferenceStore store) {
- settingsPage = new VMwareSettingsPreferencePage(store, this);
- return settingsPage;
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createAddressConfigurator()
- */
- @Override
- protected IVirtualMachineAddressConfigurator createAddressConfigurator() {
- return new IVirtualMachineAddressConfigurator() {
-
- public AddressProvider getDefaultHostAddressProvider() {
- return new HostInterfaceAddressProvider();
- }
-
- public AddressProvider getDefaultTargetAddressProvider() {
- return new VMwareTargetInterfaceAddressProvider();
- }
-
- public IHostTargetAddressReconciler getHostTargetAddressReconciler() {
- return new SameSubnetHostTargetAddressConciler();
- }
-
- public void configureNetworkSettings(IProgressReporter reporter) {
- initializeNetworkDefaults(reporter);
- }
-
- };
- }
-
- /**
- * Set up default values for the network/machine access based on the VMX file.
- * @return IStatus
- */
- protected void initializeNetworkDefaults(IProgressReporter reporter) {
- String vmnet = null;
-
- // get real info from the VMX
- String vmx = settingsPage.getVMXPath();
- String networkType = null;
- boolean isNAT = false;
-
- try {
- //String vmx = store.getString(VMwarePreferenceConstants.VMWARE_VMX_PATH);
- Map<String, String> config = VMwareUtils.readVMXFile(
- vmx);
-
- reporter.logInfo("Reading settings from " + vmx + "...");
-
- networkType = VMwareUtils.getNetworkConfig(config);
- if (networkType.equals(VMwareUtils.NETWORK_CONFIG_NAT)) {
- vmnet = "vmnet8";
- reporter.logInfo("Configuring for NAT networking.");
- isNAT = true;
- }
- else if (networkType.equals(VMwareUtils.NETWORK_CONFIG_HOSTONLY)) {
- vmnet = "vmnet1";
- reporter.log(Activator.createStatus(IStatus.ERROR,
- "This VM is configured for host-only networking, which usually means it cannot be contacted from the host, nor access the Internet. Please reconfigure it for NAT or Bridged networking if problems occur."));
- } else if (networkType.equals(VMwareUtils.NETWORK_CONFIG_BRIDGED)) {
- reporter.logInfo("Configuring for bridged networking.");
- } else {
- reporter.log(Activator.createStatus(IStatus.WARNING,
- "Unknown or custom networking; assuming bridged networking. Please manually verify the settings."));
- }
- } catch (CoreException e) {
- // keep guesses
- reporter.log(Activator.createErrorStatus(
- "Failed to read the VMX file " + vmx + "; please ensure it exists first.",
- e));
- return;
- }
-
- String port = "22";
- if (isNAT) {
- port = "2222";
- reporter.logInfo("Set SSH Target Port to the default recommendation for NAT ("+port+").");
- reporter.logInfo("If you're using Port Forwarding and NAT, this may need to be edited.");
- } else {
- reporter.logInfo("Set SSH Target Port to the default ("+port+").");
- }
- commonPrefPage.getSSHTargetPort().setStringValue(port);
-
- port = "22";
- commonPrefPage.getSSHHostPort().setStringValue(port);
- reporter.logInfo("Set SSH Host Port to the default ("+port+").");
-
- InetAddress hostAddr = null;
- InetAddress targetAddr = null;
-
- if (vmnet == null) {
- // the host is the default in non-NAT, non-bridged modes
- try {
- hostAddr = InetAddress.getLocalHost();
- commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
-
- reporter.logInfo("Set Host Address to LAN address " + hostAddr);
-
- // Dunno target -- it's DHCP. Reset the low byte if it's not on the same subnet.
- targetAddr = commonPrefPage.getSSHTargetAddr().getAddress();
- if (targetAddr instanceof Inet4Address) {
- IPNetmaskFilter filter;
- try {
- filter = new IPNetmaskFilter(hostAddr);
- if (!filter.accept(targetAddr))
- targetAddr = null;
- } catch (MicaException e) {
- targetAddr = null;
- }
- }
-
- if (targetAddr == null) {
- targetAddr = InetAddress.getLocalHost();
- if (targetAddr instanceof Inet4Address) {
- byte[] addrBytes = targetAddr.getAddress();
- addrBytes[3] = 0;
- targetAddr = InetAddress.getByAddress(addrBytes);
- }
- commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
- reporter.logInfo("Set Target Address to LAN address " + targetAddr + " (please edit)");
- }
- reporter.log(Activator.createStatus(IStatus.WARNING,
- "You will need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
- } catch (UnknownHostException e) {
- // dunno!
- reporter.log(Activator.createErrorStatus(
- "Could not construct the local host address",
- e));
- }
-
- } else {
- // configure based on the network in use
- Map<String, InetAddress> vmnets = VMwareUtils.getVMNetMappings();
- hostAddr = vmnets.get(vmnet);
- if (hostAddr != null) {
- try {
- // the network is *.1, but the endpoint is *.2
- byte[] addr = hostAddr.getAddress();
- if (addr.length == 4 && addr[3] == 1) {
- addr[3] = 2;
- hostAddr = Inet4Address.getByAddress(addr);
- }
- } catch (UnknownHostException e) {
- reporter.log(Activator.createErrorStatus(
- "Could not correct the local host address",
- e));
- }
- commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
-
- reporter.logInfo("Set Host Address to " + vmnet + " endpoint address " + hostAddr);
-
- if (isNAT) {
- try {
- targetAddr = Inet4Address.getByAddress(new byte[] { 127, 0, 0, 1});
- } catch (UnknownHostException e) {
- // unlikely
- }
- }
- if (targetAddr == null) {
- // guess the target address
- targetAddr = VMwareUtils.convertToLikelyDHCPAddress(hostAddr);
- }
-
- if (targetAddr != null) {
- commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
-
- reporter.logInfo("Set Target Address to likely " + vmnet + " DHCP address " + targetAddr);
- reporter.log(Activator.createStatus(IStatus.WARNING,
- "You may need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
-
- }
- } else {
- reporter.log(Activator.createStatus(IStatus.WARNING,
- "Could not find the address of the " + vmnet + " interface. The VMX file may be referencing a missing, misconfigured, or unknown interface."));
- }
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.DialogSettings;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.esbox.internal.api.vm.ui.preferences.AddressProvider;
+import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
+import org.maemo.esbox.internal.api.vm.ui.preferences.HostInterfaceAddressProvider;
+import org.maemo.esbox.internal.api.vm.ui.preferences.IHostTargetAddressReconciler;
+import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineAddressConfigurator;
+import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage;
+import org.maemo.esbox.internal.api.vm.ui.preferences.SameSubnetHostTargetAddressConciler;
+import org.maemo.esbox.vm.core.IVirtualMachine;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.common.core.ui.IProgressReporter;
+import org.maemo.mica.internal.api.common.core.IPNetmaskFilter;
+
+/**
+ * Configure VMware preferences. This page is NOT registered at the top level
+ * of preference page UI but is nested inside the ESbox Build Machine preference UI.
+ * @author eswartz
+ *
+ */
+public class VMwarePreferencePage extends BaseVirtualMachinePreferencePage {
+
+ private VMwareSettingsPreferencePage settingsPage;
+
+ /**
+ * @param settings
+ */
+ public VMwarePreferencePage(IVMwareConfiguration config) {
+ super(config);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createMachine()
+ */
+ @Override
+ protected IVirtualMachine createMachine() {
+ IVMwareConfiguration config = new VMwareConfiguration(new DialogSettings("temp"));
+ commonPrefPage.saveTo(config);
+ config.setSharedFolders(sharedFoldersPrefPage.getSharedFolders());
+ vmPrefPage.saveTo(config);
+ return new VMwareMachine("Test VMWare Machine", config);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createVirtualMachinePreferencePage()
+ */
+ @Override
+ protected IVirtualMachineSettingsPreferencePage createVirtualMachinePreferencePage(IPreferenceStore store) {
+ settingsPage = new VMwareSettingsPreferencePage(store, this);
+ return settingsPage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage#createAddressConfigurator()
+ */
+ @Override
+ protected IVirtualMachineAddressConfigurator createAddressConfigurator() {
+ return new IVirtualMachineAddressConfigurator() {
+
+ public AddressProvider getDefaultHostAddressProvider() {
+ return new HostInterfaceAddressProvider();
+ }
+
+ public AddressProvider getDefaultTargetAddressProvider() {
+ return new VMwareTargetInterfaceAddressProvider();
+ }
+
+ public IHostTargetAddressReconciler getHostTargetAddressReconciler() {
+ return new SameSubnetHostTargetAddressConciler();
+ }
+
+ public void configureNetworkSettings(IProgressReporter reporter) {
+ initializeNetworkDefaults(reporter);
+ }
+
+ };
+ }
+
+ /**
+ * Set up default values for the network/machine access based on the VMX file.
+ * @return IStatus
+ */
+ protected void initializeNetworkDefaults(IProgressReporter reporter) {
+ String vmnet = null;
+
+ // get real info from the VMX
+ String vmx = settingsPage.getVMXPath();
+ String networkType = null;
+ boolean isNAT = false;
+
+ try {
+ //String vmx = store.getString(VMwarePreferenceConstants.VMWARE_VMX_PATH);
+ Map<String, String> config = VMwareUtils.readVMXFile(
+ vmx);
+
+ reporter.logInfo("Reading settings from " + vmx + "...");
+
+ networkType = VMwareUtils.getNetworkConfig(config);
+ if (networkType.equals(VMwareUtils.NETWORK_CONFIG_NAT)) {
+ vmnet = "vmnet8";
+ reporter.logInfo("Configuring for NAT networking.");
+ isNAT = true;
+ }
+ else if (networkType.equals(VMwareUtils.NETWORK_CONFIG_HOSTONLY)) {
+ vmnet = "vmnet1";
+ reporter.log(Activator.createStatus(IStatus.ERROR,
+ "This VM is configured for host-only networking, which usually means it cannot be contacted from the host, nor access the Internet. Please reconfigure it for NAT or Bridged networking if problems occur."));
+ } else if (networkType.equals(VMwareUtils.NETWORK_CONFIG_BRIDGED)) {
+ reporter.logInfo("Configuring for bridged networking.");
+ } else {
+ reporter.log(Activator.createStatus(IStatus.WARNING,
+ "Unknown or custom networking; assuming bridged networking. Please manually verify the settings."));
+ }
+ } catch (CoreException e) {
+ // keep guesses
+ reporter.log(Activator.createErrorStatus(
+ "Failed to read the VMX file " + vmx + "; please ensure it exists first.",
+ e));
+ return;
+ }
+
+ String port = "22";
+ if (isNAT) {
+ port = "2222";
+ reporter.logInfo("Set SSH Target Port to the default recommendation for NAT ("+port+").");
+ reporter.logInfo("If you're using Port Forwarding and NAT, this may need to be edited.");
+ } else {
+ reporter.logInfo("Set SSH Target Port to the default ("+port+").");
+ }
+ commonPrefPage.getSSHTargetPort().setStringValue(port);
+
+ port = "22";
+ commonPrefPage.getSSHHostPort().setStringValue(port);
+ reporter.logInfo("Set SSH Host Port to the default ("+port+").");
+
+ InetAddress hostAddr = null;
+ InetAddress targetAddr = null;
+
+ if (vmnet == null) {
+ // the host is the default in non-NAT, non-bridged modes
+ try {
+ hostAddr = InetAddress.getLocalHost();
+ commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
+
+ reporter.logInfo("Set Host Address to LAN address " + hostAddr);
+
+ // Dunno target -- it's DHCP. Reset the low byte if it's not on the same subnet.
+ targetAddr = commonPrefPage.getSSHTargetAddr().getAddress();
+ if (targetAddr instanceof Inet4Address) {
+ IPNetmaskFilter filter;
+ try {
+ filter = new IPNetmaskFilter(hostAddr);
+ if (!filter.accept(targetAddr))
+ targetAddr = null;
+ } catch (MicaException e) {
+ targetAddr = null;
+ }
+ }
+
+ if (targetAddr == null) {
+ targetAddr = InetAddress.getLocalHost();
+ if (targetAddr instanceof Inet4Address) {
+ byte[] addrBytes = targetAddr.getAddress();
+ addrBytes[3] = 0;
+ targetAddr = InetAddress.getByAddress(addrBytes);
+ }
+ commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
+ reporter.logInfo("Set Target Address to LAN address " + targetAddr + " (please edit)");
+ }
+ reporter.log(Activator.createStatus(IStatus.WARNING,
+ "You will need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
+ } catch (UnknownHostException e) {
+ // dunno!
+ reporter.log(Activator.createErrorStatus(
+ "Could not construct the local host address",
+ e));
+ }
+
+ } else {
+ // configure based on the network in use
+ Map<String, InetAddress> vmnets = VMwareUtils.getVMNetMappings();
+ hostAddr = vmnets.get(vmnet);
+ if (hostAddr != null) {
+ try {
+ // the network is *.1, but the endpoint is *.2
+ byte[] addr = hostAddr.getAddress();
+ if (addr.length == 4 && addr[3] == 1) {
+ addr[3] = 2;
+ hostAddr = Inet4Address.getByAddress(addr);
+ }
+ } catch (UnknownHostException e) {
+ reporter.log(Activator.createErrorStatus(
+ "Could not correct the local host address",
+ e));
+ }
+ commonPrefPage.getSSHHostAddr().setAddress(hostAddr);
+
+ reporter.logInfo("Set Host Address to " + vmnet + " endpoint address " + hostAddr);
+
+ if (isNAT) {
+ try {
+ targetAddr = Inet4Address.getByAddress(new byte[] { 127, 0, 0, 1});
+ } catch (UnknownHostException e) {
+ // unlikely
+ }
+ }
+ if (targetAddr == null) {
+ // guess the target address
+ targetAddr = VMwareUtils.convertToLikelyDHCPAddress(hostAddr);
+ }
+
+ if (targetAddr != null) {
+ commonPrefPage.getSSHTargetAddr().setAddress(targetAddr);
+
+ reporter.logInfo("Set Target Address to likely " + vmnet + " DHCP address " + targetAddr);
+ reporter.log(Activator.createStatus(IStatus.WARNING,
+ "You may need to manually edit the Target Address after the VM boots, by inspecting the output of 'sudo dhclient3' or '/sbin/ifconfig'."));
+
+ }
+ } else {
+ reporter.log(Activator.createStatus(IStatus.WARNING,
+ "Could not find the address of the " + vmnet + " interface. The VMX file may be referencing a missing, misconfigured, or unknown interface."));
+ }
+ }
+
+ }
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-
-package org.maemo.esbox.internal.vm.vmware;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.preference.FileFieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.widgets.Text;
-import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
-import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage;
-import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
-import org.maemo.mica.common.core.HostUtils;
-import org.maemo.mica.common.ui.preferences.BaseComposableFieldEditorPreferencePage;
-import org.maemo.mica.common.ui.preferences.NonValidatingFileFieldEditor;
-
-/**
- * Configure VMware preferences. This page is NOT registered at the top level
- * of preference page UI but is nested inside the ESbox Build Machine preference UI.
- * @author eswartz
- *
- */
-public class VMwareSettingsPreferencePage extends BaseComposableFieldEditorPreferencePage implements IVirtualMachineSettingsPreferencePage {
-
- private FileFieldEditor feVmxPath;
- private StringFieldEditor feVMWAREExeName;
- private StringFieldEditor feVMWARELaunchPattern;
- /*private*/ final BaseVirtualMachinePreferencePage vmPrefPage;
-
- /**
- * @param preferenceStore
- * @param vmPrefPage
- *
- */
- public VMwareSettingsPreferencePage(IPreferenceStore preferenceStore, BaseVirtualMachinePreferencePage vmPrefPage) {
- this.vmPrefPage = vmPrefPage;
- setTitle("VMware Options");
- setPreferenceStore(preferenceStore);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- @Override
- protected void createFieldEditors() {
- Text text;
-
- /*
- feVMWAREPath = new NonValidatingDirectoryFieldEditor(
- VMwarePreferenceConstants.VMWARE_INSTALL_PATH,
- "Installation directory:", getFieldEditorParent());
- addField(feVMWAREPath);
- text = feVMWAREPath.getTextControl(getFieldEditorParent());
- text.setToolTipText(
- "Specify the full path to a VMware installation.");
- */
-
- feVMWAREExeName = new FileFieldEditor(
- VMwarePreferenceConstants.VMWARE_EXE_NAME,
- "Executable:", getFieldEditorParent());
- addField(feVMWAREExeName);
- text = feVMWAREExeName.getTextControl(getFieldEditorParent());
- text.setToolTipText(MessageFormat.format(
- "Specify the VMware executable to launch{0}.\n\nIf the program lives in the installation directory or on the PATH, provide a bare filename.\n\nOtherwise, provide a full path to the executable.",
- HostUtils.isOSX() ? "" : " (Player, Server, or Workstation)"));
-
- feVMWARELaunchPattern = new StringFieldEditor(
- VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN,
- "Command pattern:",
- 48,
- getFieldEditorParent());
- addField(feVMWARELaunchPattern);
- text = feVMWARELaunchPattern.getTextControl(getFieldEditorParent());
- text.setToolTipText(
- "Specify the specific command pattern to use to launch the virtual machine.");
-
- feVmxPath = new NonValidatingFileFieldEditor(
- VMwarePreferenceConstants.VMWARE_VMX_PATH,
- "VMX path:", getFieldEditorParent());
- addField(feVmxPath);
- text = feVmxPath.getTextControl(getFieldEditorParent());
- text.setToolTipText(
- "Specify the full path to the VMX file for the machine.");
-
- /* don't do this here... it's invasive
- feVmxPath.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- // reinitialize network defaults when VMX changes
- String oldVmx = getPreferenceStore().getString(VMwarePreferenceConstants.VMWARE_VMX_PATH);
- String newVmx = feVmxPath.getStringValue();
- if (!newVmx.equals(oldVmx) && new File(newVmx).exists()) {
- vmPrefPage.promptConfigureNetwork();
- }
- }
- });
- */
-
- }
-
- /**
- * Get the current (uncommitted) VMX path
- * @return
- */
- public String getVMXPath() {
- return feVmxPath.getStringValue();
- }
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage#saveTo(org.maemo.esbox.vm.core.IVirtualMachineConfiguration)
- */
- public void saveTo(IVirtualMachineConfiguration config) {
- config.setCommandLaunchPattern(feVMWARELaunchPattern.getStringValue());
- config.setExecutable(feVMWAREExeName.getStringValue());
- ((IVMwareConfiguration) config).setVmxPath(feVmxPath.getStringValue());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.vm.vmware;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.internal.api.vm.ui.preferences.BaseVirtualMachinePreferencePage;
+import org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage;
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+import org.maemo.esbox.vm.vmware.IVMwareConfiguration;
+import org.maemo.mica.common.core.HostUtils;
+import org.maemo.mica.common.ui.preferences.BaseComposableFieldEditorPreferencePage;
+import org.maemo.mica.common.ui.preferences.NonValidatingFileFieldEditor;
+
+/**
+ * Configure VMware preferences. This page is NOT registered at the top level
+ * of preference page UI but is nested inside the ESbox Build Machine preference UI.
+ * @author eswartz
+ *
+ */
+public class VMwareSettingsPreferencePage extends BaseComposableFieldEditorPreferencePage implements IVirtualMachineSettingsPreferencePage {
+
+ private FileFieldEditor feVmxPath;
+ private StringFieldEditor feVMWAREExeName;
+ private StringFieldEditor feVMWARELaunchPattern;
+ /*private*/ final BaseVirtualMachinePreferencePage vmPrefPage;
+
+ /**
+ * @param preferenceStore
+ * @param vmPrefPage
+ *
+ */
+ public VMwareSettingsPreferencePage(IPreferenceStore preferenceStore, BaseVirtualMachinePreferencePage vmPrefPage) {
+ this.vmPrefPage = vmPrefPage;
+ setTitle("VMware Options");
+ setPreferenceStore(preferenceStore);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ Text text;
+
+ /*
+ feVMWAREPath = new NonValidatingDirectoryFieldEditor(
+ VMwarePreferenceConstants.VMWARE_INSTALL_PATH,
+ "Installation directory:", getFieldEditorParent());
+ addField(feVMWAREPath);
+ text = feVMWAREPath.getTextControl(getFieldEditorParent());
+ text.setToolTipText(
+ "Specify the full path to a VMware installation.");
+ */
+
+ feVMWAREExeName = new FileFieldEditor(
+ VMwarePreferenceConstants.VMWARE_EXE_NAME,
+ "Executable:", getFieldEditorParent());
+ addField(feVMWAREExeName);
+ text = feVMWAREExeName.getTextControl(getFieldEditorParent());
+ text.setToolTipText(MessageFormat.format(
+ "Specify the VMware executable to launch{0}.\n\nIf the program lives in the installation directory or on the PATH, provide a bare filename.\n\nOtherwise, provide a full path to the executable.",
+ HostUtils.isOSX() ? "" : " (Player, Server, or Workstation)"));
+
+ feVMWARELaunchPattern = new StringFieldEditor(
+ VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN,
+ "Command pattern:",
+ 48,
+ getFieldEditorParent());
+ addField(feVMWARELaunchPattern);
+ text = feVMWARELaunchPattern.getTextControl(getFieldEditorParent());
+ text.setToolTipText(
+ "Specify the specific command pattern to use to launch the virtual machine.");
+
+ feVmxPath = new NonValidatingFileFieldEditor(
+ VMwarePreferenceConstants.VMWARE_VMX_PATH,
+ "VMX path:", getFieldEditorParent());
+ addField(feVmxPath);
+ text = feVmxPath.getTextControl(getFieldEditorParent());
+ text.setToolTipText(
+ "Specify the full path to the VMX file for the machine.");
+
+ /* don't do this here... it's invasive
+ feVmxPath.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ // reinitialize network defaults when VMX changes
+ String oldVmx = getPreferenceStore().getString(VMwarePreferenceConstants.VMWARE_VMX_PATH);
+ String newVmx = feVmxPath.getStringValue();
+ if (!newVmx.equals(oldVmx) && new File(newVmx).exists()) {
+ vmPrefPage.promptConfigureNetwork();
+ }
+ }
+ });
+ */
+
+ }
+
+ /**
+ * Get the current (uncommitted) VMX path
+ * @return
+ */
+ public String getVMXPath() {
+ return feVmxPath.getStringValue();
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.ui.preferences.IVirtualMachineSettingsPreferencePage#saveTo(org.maemo.esbox.vm.core.IVirtualMachineConfiguration)
+ */
+ public void saveTo(IVirtualMachineConfiguration config) {
+ config.setCommandLaunchPattern(feVMWARELaunchPattern.getStringValue());
+ config.setExecutable(feVMWAREExeName.getStringValue());
+ ((IVMwareConfiguration) config).setVmxPath(feVmxPath.getStringValue());
+ }
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareTargetInterfaceAddressProvider.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareUtils.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * 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 String uncompressToolPath;
- 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.getInstallLocation() == null && installationPath != null)
- try {
- fileToDownload.setInstallLocation(new File(installationPath).toURL());
- } catch (MalformedURLException e) {
- Activator.getErrorLogger().logAndShowError(
- "Cannot get location for file "
- + downloadFile.getDescriptor(), 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.setInstallLocation(new File(installationPath).toURL());
- } catch (MalformedURLException e) {
- Activator.getErrorLogger().logAndShowError(
- "Cannot get location for file "
- + fileToDownload.getDescriptor(), e);
- }
-
- }
-
- /**
- * @return the pathOfExistentVM
- */
- public String getPathOfExistentVM() {
- return pathOfExistentVM;
- }
-
- /**
- * @return the path of uncompress tool to be used.
- */
- public String getUncompressToolPath() {
- return uncompressToolPath;
- }
-
- /**
- * @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;
- }
-
- /**
- * @param path the path of the uncompress tool to be used during virtual image uncompressing.
- */
- public void setUncompressToolPath(String path) {
- this.uncompressToolPath = path;
- }
-
-}
+/*******************************************************************************
+ * 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 String uncompressToolPath;
+ 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.getInstallLocation() == null && installationPath != null)
+ try {
+ fileToDownload.setInstallLocation(new File(installationPath).toURL());
+ } catch (MalformedURLException e) {
+ Activator.getErrorLogger().logAndShowError(
+ "Cannot get location for file "
+ + downloadFile.getDescriptor(), 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.setInstallLocation(new File(installationPath).toURL());
+ } catch (MalformedURLException e) {
+ Activator.getErrorLogger().logAndShowError(
+ "Cannot get location for file "
+ + fileToDownload.getDescriptor(), e);
+ }
+
+ }
+
+ /**
+ * @return the pathOfExistentVM
+ */
+ public String getPathOfExistentVM() {
+ return pathOfExistentVM;
+ }
+
+ /**
+ * @return the path of uncompress tool to be used.
+ */
+ public String getUncompressToolPath() {
+ return uncompressToolPath;
+ }
+
+ /**
+ * @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;
+ }
+
+ /**
+ * @param path the path of the uncompress tool to be used during virtual image uncompressing.
+ */
+ public void setUncompressToolPath(String path) {
+ this.uncompressToolPath = path;
+ }
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,539 +1,539 @@
-/*******************************************************************************
- * 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.util.Arrays;
-
-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.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-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.graphics.Rectangle;
-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.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Listener;
-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.core.machine.MachineRegistry;
-import org.maemo.mica.common.ui.NetworkSettingsUI;
-import org.maemo.mica.common.ui.dialogs.DialogUtils;
-import org.maemo.mica.internal.api.common.ui.LazyLoadingThreadTableContentProvider;
-
-/**
- * Page that displays general information about the Maemo SDK virtual image to
- * be installed.
- *
- * @author raulherbster
- *
- */
-public class MaemoSDKVMSelectionWizardPage extends WizardPage implements ILabelProviderListener {
-
- private MaemoSDKVMInfo latestVMInstallData;
-
- // 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;
-
- // listener for changes on text fields
- private Listener textFieldsValidator;
-
- // text area for description
- private Text imageDescription;
-
- /**
- * Comparator for virtual images table viewer.
- */
- private class VirtualImagesComparator extends ViewerComparator {
-
- public int compare(Viewer iviewer, Object e1, Object e2) {
- if (e1 == null) {
- return -1;
- } else if (e2 == null) {
- return 1;
- } else {
- return ((MaemoSDKVMInfo)e1).getDescriptor().compareTo(((MaemoSDKVMInfo)e2).getDescriptor());
- }
- }
-
- }
-
- /**
- * Constructor.
- *
- * @param wizard
- * the parent wizard.
- */
- protected MaemoSDKVMSelectionWizardPage(NewMaemoSDKVMWizard wizard) {
- super("maemovm_selection", "Select Maemo SDK Virtual Image",
- Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
- setDescription("A virtual image is a disk image with an installation of Linux/x86 " +
- "capable of hosting Scratchbox and the Maemo SDK.");
- setWizard(wizard);
- setPageComplete(false);
- textFieldsValidator = createTextFieldValidatorListener();
- }
-
- /*
- * (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);
-
- createDescriptionContent(composite);
-
- createOptionsContent(composite);
-
- createAdvancedContent(composite);
-
- setInitialValues();
-
- virtualImagesTable.setInput(new Object[0]);
-
- for (TableColumn column : virtualImagesTable.getTable().getColumns()) {
- column.pack();
- }
-
- //validatePage();
- }
-
- /**
- * 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 Maemo SDK server image");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
- .applyTo(downloadLatest);
- downloadLatest.setToolTipText("Selects the latest tested virtual disk image for use as a " +
- "Build Machine in ESbox. This does not have X installed.");
- 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();
- platformProvider.addListener(this);
- virtualImagesTable.setContentProvider(platformProvider);
- virtualImagesTable.setLabelProvider(platformProvider);
-
- virtualImagesTable.setComparator(new VirtualImagesComparator());
-
- 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) {
- Label separator = new Label(composite, SWT.NONE);
- GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
- .applyTo(separator);
-
- Label label = new Label(composite, SWT.NONE);
- label.setText("Install location:");
- GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
- .applyTo(label);
-
- destinationTextField = new Text(composite, SWT.BORDER);
- destinationTextField.setToolTipText("Specify the location to install Maemo SDK Virtual Image.");
- GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
- destinationTextField);
- destinationTextField.addListener(SWT.SELECTED, textFieldsValidator);
- destinationTextField.addListener(SWT.KeyDown, textFieldsValidator);
- destinationTextField.addListener(SWT.KeyUp, textFieldsValidator);
-
- 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);
- 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);
-
- advancedContent = new Composite(composite, SWT.NONE);
- GridLayoutFactory.fillDefaults().numColumns(4).applyTo(advancedContent);
-
- GridDataFactory.fillDefaults().grab(true, false).span(4, 1).applyTo(
- advancedContent);
- enableAdvancedContent(false);
-
- usePreviousDownloadButton = createButton(advancedContent, 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; otherwise, always download.");
- usePreviousDownloadButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent evt) {
- boolean usePreviousDownload = usePreviousDownloadButton
- .getSelection();
- downloadLatest.setEnabled(!usePreviousDownload);
- virtualImagesTable.getTable().setEnabled(
- !usePreviousDownload && !downloadLatest.getSelection());
- existingVirtualImageTextField.setEnabled(usePreviousDownload);
- ((NewMaemoSDKVMWizard) getWizard()).getInstallData()
- .setUsePreviousInstallation(usePreviousDownload);
- validatePage();
- }
-
- });
-
- 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.setEnabled(false);
- existingVirtualImageTextField
- .setToolTipText("Specify the location of existing compressed Maemo SDK Virtual Image.");
- GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
- existingVirtualImageTextField);
- existingVirtualImageTextField.addListener(SWT.SELECTED, textFieldsValidator);
- existingVirtualImageTextField.addListener(SWT.KeyDown, textFieldsValidator);
- existingVirtualImageTextField.addListener(SWT.KeyUp, textFieldsValidator);
-
-
- 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);
- validatePage();
- }
- }
- });
-
- advancedButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (advancedButton.getSelection()) {
- advancedButton.setText("<< Advanced");
- } else {
- advancedButton.setText("Advanced >>");
- }
- enableAdvancedContent(advancedButton.getSelection());
- }
- });
- }
-
- private void createDescriptionContent(Composite composite) {
- Label label = new Label(composite, SWT.NONE);
- label.setText("Description: ");
- GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
- .applyTo(label);
-
- imageDescription = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
- imageDescription.setEditable(false);
- GridData labelData = new GridData();
- labelData.horizontalSpan = 4;
- labelData.horizontalAlignment = SWT.FILL;
- labelData.verticalSpan = 2;
- labelData.verticalAlignment = SWT.FILL;
- Rectangle rect = getShell().getMonitor().getClientArea();
- labelData.widthHint = rect.width / 4;
- imageDescription.setLayoutData(labelData);
- }
-
- private void setInitialValues() {
- downloadLatest.setSelection(true);
- usePreviousDownloadButton.setSelection(false);
- destinationTextField.setText(MachineRegistry.getInstance().getLocalMachine().getUserHome().toOSString());
- existingVirtualImageTextField.setText("");
-
- }
-
- /**
- * Validate information of the wizard page, so we can check if it is
- * possible to proceed or not.
- */
- private void validatePage() {
- String errorMessage = null;
- if (!downloadLatest.getSelection()
- && virtualImagesTable.getSelection().isEmpty()
- && !usePreviousDownloadButton.getSelection()) {
- errorMessage = "Select a Maemo SDK virtual image to be installed on your host machine";
- }
-
- if (errorMessage == null) {
- validateTextFields();
- } else {
- setErrorMessage(errorMessage);
- setPageComplete(false);
- }
-
- }
-
- /**
- * Validate text fields of Maemo SDK selection wizard page.
- * It checks if destination of Maemo SDK VM is properly defined; if location of existing Maemo SDK VM really
- * exists.
- */
- private void validateTextFields() {
- String errorMessage = null;
-
- String destination = destinationTextField.getText().trim();
- if (destination.equals("")){
- errorMessage = "You must specify the destination of Maemo SDK virtual image";
- } else {
- 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();
- if (existingVirtualImageLocation.equals("")){
- errorMessage = "You must specify the location of an existing Maemo SDK virtual image.";
- } else {
- 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);
- }
- }
- }
- }
-
-
- /**
- * 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);
-
- imageDescription.setText(data.getDescriptor().getDescription());
- }
- }
-
- 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();
- }
-
- /**
- * Create validator for text fields.
- * @return
- */
- protected Listener createTextFieldValidatorListener(){
- return new Listener() {
- public void handleEvent(Event event) {
- validateTextFields();
- }
- };
- }
-
- /**
- * Method to receive notification that information about images on website was properly retrieved. Based on
- * that, it
- */
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- if (event.getClass() == LabelProviderChangedEvent.class) {
- latestVMInstallData = getLatestVMInstallData(event);
- if (latestVMInstallData != null) {
- doChangeVMChoice(latestVMInstallData);
- setPageComplete(true);
- validatePage();
- ((Composite)getControl()).layout();
- }
- }
- }
-
- /**
- * Get latest Maemo SDK VM from website.
- * @param event the event to get resource.
- * @return the latest Maemo SDK VM.
- */
- private MaemoSDKVMInfo getLatestVMInstallData(LabelProviderChangedEvent event) {
- LazyLoadingThreadTableContentProvider provider = (LazyLoadingThreadTableContentProvider)event.getSource();
- Object[] elements = provider.getElements(new Object[0]);
- Arrays.sort(elements);
- if (elements.length > 0)
- return (MaemoSDKVMInfo) elements[0];
- else
- return null;
- }
-
-}
+/*******************************************************************************
+ * 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.util.Arrays;
+
+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.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+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.graphics.Rectangle;
+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.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Listener;
+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.core.machine.MachineRegistry;
+import org.maemo.mica.common.ui.NetworkSettingsUI;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
+import org.maemo.mica.internal.api.common.ui.LazyLoadingThreadTableContentProvider;
+
+/**
+ * Page that displays general information about the Maemo SDK virtual image to
+ * be installed.
+ *
+ * @author raulherbster
+ *
+ */
+public class MaemoSDKVMSelectionWizardPage extends WizardPage implements ILabelProviderListener {
+
+ private MaemoSDKVMInfo latestVMInstallData;
+
+ // 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;
+
+ // listener for changes on text fields
+ private Listener textFieldsValidator;
+
+ // text area for description
+ private Text imageDescription;
+
+ /**
+ * Comparator for virtual images table viewer.
+ */
+ private class VirtualImagesComparator extends ViewerComparator {
+
+ public int compare(Viewer iviewer, Object e1, Object e2) {
+ if (e1 == null) {
+ return -1;
+ } else if (e2 == null) {
+ return 1;
+ } else {
+ return ((MaemoSDKVMInfo)e1).getDescriptor().compareTo(((MaemoSDKVMInfo)e2).getDescriptor());
+ }
+ }
+
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param wizard
+ * the parent wizard.
+ */
+ protected MaemoSDKVMSelectionWizardPage(NewMaemoSDKVMWizard wizard) {
+ super("maemovm_selection", "Select Maemo SDK Virtual Image",
+ Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
+ setDescription("A virtual image is a disk image with an installation of Linux/x86 " +
+ "capable of hosting Scratchbox and the Maemo SDK.");
+ setWizard(wizard);
+ setPageComplete(false);
+ textFieldsValidator = createTextFieldValidatorListener();
+ }
+
+ /*
+ * (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);
+
+ createDescriptionContent(composite);
+
+ createOptionsContent(composite);
+
+ createAdvancedContent(composite);
+
+ setInitialValues();
+
+ virtualImagesTable.setInput(new Object[0]);
+
+ for (TableColumn column : virtualImagesTable.getTable().getColumns()) {
+ column.pack();
+ }
+
+ //validatePage();
+ }
+
+ /**
+ * 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 Maemo SDK server image");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
+ .applyTo(downloadLatest);
+ downloadLatest.setToolTipText("Selects the latest tested virtual disk image for use as a " +
+ "Build Machine in ESbox. This does not have X installed.");
+ 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();
+ platformProvider.addListener(this);
+ virtualImagesTable.setContentProvider(platformProvider);
+ virtualImagesTable.setLabelProvider(platformProvider);
+
+ virtualImagesTable.setComparator(new VirtualImagesComparator());
+
+ 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) {
+ Label separator = new Label(composite, SWT.NONE);
+ GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
+ .applyTo(separator);
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("Install location:");
+ GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
+ .applyTo(label);
+
+ destinationTextField = new Text(composite, SWT.BORDER);
+ destinationTextField.setToolTipText("Specify the location to install Maemo SDK Virtual Image.");
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
+ destinationTextField);
+ destinationTextField.addListener(SWT.SELECTED, textFieldsValidator);
+ destinationTextField.addListener(SWT.KeyDown, textFieldsValidator);
+ destinationTextField.addListener(SWT.KeyUp, textFieldsValidator);
+
+ 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);
+ 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);
+
+ advancedContent = new Composite(composite, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(4).applyTo(advancedContent);
+
+ GridDataFactory.fillDefaults().grab(true, false).span(4, 1).applyTo(
+ advancedContent);
+ enableAdvancedContent(false);
+
+ usePreviousDownloadButton = createButton(advancedContent, 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; otherwise, always download.");
+ usePreviousDownloadButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ boolean usePreviousDownload = usePreviousDownloadButton
+ .getSelection();
+ downloadLatest.setEnabled(!usePreviousDownload);
+ virtualImagesTable.getTable().setEnabled(
+ !usePreviousDownload && !downloadLatest.getSelection());
+ existingVirtualImageTextField.setEnabled(usePreviousDownload);
+ ((NewMaemoSDKVMWizard) getWizard()).getInstallData()
+ .setUsePreviousInstallation(usePreviousDownload);
+ validatePage();
+ }
+
+ });
+
+ 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.setEnabled(false);
+ existingVirtualImageTextField
+ .setToolTipText("Specify the location of existing compressed Maemo SDK Virtual Image.");
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
+ existingVirtualImageTextField);
+ existingVirtualImageTextField.addListener(SWT.SELECTED, textFieldsValidator);
+ existingVirtualImageTextField.addListener(SWT.KeyDown, textFieldsValidator);
+ existingVirtualImageTextField.addListener(SWT.KeyUp, textFieldsValidator);
+
+
+ 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);
+ validatePage();
+ }
+ }
+ });
+
+ advancedButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (advancedButton.getSelection()) {
+ advancedButton.setText("<< Advanced");
+ } else {
+ advancedButton.setText("Advanced >>");
+ }
+ enableAdvancedContent(advancedButton.getSelection());
+ }
+ });
+ }
+
+ private void createDescriptionContent(Composite composite) {
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("Description: ");
+ GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(4, 1)
+ .applyTo(label);
+
+ imageDescription = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
+ imageDescription.setEditable(false);
+ GridData labelData = new GridData();
+ labelData.horizontalSpan = 4;
+ labelData.horizontalAlignment = SWT.FILL;
+ labelData.verticalSpan = 2;
+ labelData.verticalAlignment = SWT.FILL;
+ Rectangle rect = getShell().getMonitor().getClientArea();
+ labelData.widthHint = rect.width / 4;
+ imageDescription.setLayoutData(labelData);
+ }
+
+ private void setInitialValues() {
+ downloadLatest.setSelection(true);
+ usePreviousDownloadButton.setSelection(false);
+ destinationTextField.setText(MachineRegistry.getInstance().getLocalMachine().getUserHome().toOSString());
+ existingVirtualImageTextField.setText("");
+
+ }
+
+ /**
+ * Validate information of the wizard page, so we can check if it is
+ * possible to proceed or not.
+ */
+ private void validatePage() {
+ String errorMessage = null;
+ if (!downloadLatest.getSelection()
+ && virtualImagesTable.getSelection().isEmpty()
+ && !usePreviousDownloadButton.getSelection()) {
+ errorMessage = "Select a Maemo SDK virtual image to be installed on your host machine";
+ }
+
+ if (errorMessage == null) {
+ validateTextFields();
+ } else {
+ setErrorMessage(errorMessage);
+ setPageComplete(false);
+ }
+
+ }
+
+ /**
+ * Validate text fields of Maemo SDK selection wizard page.
+ * It checks if destination of Maemo SDK VM is properly defined; if location of existing Maemo SDK VM really
+ * exists.
+ */
+ private void validateTextFields() {
+ String errorMessage = null;
+
+ String destination = destinationTextField.getText().trim();
+ if (destination.equals("")){
+ errorMessage = "You must specify the destination of Maemo SDK virtual image";
+ } else {
+ 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();
+ if (existingVirtualImageLocation.equals("")){
+ errorMessage = "You must specify the location of an existing Maemo SDK virtual image.";
+ } else {
+ 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);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * 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);
+
+ imageDescription.setText(data.getDescriptor().getDescription());
+ }
+ }
+
+ 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();
+ }
+
+ /**
+ * Create validator for text fields.
+ * @return
+ */
+ protected Listener createTextFieldValidatorListener(){
+ return new Listener() {
+ public void handleEvent(Event event) {
+ validateTextFields();
+ }
+ };
+ }
+
+ /**
+ * Method to receive notification that information about images on website was properly retrieved. Based on
+ * that, it
+ */
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ if (event.getClass() == LabelProviderChangedEvent.class) {
+ latestVMInstallData = getLatestVMInstallData(event);
+ if (latestVMInstallData != null) {
+ doChangeVMChoice(latestVMInstallData);
+ setPageComplete(true);
+ validatePage();
+ ((Composite)getControl()).layout();
+ }
+ }
+ }
+
+ /**
+ * Get latest Maemo SDK VM from website.
+ * @param event the event to get resource.
+ * @return the latest Maemo SDK VM.
+ */
+ private MaemoSDKVMInfo getLatestVMInstallData(LabelProviderChangedEvent event) {
+ LazyLoadingThreadTableContentProvider provider = (LazyLoadingThreadTableContentProvider)event.getSource();
+ Object[] elements = provider.getElements(new Object[0]);
+ Arrays.sort(elements);
+ if (elements.length > 0)
+ return (MaemoSDKVMInfo) elements[0];
+ else
+ return null;
+ }
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMUncompressInfoWizardPage.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMUncompressInfoWizardPage.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMUncompressInfoWizardPage.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,179 +1,179 @@
-/*******************************************************************************
- * 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.core.runtime.Platform;
-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.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.mica.common.core.machine.IMachine;
-import org.maemo.mica.common.core.machine.MachineRegistry;
-import org.maemo.mica.common.ui.dialogs.DialogUtils;
-
-/**
- * This page displays information about Maemo SDK virtual machine configuration.
- *
- * @author raulherbster
- *
- */
-public class MaemoSDKVMUncompressInfoWizardPage extends WizardPage {
-
- // options for uncompress tool
- private Text uncompressToolTextField;
-
- /**
- * Constructor.
- *
- * @param wizard
- * parent wizard.
- */
- protected MaemoSDKVMUncompressInfoWizardPage(NewMaemoSDKVMWizard wizard) {
- super("maemovm_uncompresstool", "Uncompress tool specification",
- Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
- setDescription("Specify the tool used to uncompress Maemo SDK Virtual Image.");
- setWizard(wizard);
- setPageComplete(false);
- }
-
- /*
- * (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);
-
- Label mainMessage = new Label(composite, SWT.WRAP);
- mainMessage.setText("Maemo SDK Virtual Image wizard also uncompress the virtual machine for you. " +
- "However, since Maemo SDK Virtual Images are considerable large, most of existing tools cannot uncompress them.\n" +
- "This wizard uses 7zip tool for uncompression, please specify a valid path for 7zip tool bellow.");
-
- GridData labelData = new GridData();
- labelData.horizontalSpan = 4;
- labelData.horizontalAlignment = SWT.FILL;
- Rectangle rect = getShell().getMonitor().getClientArea();
- labelData.widthHint = rect.width / 4;
- mainMessage.setLayoutData(labelData);
-
- Label separator = new Label(composite, SWT.NONE);
- GridDataFactory.swtDefaults().span(4, 1).align(SWT.LEFT, SWT.CENTER)
- .applyTo(separator);
-
-
- Label uncompressToollabel = new Label(composite, SWT.NONE);
- uncompressToollabel.setText("Uncompress tool path:");
- GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
- .applyTo(uncompressToollabel);
-
- uncompressToolTextField = new Text(composite, SWT.BORDER);
- uncompressToolTextField.setText(getDefault7zPath());
- uncompressToolTextField.setToolTipText("Specify the path of tool to uncompress Maemo SDK Virtual Image.");
- GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
- uncompressToolTextField);
-
- Listener textFieldValidator = new Listener() {
- public void handleEvent(Event event) {
- validatePage();
- }
- };
-
- uncompressToolTextField.addListener(SWT.SELECTED, textFieldValidator);
- uncompressToolTextField.addListener(SWT.KeyDown, textFieldValidator);
- uncompressToolTextField.addListener(SWT.KeyUp, textFieldValidator);
-
- Button browserButton = new Button(composite, SWT.PUSH);
- browserButton.setText("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);
-
- String currentFile = uncompressToolTextField.getText();
- if (currentFile.length() > 0) {
- File current = new File(currentFile);
- dialog.setFilterPath(current.getParent());
- dialog.setFileName(current.getName());
- }
- dialog.setText("Select the path of uncompress tool");
- String pathDirectory = dialog.open();
- if (pathDirectory != null) {
- uncompressToolTextField.setText(pathDirectory);
- validatePage();
- }
- }
- });
-
- validatePage();
- }
-
- /**
- * Validate the wizard page.
- */
- public void validatePage() {
- String errorMessage = null;
-
- String uncompressToolPath = uncompressToolTextField.getText().trim();
- if (uncompressToolPath.equals("")){
- errorMessage = "You must specify the path of tool to uncompress the Maemo SDK Virtual Image.";
- } else {
- File file = new File(uncompressToolPath);
- if (!file.exists() || file.isDirectory()){
- errorMessage = "Invalid path for uncompress tool. Please, select a valid directory.";
- } else {
- ((NewMaemoSDKVMWizard) getWizard()).getInstallData().setUncompressToolPath(uncompressToolPath);
- }
- }
-
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage == null);
- }
-
-
- public static String getDefault7zPath(){
- String path = "/usr/bin/7z";
-
- IMachine machine = MachineRegistry.getInstance().getLocalMachine();
- if (machine.getOS().equals(Platform.OS_WIN32))
- return "C:/Program Files/7-Zip/7z.exe";
-
- if (machine.getOS().equals(Platform.OS_LINUX)) {
- return "/usr/bin/7z";
- }
- if (machine.getOS().equals(Platform.OS_MACOSX)) {
- return "/usr/bin/7za";
- }
- return path;
-
- }
-}
+/*******************************************************************************
+ * 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.core.runtime.Platform;
+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.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.MachineRegistry;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
+
+/**
+ * This page displays information about Maemo SDK virtual machine configuration.
+ *
+ * @author raulherbster
+ *
+ */
+public class MaemoSDKVMUncompressInfoWizardPage extends WizardPage {
+
+ // options for uncompress tool
+ private Text uncompressToolTextField;
+
+ /**
+ * Constructor.
+ *
+ * @param wizard
+ * parent wizard.
+ */
+ protected MaemoSDKVMUncompressInfoWizardPage(NewMaemoSDKVMWizard wizard) {
+ super("maemovm_uncompresstool", "Uncompress tool specification",
+ Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
+ setDescription("Specify the tool used to uncompress Maemo SDK Virtual Image.");
+ setWizard(wizard);
+ setPageComplete(false);
+ }
+
+ /*
+ * (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);
+
+ Label mainMessage = new Label(composite, SWT.WRAP);
+ mainMessage.setText("Maemo SDK Virtual Image wizard also uncompress the virtual machine for you. " +
+ "However, since Maemo SDK Virtual Images are considerable large, most of existing tools cannot uncompress them.\n" +
+ "This wizard uses 7zip tool for uncompression, please specify a valid path for 7zip tool bellow.");
+
+ GridData labelData = new GridData();
+ labelData.horizontalSpan = 4;
+ labelData.horizontalAlignment = SWT.FILL;
+ Rectangle rect = getShell().getMonitor().getClientArea();
+ labelData.widthHint = rect.width / 4;
+ mainMessage.setLayoutData(labelData);
+
+ Label separator = new Label(composite, SWT.NONE);
+ GridDataFactory.swtDefaults().span(4, 1).align(SWT.LEFT, SWT.CENTER)
+ .applyTo(separator);
+
+
+ Label uncompressToollabel = new Label(composite, SWT.NONE);
+ uncompressToollabel.setText("Uncompress tool path:");
+ GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER)
+ .applyTo(uncompressToollabel);
+
+ uncompressToolTextField = new Text(composite, SWT.BORDER);
+ uncompressToolTextField.setText(getDefault7zPath());
+ uncompressToolTextField.setToolTipText("Specify the path of tool to uncompress Maemo SDK Virtual Image.");
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(
+ uncompressToolTextField);
+
+ Listener textFieldValidator = new Listener() {
+ public void handleEvent(Event event) {
+ validatePage();
+ }
+ };
+
+ uncompressToolTextField.addListener(SWT.SELECTED, textFieldValidator);
+ uncompressToolTextField.addListener(SWT.KeyDown, textFieldValidator);
+ uncompressToolTextField.addListener(SWT.KeyUp, textFieldValidator);
+
+ Button browserButton = new Button(composite, SWT.PUSH);
+ browserButton.setText("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);
+
+ String currentFile = uncompressToolTextField.getText();
+ if (currentFile.length() > 0) {
+ File current = new File(currentFile);
+ dialog.setFilterPath(current.getParent());
+ dialog.setFileName(current.getName());
+ }
+ dialog.setText("Select the path of uncompress tool");
+ String pathDirectory = dialog.open();
+ if (pathDirectory != null) {
+ uncompressToolTextField.setText(pathDirectory);
+ validatePage();
+ }
+ }
+ });
+
+ validatePage();
+ }
+
+ /**
+ * Validate the wizard page.
+ */
+ public void validatePage() {
+ String errorMessage = null;
+
+ String uncompressToolPath = uncompressToolTextField.getText().trim();
+ if (uncompressToolPath.equals("")){
+ errorMessage = "You must specify the path of tool to uncompress the Maemo SDK Virtual Image.";
+ } else {
+ File file = new File(uncompressToolPath);
+ if (!file.exists() || file.isDirectory()){
+ errorMessage = "Invalid path for uncompress tool. Please, select a valid directory.";
+ } else {
+ ((NewMaemoSDKVMWizard) getWizard()).getInstallData().setUncompressToolPath(uncompressToolPath);
+ }
+ }
+
+ setErrorMessage(errorMessage);
+ setPageComplete(errorMessage == null);
+ }
+
+
+ public static String getDefault7zPath(){
+ String path = "/usr/bin/7z";
+
+ IMachine machine = MachineRegistry.getInstance().getLocalMachine();
+ if (machine.getOS().equals(Platform.OS_WIN32))
+ return "C:/Program Files/7-Zip/7z.exe";
+
+ if (machine.getOS().equals(Platform.OS_LINUX)) {
+ return "/usr/bin/7z";
+ }
+ if (machine.getOS().equals(Platform.OS_MACOSX)) {
+ return "/usr/bin/7za";
+ }
+ return path;
+
+ }
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMUncompressInfoWizardPage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,173 +1,173 @@
-/*******************************************************************************
- * 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 MaemoSDKVMUncompressInfoWizardPage uncompressToolPage;
- 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);
- uncompressToolPage = new MaemoSDKVMUncompressInfoWizardPage(this);
- addPage(uncompressToolPage);
- 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;
- }
-
-}
+/*******************************************************************************
+ * 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 MaemoSDKVMUncompressInfoWizardPage uncompressToolPage;
+ 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);
+ uncompressToolPage = new MaemoSDKVMUncompressInfoWizardPage(this);
+ addPage(uncompressToolPage);
+ 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;
+ }
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java 2009-09-08 14:27:34 UTC (rev 2118)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java 2009-09-08 17:56:21 UTC (rev 2119)
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ed Swartz (Nokia) - initial API and implementation
- *******************************************************************************/
-
-package org.maemo.esbox.vm.vmware;
-
-import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
-
-/**
- * This interface, implemented by clients, provides settings needed
- * to launch and communicate with a virtual machine using VMware.
- * <p>
- * The stock implementation for VMware machines created by IBuildMachineProvider
- * reads the corresponding settings dynamically from VMwarePreferenceConstants.
- * @author eswartz
- *
- */
-public interface IVMwareConfiguration extends IVirtualMachineConfiguration {
-
- /** Get the VMX path
- * @return full path to *.vmx file
- */
- String getVmxPath();
-
- /**
- * Set the VMX path
- * @param path full path to *.vmx file
- */
- void setVmxPath(String path);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008-2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ed Swartz (Nokia) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.vm.vmware;
+
+import org.maemo.esbox.vm.core.IVirtualMachineConfiguration;
+
+/**
+ * This interface, implemented by clients, provides settings needed
+ * to launch and communicate with a virtual machine using VMware.
+ * <p>
+ * The stock implementation for VMware machines created by IBuildMachineProvider
+ * reads the corresponding settings dynamically from VMwarePreferenceConstants.
+ * @author eswartz
+ *
+ */
+public interface IVMwareConfiguration extends IVirtualMachineConfiguration {
+
+ /** Get the VMX path
+ * @return full path to *.vmx file
+ */
+ String getVmxPath();
+
+ /**
+ * Set the VMX path
+ * @param path full path to *.vmx file
+ */
+ void setVmxPath(String path);
+
+}
Property changes on: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Esbox-commits
mailing list