[Esbox-commits] r2121 - in branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox: internal/api/vm/vmware internal/vm/vmware internal/vm/vmware/ui/wizards vm/vmware
fabricioepa at garage.maemo.org
fabricioepa at garage.maemo.org
Tue Sep 8 22:45:46 EEST 2009
Author: fabricioepa
Date: 2009-09-08 22:45:43 +0300 (Tue, 08 Sep 2009)
New Revision: 2121
Modified:
branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java
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:
reverting commit 2119
Modified: branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/api/vm/vmware/MaemoSDKVMInfo.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -23,8 +23,7 @@
*/
public class MaemoSDKVMInfo implements Comparable<MaemoSDKVMInfo> {
//XXX REMOVE ME public static final String DOWNLOAD_PAGE = "http://localhost:8080/nokia/";
- public static final String DOWNLOAD_PAGE = "http://localhost:8080/nokia/";
-// public static final String DOWNLOAD_PAGE = "http://tablets-dev.nokia.com/maemo-dev-env-downloads.php";
+ public static final String DOWNLOAD_PAGE = "http://tablets-dev.nokia.com/maemo-dev-env-downloads.php";
// status for the file
public enum Status {
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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/Activator.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareBuildMachineFactory.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareConfiguration.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachine.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineController.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareMachineFactory.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstants.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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
Modified: 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/VMwarePreferenceConstantsPrivate.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceConstantsPrivate.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * 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;
-
-/**
- * Private keys for VMware prefs initialization
- * @author eswartz
- *
- */
-public class VMwarePreferenceConstantsPrivate {
- static final String VMWARE_EXE_NAME_WIN32 = "VMWARE_EXE_NAME_WIN32";
- static final String VMWARE_VMX_PATH_WIN32 = "VMWARE_VMX_PATH_WIN32";
- static final String VMWARE_LAUNCH_PATTERN_WIN32 = "VMWARE_LAUNCH_PATTERN_WIN32";
-
- static final String VMWARE_EXE_NAME_OSX = "VMWARE_EXE_NAME_OSX";
- static final String VMWARE_VMX_PATH_OSX = "VMWARE_VMX_PATH_OSX";
- static final String VMWARE_LAUNCH_PATTERN_OSX = "VMWARE_LAUNCH_PATTERN_OSX";
-
- static final String VMWARE_EXE_NAME_UNIX = "VMWARE_EXE_NAME_UNIX";
- static final String VMWARE_VMX_PATH_UNIX = "VMWARE_VMX_PATH_UNIX";
- static final String VMWARE_LAUNCH_PATTERN_UNIX = "VMWARE_LAUNCH_PATTERN_UNIX";
-
- static final String VMWARE_VM_IMAGE = "VMWARE_VM_IMAGE";
-}
+/*******************************************************************************
+ * 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;
+
+/**
+ * Private keys for VMware prefs initialization
+ * @author eswartz
+ *
+ */
+public class VMwarePreferenceConstantsPrivate {
+ static final String VMWARE_EXE_NAME_WIN32 = "VMWARE_EXE_NAME_WIN32";
+ static final String VMWARE_VMX_PATH_WIN32 = "VMWARE_VMX_PATH_WIN32";
+ static final String VMWARE_LAUNCH_PATTERN_WIN32 = "VMWARE_LAUNCH_PATTERN_WIN32";
+
+ static final String VMWARE_EXE_NAME_OSX = "VMWARE_EXE_NAME_OSX";
+ static final String VMWARE_VMX_PATH_OSX = "VMWARE_VMX_PATH_OSX";
+ static final String VMWARE_LAUNCH_PATTERN_OSX = "VMWARE_LAUNCH_PATTERN_OSX";
+
+ static final String VMWARE_EXE_NAME_UNIX = "VMWARE_EXE_NAME_UNIX";
+ static final String VMWARE_VMX_PATH_UNIX = "VMWARE_VMX_PATH_UNIX";
+ static final String VMWARE_LAUNCH_PATTERN_UNIX = "VMWARE_LAUNCH_PATTERN_UNIX";
+
+ static final String VMWARE_VM_IMAGE = "VMWARE_VM_IMAGE";
+}
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
Modified: 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/VMwarePreferenceMigrator.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferenceMigrator.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * 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.cdt.utils.WindowsRegistry;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.maemo.mica.common.core.preferences.CorePreferenceManager;
-import org.maemo.mica.common.core.preferences.PreferenceMigratorAdapter;
-
-import java.io.File;
-import java.util.Properties;
-
-/**
- * @author eswartz
- *
- */
-public class VMwarePreferenceMigrator extends PreferenceMigratorAdapter {
-
- /* (non-Javadoc)
- * @see org.maemo.mica.common.core.IPreferenceMigrator#adjustDefaultSettings(java.util.Properties)
- */
- public void adjustDefaultSettings(Properties newPropertyDefaults) {
- // adjust any environment-dependent defaults
- CorePreferenceManager.selectDefaultForOS(newPropertyDefaults,
- VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN);
- CorePreferenceManager.selectDefaultForOS(newPropertyDefaults,
- VMwarePreferenceConstants.VMWARE_EXE_NAME);
- CorePreferenceManager.selectDefaultForOS(newPropertyDefaults,
- VMwarePreferenceConstants.VMWARE_VMX_PATH);
- }
-
- /* (non-Javadoc)
- * @see org.maemo.mica.common.core.IPreferenceMigrator#convertExistingPreferences(org.eclipse.jface.preference.IPreferenceStore, int, java.util.Properties, java.util.Properties)
- */
- public void convertExistingPreferences(IPreferenceStore preferences,
- int oldMajor, Properties existingSettings,
- Properties newPropertyDefaults) {
-
- // this isn't strictly a conversion from an older version,
- // but a change that reflects changes in any current installation
- if (!existingSettings.containsKey(VMwarePreferenceConstants.VMWARE_EXE_NAME)) {
- WindowsRegistry registry = WindowsRegistry.getRegistry();
- if (registry != null) {
- // look for some, on Windows, where it's a hassle
- String progFiles = registry.getLocalMachineValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir");
- if (progFiles == null)
- progFiles = "C:\\Program Files";
- String prefix = progFiles + "\\VMWare\\";
- String[] candidates = {
- "VMware Workstation",
- "VMware Server",
- "VMware Player"
- };
- String[] progs = {
- "vmware.exe",
- "vmplayer.exe",
- };
- String exePath = null;
- for (String candidate : candidates) {
- if (exePath != null) break;
- File dir = new File(prefix + candidate);
- if (dir.exists()) {
- for (String prog : progs) {
- File exe = new File(dir, prog);
- if (exe.exists()) {
- exePath = exe.getAbsolutePath();
- break;
- }
- }
- }
- }
- if (exePath != null) {
- newPropertyDefaults.put(VMwarePreferenceConstants.VMWARE_EXE_NAME,
- exePath);
- }
- }
- if (!existingSettings.containsKey(VMwarePreferenceConstants.VMWARE_PRODUCT)) {
- // guess from path
- String exePath = existingSettings.getProperty(VMwarePreferenceConstants.VMWARE_EXE_NAME);
- newPropertyDefaults.put(VMwarePreferenceConstants.VMWARE_PRODUCT,
- VMwareUtils.guessProductFromPath(exePath));
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.cdt.utils.WindowsRegistry;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.maemo.mica.common.core.preferences.CorePreferenceManager;
+import org.maemo.mica.common.core.preferences.PreferenceMigratorAdapter;
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * @author eswartz
+ *
+ */
+public class VMwarePreferenceMigrator extends PreferenceMigratorAdapter {
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.IPreferenceMigrator#adjustDefaultSettings(java.util.Properties)
+ */
+ public void adjustDefaultSettings(Properties newPropertyDefaults) {
+ // adjust any environment-dependent defaults
+ CorePreferenceManager.selectDefaultForOS(newPropertyDefaults,
+ VMwarePreferenceConstants.VMWARE_LAUNCH_PATTERN);
+ CorePreferenceManager.selectDefaultForOS(newPropertyDefaults,
+ VMwarePreferenceConstants.VMWARE_EXE_NAME);
+ CorePreferenceManager.selectDefaultForOS(newPropertyDefaults,
+ VMwarePreferenceConstants.VMWARE_VMX_PATH);
+ }
+
+ /* (non-Javadoc)
+ * @see org.maemo.mica.common.core.IPreferenceMigrator#convertExistingPreferences(org.eclipse.jface.preference.IPreferenceStore, int, java.util.Properties, java.util.Properties)
+ */
+ public void convertExistingPreferences(IPreferenceStore preferences,
+ int oldMajor, Properties existingSettings,
+ Properties newPropertyDefaults) {
+
+ // this isn't strictly a conversion from an older version,
+ // but a change that reflects changes in any current installation
+ if (!existingSettings.containsKey(VMwarePreferenceConstants.VMWARE_EXE_NAME)) {
+ WindowsRegistry registry = WindowsRegistry.getRegistry();
+ if (registry != null) {
+ // look for some, on Windows, where it's a hassle
+ String progFiles = registry.getLocalMachineValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir");
+ if (progFiles == null)
+ progFiles = "C:\\Program Files";
+ String prefix = progFiles + "\\VMWare\\";
+ String[] candidates = {
+ "VMware Workstation",
+ "VMware Server",
+ "VMware Player"
+ };
+ String[] progs = {
+ "vmware.exe",
+ "vmplayer.exe",
+ };
+ String exePath = null;
+ for (String candidate : candidates) {
+ if (exePath != null) break;
+ File dir = new File(prefix + candidate);
+ if (dir.exists()) {
+ for (String prog : progs) {
+ File exe = new File(dir, prog);
+ if (exe.exists()) {
+ exePath = exe.getAbsolutePath();
+ break;
+ }
+ }
+ }
+ }
+ if (exePath != null) {
+ newPropertyDefaults.put(VMwarePreferenceConstants.VMWARE_EXE_NAME,
+ exePath);
+ }
+ }
+ if (!existingSettings.containsKey(VMwarePreferenceConstants.VMWARE_PRODUCT)) {
+ // guess from path
+ String exePath = existingSettings.getProperty(VMwarePreferenceConstants.VMWARE_EXE_NAME);
+ newPropertyDefaults.put(VMwarePreferenceConstants.VMWARE_PRODUCT,
+ VMwareUtils.guessProductFromPath(exePath));
+ }
+ }
+ }
+
+}
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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwarePreferencePage.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareSettingsPreferencePage.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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
Modified: 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/VMwareTargetInterfaceAddressProvider.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareTargetInterfaceAddressProvider.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * 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 java.net.InetAddress;
-import java.util.Map;
-import java.util.Set;
-
-import org.maemo.esbox.internal.api.vm.ui.preferences.LocalhostTargetInterfaceAddressProvider;
-
-/**
- * Provide likely target addresses for VMware machines
- * @author eswartz
- *
- */
-public class VMwareTargetInterfaceAddressProvider extends
- LocalhostTargetInterfaceAddressProvider {
-
- /* (non-Javadoc)
- * @see org.maemo.esbox.internal.api.vm.ui.preferences.LocalhostTargetInterfaceAddressProvider#addCustomAddresses(java.util.Set)
- */
- @Override
- protected void addCustomAddresses(Set<String> addrs) {
- // VMware usually (?) assigns .128 to the VMnet interfaces
- Map<String, InetAddress> vmNetAddresses = VMwareUtils.getVMNetMappings();
-
- for (InetAddress address : vmNetAddresses.values()) {
- address = VMwareUtils.convertToLikelyDHCPAddress(address);
- if (address != null) {
- addrs.add(address.getHostAddress());
- }
- }
-
- super.addCustomAddresses(addrs);
- }
-
-
-}
+/*******************************************************************************
+ * 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 java.net.InetAddress;
+import java.util.Map;
+import java.util.Set;
+
+import org.maemo.esbox.internal.api.vm.ui.preferences.LocalhostTargetInterfaceAddressProvider;
+
+/**
+ * Provide likely target addresses for VMware machines
+ * @author eswartz
+ *
+ */
+public class VMwareTargetInterfaceAddressProvider extends
+ LocalhostTargetInterfaceAddressProvider {
+
+ /* (non-Javadoc)
+ * @see org.maemo.esbox.internal.api.vm.ui.preferences.LocalhostTargetInterfaceAddressProvider#addCustomAddresses(java.util.Set)
+ */
+ @Override
+ protected void addCustomAddresses(Set<String> addrs) {
+ // VMware usually (?) assigns .128 to the VMnet interfaces
+ Map<String, InetAddress> vmNetAddresses = VMwareUtils.getVMNetMappings();
+
+ for (InetAddress address : vmNetAddresses.values()) {
+ address = VMwareUtils.convertToLikelyDHCPAddress(address);
+ if (address != null) {
+ addrs.add(address.getHostAddress());
+ }
+ }
+
+ super.addCustomAddresses(addrs);
+ }
+
+
+}
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
Modified: 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/VMwareUtils.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/VMwareUtils.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,226 +1,226 @@
-/*******************************************************************************
- * 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 java.io.File;
-import java.io.IOException;
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.net.UnknownHostException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.cdt.utils.WindowsRegistry;
-import org.eclipse.core.runtime.CoreException;
-
-import com.nokia.cpp.internal.api.utils.core.FileUtils;
-
-/**
- * Utilities for VMware network configuration
- * @author eswartz
- *
- */
-public class VMwareUtils {
- /** unknown product */
- public static String PRODUCT_UNKNOWN = "unknown";
- /** VMware Player */
- public static String PRODUCT_PLAYER = "player";
- /** VMware Fusion */
- public static String PRODUCT_FUSION = "fusion";
- /** VMware Workstation (note: value is special) */
- public static String PRODUCT_WORKSTATION = "ws";
- /** VMware Server (note: value is special) */
- public static String PRODUCT_SERVER = "server";
-
- public static String NETWORK_CONFIG_HOSTONLY = "hostonly";
- public static String NETWORK_CONFIG_NAT = "nat";
- public static String NETWORK_CONFIG_BRIDGED = "bridged";
-
- /**
- * Get the interface addresses of vmnet interfaces.
- * <p>
- * NOTE: we always scan these anew and don't cache them, since this can change at runtime.
- * @return non-<code>null</code> map of interface name (e.g. "vmnet0") to address
- */
- public static Map<String, InetAddress> getVMNetMappings() {
- Map<String, InetAddress> addresses = new HashMap<String, InetAddress>();
-
- Enumeration<NetworkInterface> networkInterface;
- try {
- networkInterface = NetworkInterface.getNetworkInterfaces();
-
- while (networkInterface.hasMoreElements()) {
- NetworkInterface n = networkInterface.nextElement();
- if (n.getName().toLowerCase().matches("vmnet\\d+")) {
- Enumeration<InetAddress> interfaceAddr = n.getInetAddresses();
- while (interfaceAddr.hasMoreElements()) {
- InetAddress address = interfaceAddr.nextElement();
- addresses.put(n.getName(), address);
- }
- }
- }
- } catch (SocketException e) {
- }
-
- // On Windows, be more direct. Java can't seem to find this stuff.
- WindowsRegistry registry = WindowsRegistry.getRegistry();
- if (registry != null) {
- String baseKey = "SOFTWARE\\VMware, Inc.\\VMnetLib\\VMnetConfig\\vmnet";
- for (int iface = 1; iface <= 9; iface++) {
- String value = registry.getLocalMachineValue(baseKey + iface, "IPSubnetAddress");
- if (value != null) {
- try {
- InetAddress address = InetAddress.getByName(value);
-
- address = convertToLikelyInterfaceAddress(address);
- if (address != null) {
- addresses.put("vmnet" + iface, address);
- }
- } catch (UnknownHostException e) {
- Activator.getErrorLogger().logError("Failed to resolve VMnet address", e);
- }
- }
- }
- }
-
- return addresses;
- }
-
- private static final Pattern VMX_VARIABLE = Pattern.compile("\\s*(\\S+)\\s*=\\s*\"(.*)\"");
- public static Map<String, String> readVMXFile(String vmx) throws CoreException {
- if (!vmx.toLowerCase().endsWith(".vmx"))
- throw new CoreException(Activator.createErrorStatus("This does not look like a VMX file: " + vmx, null));
-
- String text = new String(FileUtils.readFileContents(new File(vmx), null));
- String[] lines = text.split("(\r\n|\r|\n)");
- Map<String, String> settings = new LinkedHashMap<String, String>();
- for (String line : lines) {
- Matcher matcher = VMX_VARIABLE.matcher(line);
- if (matcher.matches()) {
- settings.put(matcher.group(1), matcher.group(2));
- }
- }
- return settings;
- }
-
- /**
- * Get the first network configuration
- * @param vmxSettings
- * @return String, {@value #NETWORK_CONFIG_BRIDGED}, {@value #NETWORK_CONFIG_HOSTONLY}, {@value #NETWORK_CONFIG_NAT}
- */
- public static String getNetworkConfig(Map<String, String> vmxSettings) {
- for (Map.Entry<String, String> entry : vmxSettings.entrySet()) {
- if (entry.getKey().matches("ethernet.*\\.connectionType")) {
- return entry.getValue();
- }
- }
- return null;
- }
-
- /**
- * Convert a subnet or host interface address to the one likely to
- * be assigned to a VM.
- * @param address
- * @return new or same address, or <code>null</code> if a determination could not be made
- */
- public static InetAddress convertToLikelyDHCPAddress(InetAddress address) {
- if (address instanceof Inet4Address) {
- byte[] addr = address.getAddress();
-
-
- try {
- for (int last = 131; last > 128; last--) {
- addr[3] = (byte) last;
- InetAddress candidate = InetAddress.getByAddress(addr);
- try {
- if (candidate.isReachable(100)) {
- return candidate;
- }
- } catch (IOException e) {
- // nope
- }
- }
-
- // default
- addr[3] = (byte)128;
-
- return Inet4Address.getByAddress(addr);
-
- } catch (UnknownHostException e) {
- // should not happen
- return null;
- }
- }
- return null;
- }
-
- /**
- * Convert the network address to the likely interface address
- * @param address
- * @return new or same address, or <code>null</code> if we can't tell
- */
- public static InetAddress convertToLikelyInterfaceAddress(InetAddress address) {
- // the registry addr ends in 0, repair to 1
- byte[] addrBytes = address.getAddress();
- if (addrBytes.length == 4) {
- try {
- InetAddress candidate;
-
- addrBytes[3] = 2;
- candidate = InetAddress.getByAddress(addrBytes);
- try {
- if (candidate.isReachable(100)) {
- return candidate;
- }
- } catch (IOException e) {
- // nope
- }
-
- // just default to this
- addrBytes[3] = 1;
- candidate = InetAddress.getByAddress(addrBytes);
-
- return candidate;
- } catch (UnknownHostException e) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * Guess the product enumerator (PRODUCT_xxx) from the executable path
- * to VMware.
- * @param exePath
- * @return one of PRODUCT_xxx (PRODUCT_UNKNOWN as last resort)
- */
- public static String guessProductFromPath(String exePath) {
- if (exePath == null)
- return PRODUCT_UNKNOWN;
- String lower = exePath.toLowerCase();
- if (lower.contains("player"))
- return PRODUCT_PLAYER;
- if (lower.contains("server"))
- return PRODUCT_SERVER;
- if (lower.contains("workstation"))
- return PRODUCT_WORKSTATION;
- if (lower.contains("fusion"))
- return PRODUCT_FUSION;
- return PRODUCT_UNKNOWN;
- }
-}
+/*******************************************************************************
+ * 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 java.io.File;
+import java.io.IOException;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.cdt.utils.WindowsRegistry;
+import org.eclipse.core.runtime.CoreException;
+
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+
+/**
+ * Utilities for VMware network configuration
+ * @author eswartz
+ *
+ */
+public class VMwareUtils {
+ /** unknown product */
+ public static String PRODUCT_UNKNOWN = "unknown";
+ /** VMware Player */
+ public static String PRODUCT_PLAYER = "player";
+ /** VMware Fusion */
+ public static String PRODUCT_FUSION = "fusion";
+ /** VMware Workstation (note: value is special) */
+ public static String PRODUCT_WORKSTATION = "ws";
+ /** VMware Server (note: value is special) */
+ public static String PRODUCT_SERVER = "server";
+
+ public static String NETWORK_CONFIG_HOSTONLY = "hostonly";
+ public static String NETWORK_CONFIG_NAT = "nat";
+ public static String NETWORK_CONFIG_BRIDGED = "bridged";
+
+ /**
+ * Get the interface addresses of vmnet interfaces.
+ * <p>
+ * NOTE: we always scan these anew and don't cache them, since this can change at runtime.
+ * @return non-<code>null</code> map of interface name (e.g. "vmnet0") to address
+ */
+ public static Map<String, InetAddress> getVMNetMappings() {
+ Map<String, InetAddress> addresses = new HashMap<String, InetAddress>();
+
+ Enumeration<NetworkInterface> networkInterface;
+ try {
+ networkInterface = NetworkInterface.getNetworkInterfaces();
+
+ while (networkInterface.hasMoreElements()) {
+ NetworkInterface n = networkInterface.nextElement();
+ if (n.getName().toLowerCase().matches("vmnet\\d+")) {
+ Enumeration<InetAddress> interfaceAddr = n.getInetAddresses();
+ while (interfaceAddr.hasMoreElements()) {
+ InetAddress address = interfaceAddr.nextElement();
+ addresses.put(n.getName(), address);
+ }
+ }
+ }
+ } catch (SocketException e) {
+ }
+
+ // On Windows, be more direct. Java can't seem to find this stuff.
+ WindowsRegistry registry = WindowsRegistry.getRegistry();
+ if (registry != null) {
+ String baseKey = "SOFTWARE\\VMware, Inc.\\VMnetLib\\VMnetConfig\\vmnet";
+ for (int iface = 1; iface <= 9; iface++) {
+ String value = registry.getLocalMachineValue(baseKey + iface, "IPSubnetAddress");
+ if (value != null) {
+ try {
+ InetAddress address = InetAddress.getByName(value);
+
+ address = convertToLikelyInterfaceAddress(address);
+ if (address != null) {
+ addresses.put("vmnet" + iface, address);
+ }
+ } catch (UnknownHostException e) {
+ Activator.getErrorLogger().logError("Failed to resolve VMnet address", e);
+ }
+ }
+ }
+ }
+
+ return addresses;
+ }
+
+ private static final Pattern VMX_VARIABLE = Pattern.compile("\\s*(\\S+)\\s*=\\s*\"(.*)\"");
+ public static Map<String, String> readVMXFile(String vmx) throws CoreException {
+ if (!vmx.toLowerCase().endsWith(".vmx"))
+ throw new CoreException(Activator.createErrorStatus("This does not look like a VMX file: " + vmx, null));
+
+ String text = new String(FileUtils.readFileContents(new File(vmx), null));
+ String[] lines = text.split("(\r\n|\r|\n)");
+ Map<String, String> settings = new LinkedHashMap<String, String>();
+ for (String line : lines) {
+ Matcher matcher = VMX_VARIABLE.matcher(line);
+ if (matcher.matches()) {
+ settings.put(matcher.group(1), matcher.group(2));
+ }
+ }
+ return settings;
+ }
+
+ /**
+ * Get the first network configuration
+ * @param vmxSettings
+ * @return String, {@value #NETWORK_CONFIG_BRIDGED}, {@value #NETWORK_CONFIG_HOSTONLY}, {@value #NETWORK_CONFIG_NAT}
+ */
+ public static String getNetworkConfig(Map<String, String> vmxSettings) {
+ for (Map.Entry<String, String> entry : vmxSettings.entrySet()) {
+ if (entry.getKey().matches("ethernet.*\\.connectionType")) {
+ return entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Convert a subnet or host interface address to the one likely to
+ * be assigned to a VM.
+ * @param address
+ * @return new or same address, or <code>null</code> if a determination could not be made
+ */
+ public static InetAddress convertToLikelyDHCPAddress(InetAddress address) {
+ if (address instanceof Inet4Address) {
+ byte[] addr = address.getAddress();
+
+
+ try {
+ for (int last = 131; last > 128; last--) {
+ addr[3] = (byte) last;
+ InetAddress candidate = InetAddress.getByAddress(addr);
+ try {
+ if (candidate.isReachable(100)) {
+ return candidate;
+ }
+ } catch (IOException e) {
+ // nope
+ }
+ }
+
+ // default
+ addr[3] = (byte)128;
+
+ return Inet4Address.getByAddress(addr);
+
+ } catch (UnknownHostException e) {
+ // should not happen
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Convert the network address to the likely interface address
+ * @param address
+ * @return new or same address, or <code>null</code> if we can't tell
+ */
+ public static InetAddress convertToLikelyInterfaceAddress(InetAddress address) {
+ // the registry addr ends in 0, repair to 1
+ byte[] addrBytes = address.getAddress();
+ if (addrBytes.length == 4) {
+ try {
+ InetAddress candidate;
+
+ addrBytes[3] = 2;
+ candidate = InetAddress.getByAddress(addrBytes);
+ try {
+ if (candidate.isReachable(100)) {
+ return candidate;
+ }
+ } catch (IOException e) {
+ // nope
+ }
+
+ // just default to this
+ addrBytes[3] = 1;
+ candidate = InetAddress.getByAddress(addrBytes);
+
+ return candidate;
+ } catch (UnknownHostException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Guess the product enumerator (PRODUCT_xxx) from the executable path
+ * to VMware.
+ * @param exePath
+ * @return one of PRODUCT_xxx (PRODUCT_UNKNOWN as last resort)
+ */
+ public static String guessProductFromPath(String exePath) {
+ if (exePath == null)
+ return PRODUCT_UNKNOWN;
+ String lower = exePath.toLowerCase();
+ if (lower.contains("player"))
+ return PRODUCT_PLAYER;
+ if (lower.contains("server"))
+ return PRODUCT_SERVER;
+ if (lower.contains("workstation"))
+ return PRODUCT_WORKSTATION;
+ if (lower.contains("fusion"))
+ return PRODUCT_FUSION;
+ return PRODUCT_UNKNOWN;
+ }
+}
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
Modified: 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/MaemoSDKVMConfigurationWizardPage.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMConfigurationWizardPage.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,336 +1,336 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-
-/**
- * This page displays information about Maemo SDK virtual machine configuration.
- *
- * @author raulherbster
- *
- */
-public class MaemoSDKVMConfigurationWizardPage extends WizardPage {
-
- private Button installEverything;
-
- private Label mainMessage;
-
- // installation details area
- private Group installationDetailsGroup;
- private Button installScratchbox;
- private Button installScratchboxTargets;
-
- // programming environment area
- private Group programmingEnvGroup;
- private Button installCPPEnv;
- private Button installPythonEnv;
-
- /**
- * Constructor.
- *
- * @param wizard
- * parent wizard.
- */
- protected MaemoSDKVMConfigurationWizardPage(NewMaemoSDKVMWizard wizard) {
- super("maemovm_postdonwload", "Maemo SDK Virtual Image Configuration",
- Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
- setDescription("Select configuration options for Maemo SDK Virtual Image.");
- setWizard(wizard);
- setPageComplete(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
- * .Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayoutFactory.fillDefaults().numColumns(1).applyTo(composite);
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
- setControl(composite);
-
- mainMessage = new Label(composite, SWT.WRAP);
- mainMessage.setText("");
- GridData labelData = new GridData();
- labelData.horizontalSpan = 2;
- 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(1, 1).align(SWT.LEFT, SWT.CENTER)
- .applyTo(separator);
-
- installEverything = createButton(composite, SWT.CHECK,
- "Install complete Maemo SDK programming environment");
- GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
- .applyTo(installEverything);
- installEverything
- .setToolTipText("If checked, install the complete Maemo SDK programming environment on virtual image");
- installEverything.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent evt) {
- boolean isInstallEverythingSelected = installEverything
- .getSelection();
- setInstallationDetailsButtonsSelection(isInstallEverythingSelected);
- setInstallationDetailsGroupEnabled(!isInstallEverythingSelected);
- setProgrammingEnvButtonsSelection(isInstallEverythingSelected);
- setProgrammignEnvGroupEnabled(!isInstallEverythingSelected);
- updateInstallData();
- }
-
- });
-
- createInstallationDetailsArea(composite);
-
- createProgrammingEnvironmentArea(composite);
-
- }
-
- /**
- * Create contents of installation options area.
- *
- * @param composite
- * parent composite.
- */
- private void createInstallationDetailsArea(Composite composite) {
- installationDetailsGroup = new Group(composite, SWT.NONE);
- installationDetailsGroup.setText("Installation Details");
- installationDetailsGroup.setLayoutData(new GridData(
- GridData.FILL_HORIZONTAL));
- installationDetailsGroup.setLayout(new GridLayout(1, false));
- GridDataFactory.fillDefaults().grab(true, false).applyTo(
- installationDetailsGroup);
-
- installScratchbox = createButton(installationDetailsGroup, SWT.RADIO,
- "Install Scratchbox");
- GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
- .applyTo(installScratchbox);
- installScratchbox
- .setToolTipText("If checked, the wizard to install Scratchbox 1 is launched");
- installScratchbox.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateInstallData();
- }
-
- });
-
- installScratchboxTargets = createButton(installationDetailsGroup,
- SWT.RADIO, "Install Scratchbox and Maemo SDK targets");
- GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
- .applyTo(installScratchboxTargets);
- installScratchboxTargets
- .setToolTipText("If checked, the wizard to install Scratchbox 1 targets is launched");
- installScratchboxTargets.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateInstallData();
- }
-
- });
- }
-
- /**
- * Create contents of programming environment contents area.
- *
- * @param composite
- * parent composite.
- */
- private void createProgrammingEnvironmentArea(Composite composite) {
- programmingEnvGroup = new Group(composite, SWT.NONE);
- programmingEnvGroup.setText("Programming Environments");
- programmingEnvGroup
- .setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- programmingEnvGroup.setLayout(new GridLayout(1, false));
- GridDataFactory.fillDefaults().grab(true, false).applyTo(
- programmingEnvGroup);
-
- installCPPEnv = createButton(programmingEnvGroup, SWT.CHECK,
- "Install C/C++ programming environment");
- GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
- .applyTo(installCPPEnv);
- installCPPEnv
- .setToolTipText("If checked, install C/C++ programming environment (maemo-c-debug-tools and maemo-debug-scripts and cplusplus-env)");
- installCPPEnv.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
- updateInstallData();
- }
-
- });
-
- installPythonEnv = createButton(programmingEnvGroup, SWT.CHECK,
- "Install Python programming environment");
- GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
- .applyTo(installPythonEnv);
- installPythonEnv
- .setToolTipText("If checked, install Python programming environment (maemo-python-env)");
- installPythonEnv.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
- updateInstallData();
- }
-
- });
- }
-
- /**
- * Utility method to create a button.
- *
- * @param composite
- * the parent composite.
- * @param style
- * the style of the button.
- * @param text
- * the button text.
- * @return
- */
- private Button createButton(Composite composite, int style, String text) {
- Button button = new Button(composite, style);
- button.setText(text);
- return button;
- }
-
- /**
- * Set selection of all buttons of details area.
- *
- * @param isSelected
- */
- private void setInstallationDetailsButtonsSelection(boolean isSelected) {
- installScratchboxTargets.setSelection(isSelected);
- if (isSelected) {
- installScratchbox.setSelection(!isSelected);
- }
-
- }
-
- /**
- * Set selection of all buttons of programming environment area.
- *
- * @param isSelected
- */
- private void setProgrammingEnvButtonsSelection(boolean isSelected) {
- installCPPEnv.setSelection(isSelected);
- installPythonEnv.setSelection(isSelected);
- }
-
- /**
- * Set select of installation details group if programming env is goind to be installed.
- *
- * @param isSelected
- */
- private void setButtonsForProgrammingEnvSelection(boolean isSelected) {
- setInstallationDetailsGroupEnabled(!isSelected);
- setInstallationDetailsButtonsSelection(isSelected);
- }
-
- /**
- * Set enablement of all buttons of details area.
- *
- * @param isEnabled
- */
- private void setInstallationDetailsGroupEnabled(boolean isEnabled) {
- installationDetailsGroup.setEnabled(isEnabled);
- }
-
- /**
- * Set enablement of all buttons of programming environment area.
- *
- * @param isEnabled
- */
- private void setProgrammignEnvGroupEnabled(boolean isEnabled) {
- programmingEnvGroup.setEnabled(isEnabled);
- }
-
- /**
- * Update installation data based on selections of buttons.
- */
- private void updateInstallData() {
- MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard) getWizard())
- .getInstallData();
- installData.setInstallCppEnv(installCPPEnv.getSelection());
- installData.setInstallPythonEnv(installPythonEnv.getSelection());
- installData.setInstallTargets(installScratchboxTargets.getSelection() || installCPPEnv.getSelection() ||
- installPythonEnv.getSelection());
- installData.setInstallSbox(installScratchbox.getSelection() || installScratchboxTargets.getSelection());
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- setValues();
- }
-
- /**
- * Update main message area.
- */
- private void updateMainMessage() {
- MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard)getWizard()).getInstallData();
- String message = "";
- if (installData.canUsePreviousInstallation())
- message = "You just selected a previously downloaded virtual image to be installed on your machine. Default values for virtual images with Ubuntu Server are considered in this case.";
- else {
- String imageName = installData.getFileToDownload().getDescriptor().getName();
- message = "You just selected virtual image ''" + imageName + "'' to be installed on your machine.";
- }
- message += " Please, select the following options in order to properly configure your Maemo SDK virtual machine.";
- mainMessage.setText(message);
- ((Composite)getControl()).layout();
- }
-
- /**
- * Set default values based on virtual image.
- */
- private void setValues() {
- MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard)getWizard()).getInstallData();
-
- // if use previous installation, it takes Server default values
- boolean isServer = true;
- if (!installData.canUsePreviousInstallation())
- isServer = ((NewMaemoSDKVMWizard)getWizard()).getInstallData().getFileToDownload().getDescriptor().isServerImage();
-
- installEverything.setSelection(isServer);
- setInstallationDetailsButtonsSelection(isServer);
- setInstallationDetailsGroupEnabled(false);
- setProgrammingEnvButtonsSelection(true);
- setProgrammignEnvGroupEnabled(false);
-
- updateMainMessage();
-
- updateInstallData();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+
+/**
+ * This page displays information about Maemo SDK virtual machine configuration.
+ *
+ * @author raulherbster
+ *
+ */
+public class MaemoSDKVMConfigurationWizardPage extends WizardPage {
+
+ private Button installEverything;
+
+ private Label mainMessage;
+
+ // installation details area
+ private Group installationDetailsGroup;
+ private Button installScratchbox;
+ private Button installScratchboxTargets;
+
+ // programming environment area
+ private Group programmingEnvGroup;
+ private Button installCPPEnv;
+ private Button installPythonEnv;
+
+ /**
+ * Constructor.
+ *
+ * @param wizard
+ * parent wizard.
+ */
+ protected MaemoSDKVMConfigurationWizardPage(NewMaemoSDKVMWizard wizard) {
+ super("maemovm_postdonwload", "Maemo SDK Virtual Image Configuration",
+ Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
+ setDescription("Select configuration options for Maemo SDK Virtual Image.");
+ setWizard(wizard);
+ setPageComplete(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+ * .Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(1).applyTo(composite);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+ setControl(composite);
+
+ mainMessage = new Label(composite, SWT.WRAP);
+ mainMessage.setText("");
+ GridData labelData = new GridData();
+ labelData.horizontalSpan = 2;
+ 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(1, 1).align(SWT.LEFT, SWT.CENTER)
+ .applyTo(separator);
+
+ installEverything = createButton(composite, SWT.CHECK,
+ "Install complete Maemo SDK programming environment");
+ GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+ .applyTo(installEverything);
+ installEverything
+ .setToolTipText("If checked, install the complete Maemo SDK programming environment on virtual image");
+ installEverything.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent evt) {
+ boolean isInstallEverythingSelected = installEverything
+ .getSelection();
+ setInstallationDetailsButtonsSelection(isInstallEverythingSelected);
+ setInstallationDetailsGroupEnabled(!isInstallEverythingSelected);
+ setProgrammingEnvButtonsSelection(isInstallEverythingSelected);
+ setProgrammignEnvGroupEnabled(!isInstallEverythingSelected);
+ updateInstallData();
+ }
+
+ });
+
+ createInstallationDetailsArea(composite);
+
+ createProgrammingEnvironmentArea(composite);
+
+ }
+
+ /**
+ * Create contents of installation options area.
+ *
+ * @param composite
+ * parent composite.
+ */
+ private void createInstallationDetailsArea(Composite composite) {
+ installationDetailsGroup = new Group(composite, SWT.NONE);
+ installationDetailsGroup.setText("Installation Details");
+ installationDetailsGroup.setLayoutData(new GridData(
+ GridData.FILL_HORIZONTAL));
+ installationDetailsGroup.setLayout(new GridLayout(1, false));
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(
+ installationDetailsGroup);
+
+ installScratchbox = createButton(installationDetailsGroup, SWT.RADIO,
+ "Install Scratchbox");
+ GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+ .applyTo(installScratchbox);
+ installScratchbox
+ .setToolTipText("If checked, the wizard to install Scratchbox 1 is launched");
+ installScratchbox.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateInstallData();
+ }
+
+ });
+
+ installScratchboxTargets = createButton(installationDetailsGroup,
+ SWT.RADIO, "Install Scratchbox and Maemo SDK targets");
+ GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+ .applyTo(installScratchboxTargets);
+ installScratchboxTargets
+ .setToolTipText("If checked, the wizard to install Scratchbox 1 targets is launched");
+ installScratchboxTargets.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateInstallData();
+ }
+
+ });
+ }
+
+ /**
+ * Create contents of programming environment contents area.
+ *
+ * @param composite
+ * parent composite.
+ */
+ private void createProgrammingEnvironmentArea(Composite composite) {
+ programmingEnvGroup = new Group(composite, SWT.NONE);
+ programmingEnvGroup.setText("Programming Environments");
+ programmingEnvGroup
+ .setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ programmingEnvGroup.setLayout(new GridLayout(1, false));
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(
+ programmingEnvGroup);
+
+ installCPPEnv = createButton(programmingEnvGroup, SWT.CHECK,
+ "Install C/C++ programming environment");
+ GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+ .applyTo(installCPPEnv);
+ installCPPEnv
+ .setToolTipText("If checked, install C/C++ programming environment (maemo-c-debug-tools and maemo-debug-scripts and cplusplus-env)");
+ installCPPEnv.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
+ updateInstallData();
+ }
+
+ });
+
+ installPythonEnv = createButton(programmingEnvGroup, SWT.CHECK,
+ "Install Python programming environment");
+ GridDataFactory.swtDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER)
+ .applyTo(installPythonEnv);
+ installPythonEnv
+ .setToolTipText("If checked, install Python programming environment (maemo-python-env)");
+ installPythonEnv.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setButtonsForProgrammingEnvSelection(installCPPEnv.getSelection() || installPythonEnv.getSelection());
+ updateInstallData();
+ }
+
+ });
+ }
+
+ /**
+ * Utility method to create a button.
+ *
+ * @param composite
+ * the parent composite.
+ * @param style
+ * the style of the button.
+ * @param text
+ * the button text.
+ * @return
+ */
+ private Button createButton(Composite composite, int style, String text) {
+ Button button = new Button(composite, style);
+ button.setText(text);
+ return button;
+ }
+
+ /**
+ * Set selection of all buttons of details area.
+ *
+ * @param isSelected
+ */
+ private void setInstallationDetailsButtonsSelection(boolean isSelected) {
+ installScratchboxTargets.setSelection(isSelected);
+ if (isSelected) {
+ installScratchbox.setSelection(!isSelected);
+ }
+
+ }
+
+ /**
+ * Set selection of all buttons of programming environment area.
+ *
+ * @param isSelected
+ */
+ private void setProgrammingEnvButtonsSelection(boolean isSelected) {
+ installCPPEnv.setSelection(isSelected);
+ installPythonEnv.setSelection(isSelected);
+ }
+
+ /**
+ * Set select of installation details group if programming env is goind to be installed.
+ *
+ * @param isSelected
+ */
+ private void setButtonsForProgrammingEnvSelection(boolean isSelected) {
+ setInstallationDetailsGroupEnabled(!isSelected);
+ setInstallationDetailsButtonsSelection(isSelected);
+ }
+
+ /**
+ * Set enablement of all buttons of details area.
+ *
+ * @param isEnabled
+ */
+ private void setInstallationDetailsGroupEnabled(boolean isEnabled) {
+ installationDetailsGroup.setEnabled(isEnabled);
+ }
+
+ /**
+ * Set enablement of all buttons of programming environment area.
+ *
+ * @param isEnabled
+ */
+ private void setProgrammignEnvGroupEnabled(boolean isEnabled) {
+ programmingEnvGroup.setEnabled(isEnabled);
+ }
+
+ /**
+ * Update installation data based on selections of buttons.
+ */
+ private void updateInstallData() {
+ MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard) getWizard())
+ .getInstallData();
+ installData.setInstallCppEnv(installCPPEnv.getSelection());
+ installData.setInstallPythonEnv(installPythonEnv.getSelection());
+ installData.setInstallTargets(installScratchboxTargets.getSelection() || installCPPEnv.getSelection() ||
+ installPythonEnv.getSelection());
+ installData.setInstallSbox(installScratchbox.getSelection() || installScratchboxTargets.getSelection());
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ setValues();
+ }
+
+ /**
+ * Update main message area.
+ */
+ private void updateMainMessage() {
+ MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard)getWizard()).getInstallData();
+ String message = "";
+ if (installData.canUsePreviousInstallation())
+ message = "You just selected a previously downloaded virtual image to be installed on your machine. Default values for virtual images with Ubuntu Server are considered in this case.";
+ else {
+ String imageName = installData.getFileToDownload().getDescriptor().getName();
+ message = "You just selected virtual image ''" + imageName + "'' to be installed on your machine.";
+ }
+ message += " Please, select the following options in order to properly configure your Maemo SDK virtual machine.";
+ mainMessage.setText(message);
+ ((Composite)getControl()).layout();
+ }
+
+ /**
+ * Set default values based on virtual image.
+ */
+ private void setValues() {
+ MaemoSDKVMInstallData installData = ((NewMaemoSDKVMWizard)getWizard()).getInstallData();
+
+ // if use previous installation, it takes Server default values
+ boolean isServer = true;
+ if (!installData.canUsePreviousInstallation())
+ isServer = ((NewMaemoSDKVMWizard)getWizard()).getInstallData().getFileToDownload().getDescriptor().isServerImage();
+
+ installEverything.setSelection(isServer);
+ setInstallationDetailsButtonsSelection(isServer);
+ setInstallationDetailsGroupEnabled(false);
+ setProgrammingEnvButtonsSelection(true);
+ setProgrammignEnvGroupEnabled(false);
+
+ updateMainMessage();
+
+ updateInstallData();
+ }
+
+}
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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallData.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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
Modified: 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/MaemoSDKVMInstallationWorkPage.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallationWorkPage.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.maemo.mica.common.ui.TimeoutUI;
-import org.maemo.mica.internal.api.common.ui.wizards.WizardWorkProgressPageBase;
-
-/**
- * Work page for Maemo SDK virtual image installer.
- *
- * @author raulherbster
- *
- */
-public class MaemoSDKVMInstallationWorkPage extends WizardWorkProgressPageBase {
-
- private TimeoutUI timeoutUI;
-
- /**
- * Constructor.
- *
- * @param wizard
- * parent wizard
- */
- public MaemoSDKVMInstallationWorkPage(NewMaemoSDKVMWizard wizard) {
- super(
- "Install Maemo SDK Virtual Image",
- "This page shows the installation process. Before finishing, configure the settings and verify your network preferences.");
- timeoutUI = new TimeoutUI();
- timeoutUI.setTimeout(30);
- setWizard(wizard);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.WizardPage#getWizard()
- */
- @Override
- public NewMaemoSDKVMWizard getWizard() {
- return (NewMaemoSDKVMWizard) super.getWizard();
- }
-
- /**
- * @return the timeout in seconds
- */
- public int getTimeout() {
- return timeoutUI.getTimeout();
- }
-
- /**
- * @param timeout
- * the timeout to set in seconds
- */
- public void setTimeout(int timeout) {
- timeoutUI.setTimeout(timeout);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.maemo.mica.common.ui.wizards.WizardWorkProgressPageBase#
- * addControlsBelowProgress(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected void addControlsBelowProgress(Composite body) {
- Composite options = new Composite(body, SWT.NONE);
- options.setLayout(new GridLayout(2, true));
- GridDataFactory.fillDefaults().grab(true, false).applyTo(options);
-
- Composite timeoutBlock = timeoutUI.createUI(options, SWT.NONE);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(timeoutBlock);
-
- addStockNetworkSettingHyperlink(body);
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.mica.common.ui.TimeoutUI;
+import org.maemo.mica.internal.api.common.ui.wizards.WizardWorkProgressPageBase;
+
+/**
+ * Work page for Maemo SDK virtual image installer.
+ *
+ * @author raulherbster
+ *
+ */
+public class MaemoSDKVMInstallationWorkPage extends WizardWorkProgressPageBase {
+
+ private TimeoutUI timeoutUI;
+
+ /**
+ * Constructor.
+ *
+ * @param wizard
+ * parent wizard
+ */
+ public MaemoSDKVMInstallationWorkPage(NewMaemoSDKVMWizard wizard) {
+ super(
+ "Install Maemo SDK Virtual Image",
+ "This page shows the installation process. Before finishing, configure the settings and verify your network preferences.");
+ timeoutUI = new TimeoutUI();
+ timeoutUI.setTimeout(30);
+ setWizard(wizard);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#getWizard()
+ */
+ @Override
+ public NewMaemoSDKVMWizard getWizard() {
+ return (NewMaemoSDKVMWizard) super.getWizard();
+ }
+
+ /**
+ * @return the timeout in seconds
+ */
+ public int getTimeout() {
+ return timeoutUI.getTimeout();
+ }
+
+ /**
+ * @param timeout
+ * the timeout to set in seconds
+ */
+ public void setTimeout(int timeout) {
+ timeoutUI.setTimeout(timeout);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.maemo.mica.common.ui.wizards.WizardWorkProgressPageBase#
+ * addControlsBelowProgress(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void addControlsBelowProgress(Composite body) {
+ Composite options = new Composite(body, SWT.NONE);
+ options.setLayout(new GridLayout(2, true));
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(options);
+
+ Composite timeoutBlock = timeoutUI.createUI(options, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(timeoutBlock);
+
+ addStockNetworkSettingHyperlink(body);
+
+ }
+
+}
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
Modified: 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/MaemoSDKVMInstallerContentLabelProvider.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMInstallerContentLabelProvider.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,271 +1,271 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.swt.graphics.Image;
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMDescription;
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-import org.maemo.mica.internal.api.common.ui.LazyLoadingThreadTableContentProvider;
-
-import com.nokia.cpp.internal.api.utils.core.FileUtils;
-
-/**
- * Content and label provider for table that shows available Maemo SDK virtual
- * images.
- *
- * @author raulherbster
- *
- */
-public class MaemoSDKVMInstallerContentLabelProvider extends
- LazyLoadingThreadTableContentProvider {
-
- /**
- * Thread to access information about available Maemo SDK virtual images on
- * website.
- *
- * @author raulherbster
- *
- */
- protected class MaemoVMInstallScriptFetcherThread extends Thread {
- protected Object newInput;
-
- /**
- * Construtor.
- *
- * @param newInput
- */
- public MaemoVMInstallScriptFetcherThread(Object newInput) {
- this.newInput = newInput;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Thread#run()
- */
- public void run() {
- doFetchScripts();
-
- contents.remove(LOADING_LABEL);
- doFireContentChanged();
- }
-
- /**
- * Implement by querying the input and/or calling fetchScriptsFromUrl()
- * and adding them to contents.
- */
- protected void doFetchScripts() {
- List<MaemoSDKVMDescription> virtualImagesNames = fetchVMNamesFromUrl(MaemoSDKVMInfo.DOWNLOAD_PAGE);
- for (MaemoSDKVMDescription maemoSDKVM : virtualImagesNames) {
- MaemoSDKVMInfo downloadFile = new MaemoSDKVMInfo();
- downloadFile.setDescriptor(maemoSDKVM);
- if (!contents.contains(downloadFile))
- contents.add(downloadFile);
- else {
- int indexOfExistingDownloadFile = contents
- .indexOf(downloadFile);
- MaemoSDKVMInfo info = ((MaemoSDKVMInfo) contents.get(indexOfExistingDownloadFile));
- info.setNumberOfParts(info.getNumParts() +1);
- }
- }
- }
-
- /**
- * Get available Maemo SDK virtual image from given URL.
- *
- * @param urlString
- * the url of website that contains information about
- * available Maemo SDK virtual images.
- * @return a list with the names of available Maemo SDK virtual images.
- */
- protected List<MaemoSDKVMDescription> fetchVMNamesFromUrl(String urlString) {
- URL url;
- try {
- url = new URL(urlString);
- } catch (MalformedURLException e) {
- Activator.getErrorLogger().logAndShowError(
- "Invalid URL: " + urlString, e);
- return Collections.emptyList();
- }
-
- List<MaemoSDKVMDescription> virtualImagesDescriptors = new ArrayList<MaemoSDKVMDescription>();
- try {
-
- URLConnection connection = url.openConnection();
- connection.setConnectTimeout(1000 * 10);
- connection.connect();
-
- // apparently this fetches the HTML...
- String content = new String(FileUtils.readInputStreamContents(
- connection.getInputStream(), "UTF-8"));
-
- /*
- * The names of virtual images are on
- * http://tablets-dev.nokia.com/maemo-dev-env-downloads.php
- * (front-page). Basically, they list have the following format:
- * Maemo ANY_WORD Virtual ANY_WORD Image ANY_WORD Also, we
- * filter duplicated entries, for example, files split into two
- * parts.
- */
- String license = getLicense(content);
-
- Pattern maemoVMPattern = Pattern
- .compile("Maemo(\\s)+SDK(\\s)+Virtual(\\s)+Image(\\s)+with(\\s)+Ubuntu(\\s)+(\\w)+(\\s)+([\\d]*\\.[\\d]*)(\\s)+(Server|Desktop)(\\s\\-(Part)\\s\\d)?");
- Matcher matcher = maemoVMPattern.matcher(content);
- while (matcher.find()) {
- String virtualImageName = matcher.group(0);
- String version = matcher.group(9);
- virtualImageName = processVirtualImageName(virtualImageName);
- boolean isServer = virtualImageName.toLowerCase().contains("server");
- String virtualImageDescription = isServer ? MaemoSDKVMDescription.SERVER_IMAGE_DESCRIPTION : MaemoSDKVMDescription.DESKTOP_IMAGE_DESCRIPTION;
- virtualImagesDescriptors.add(new MaemoSDKVMDescription(isServer,virtualImageName,version,virtualImageDescription,license));
- }
- } catch (Exception e) {
- if (e instanceof InterruptedException)
- return virtualImagesDescriptors;
-
- if (!isInterrupted())
- Activator.getErrorLogger().logAndShowError(
- "Could not fetch listing from " + url, e);
- }
-
- return virtualImagesDescriptors;
- }
-
- /**
- * Process the description of Maemo SDK virtual image and only returns
- * the main description.
- *
- * @param virtualImageName
- * the complete description of a certain Maemo SDK virtual
- * image.
- * @return the main description of a certain Maemo SDK virtual image.
- */
- private String processVirtualImageName(String virtualImageName) {
- int indexOfPar = virtualImageName.indexOf("(");
- if (indexOfPar < 0)
- return virtualImageName;
- return virtualImageName.substring(0, indexOfPar).trim();
- }
-
- /**
- * Get license from virtual images website.
- * @param content
- * @return
- */
- private String getLicense(String content) {
- final String LICENSE_PATTERN = "IMPORTANT:\\s*READ\\s*CAREFULLY\\s*BEFORE\\s*INSTALLING,\\s*DOWNLOADING,\\s*OR\\s*USING\\s*THE\\s*SOFTWARE(.*?)PLEASE\\s*SUBMIT\\s*ANY\\s*ACCOMPANYING\\s*REGISTRATION\\s*FORMS\\s*TO\\s*RECEIVE\\s*REGISTRATION\\s*BENEFITS\\s*WHERE\\s*APPLICABLE";
- Pattern licensePattern = Pattern.compile(LICENSE_PATTERN,Pattern.DOTALL | Pattern.UNIX_LINES);
- Matcher matcher = licensePattern.matcher(content);
- String license = "";
- while (matcher.find()) {
- license = matcher.group(0);
- }
- return license;
- }
- }
-
- private Image vmImage;
-
- /**
- * Construtor.
- */
- public MaemoSDKVMInstallerContentLabelProvider() {
- super();
- vmImage = Activator.MAEMO_VM_DESCRIPTOR.createImage();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.maemo.mica.common.ui.common.LazyLoadingThreadTableContentProvider
- * #createContentFetchThread(java.lang.Object)
- */
- @Override
- protected Thread createContentFetchThread(Object newInput) {
- return new MaemoVMInstallScriptFetcherThread(newInput);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
- * Object)
- */
- public Object[] getChildren(Object parentElement) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
- * )
- */
- public Object getParent(Object element) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
- * Object)
- */
- public boolean hasChildren(Object element) {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- public String getColumnText(Object element, int column) {
- if (element == LOADING_LABEL)
- return super.getColumnText(element, column);
-
- if (element instanceof MaemoSDKVMInfo) {
- MaemoSDKVMInfo data = (MaemoSDKVMInfo) element;
- if (column == 0)
- return data.getDescriptor().getName();
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- public Image getColumnImage(Object element, int column) {
- if (element instanceof MaemoSDKVMInfo) {
- if (column == 0)
- return vmImage;
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.swt.graphics.Image;
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMDescription;
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMInfo;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+import org.maemo.mica.internal.api.common.ui.LazyLoadingThreadTableContentProvider;
+
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
+
+/**
+ * Content and label provider for table that shows available Maemo SDK virtual
+ * images.
+ *
+ * @author raulherbster
+ *
+ */
+public class MaemoSDKVMInstallerContentLabelProvider extends
+ LazyLoadingThreadTableContentProvider {
+
+ /**
+ * Thread to access information about available Maemo SDK virtual images on
+ * website.
+ *
+ * @author raulherbster
+ *
+ */
+ protected class MaemoVMInstallScriptFetcherThread extends Thread {
+ protected Object newInput;
+
+ /**
+ * Construtor.
+ *
+ * @param newInput
+ */
+ public MaemoVMInstallScriptFetcherThread(Object newInput) {
+ this.newInput = newInput;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Thread#run()
+ */
+ public void run() {
+ doFetchScripts();
+
+ contents.remove(LOADING_LABEL);
+ doFireContentChanged();
+ }
+
+ /**
+ * Implement by querying the input and/or calling fetchScriptsFromUrl()
+ * and adding them to contents.
+ */
+ protected void doFetchScripts() {
+ List<MaemoSDKVMDescription> virtualImagesNames = fetchVMNamesFromUrl(MaemoSDKVMInfo.DOWNLOAD_PAGE);
+ for (MaemoSDKVMDescription maemoSDKVM : virtualImagesNames) {
+ MaemoSDKVMInfo downloadFile = new MaemoSDKVMInfo();
+ downloadFile.setDescriptor(maemoSDKVM);
+ if (!contents.contains(downloadFile))
+ contents.add(downloadFile);
+ else {
+ int indexOfExistingDownloadFile = contents
+ .indexOf(downloadFile);
+ MaemoSDKVMInfo info = ((MaemoSDKVMInfo) contents.get(indexOfExistingDownloadFile));
+ info.setNumberOfParts(info.getNumParts() +1);
+ }
+ }
+ }
+
+ /**
+ * Get available Maemo SDK virtual image from given URL.
+ *
+ * @param urlString
+ * the url of website that contains information about
+ * available Maemo SDK virtual images.
+ * @return a list with the names of available Maemo SDK virtual images.
+ */
+ protected List<MaemoSDKVMDescription> fetchVMNamesFromUrl(String urlString) {
+ URL url;
+ try {
+ url = new URL(urlString);
+ } catch (MalformedURLException e) {
+ Activator.getErrorLogger().logAndShowError(
+ "Invalid URL: " + urlString, e);
+ return Collections.emptyList();
+ }
+
+ List<MaemoSDKVMDescription> virtualImagesDescriptors = new ArrayList<MaemoSDKVMDescription>();
+ try {
+
+ URLConnection connection = url.openConnection();
+ connection.setConnectTimeout(1000 * 10);
+ connection.connect();
+
+ // apparently this fetches the HTML...
+ String content = new String(FileUtils.readInputStreamContents(
+ connection.getInputStream(), "UTF-8"));
+
+ /*
+ * The names of virtual images are on
+ * http://tablets-dev.nokia.com/maemo-dev-env-downloads.php
+ * (front-page). Basically, they list have the following format:
+ * Maemo ANY_WORD Virtual ANY_WORD Image ANY_WORD Also, we
+ * filter duplicated entries, for example, files split into two
+ * parts.
+ */
+ String license = getLicense(content);
+
+ Pattern maemoVMPattern = Pattern
+ .compile("Maemo(\\s)+SDK(\\s)+Virtual(\\s)+Image(\\s)+with(\\s)+Ubuntu(\\s)+(\\w)+(\\s)+([\\d]*\\.[\\d]*)(\\s)+(Server|Desktop)(\\s\\-(Part)\\s\\d)?");
+ Matcher matcher = maemoVMPattern.matcher(content);
+ while (matcher.find()) {
+ String virtualImageName = matcher.group(0);
+ String version = matcher.group(9);
+ virtualImageName = processVirtualImageName(virtualImageName);
+ boolean isServer = virtualImageName.toLowerCase().contains("server");
+ String virtualImageDescription = isServer ? MaemoSDKVMDescription.SERVER_IMAGE_DESCRIPTION : MaemoSDKVMDescription.DESKTOP_IMAGE_DESCRIPTION;
+ virtualImagesDescriptors.add(new MaemoSDKVMDescription(isServer,virtualImageName,version,virtualImageDescription,license));
+ }
+ } catch (Exception e) {
+ if (e instanceof InterruptedException)
+ return virtualImagesDescriptors;
+
+ if (!isInterrupted())
+ Activator.getErrorLogger().logAndShowError(
+ "Could not fetch listing from " + url, e);
+ }
+
+ return virtualImagesDescriptors;
+ }
+
+ /**
+ * Process the description of Maemo SDK virtual image and only returns
+ * the main description.
+ *
+ * @param virtualImageName
+ * the complete description of a certain Maemo SDK virtual
+ * image.
+ * @return the main description of a certain Maemo SDK virtual image.
+ */
+ private String processVirtualImageName(String virtualImageName) {
+ int indexOfPar = virtualImageName.indexOf("(");
+ if (indexOfPar < 0)
+ return virtualImageName;
+ return virtualImageName.substring(0, indexOfPar).trim();
+ }
+
+ /**
+ * Get license from virtual images website.
+ * @param content
+ * @return
+ */
+ private String getLicense(String content) {
+ final String LICENSE_PATTERN = "IMPORTANT:\\s*READ\\s*CAREFULLY\\s*BEFORE\\s*INSTALLING,\\s*DOWNLOADING,\\s*OR\\s*USING\\s*THE\\s*SOFTWARE(.*?)PLEASE\\s*SUBMIT\\s*ANY\\s*ACCOMPANYING\\s*REGISTRATION\\s*FORMS\\s*TO\\s*RECEIVE\\s*REGISTRATION\\s*BENEFITS\\s*WHERE\\s*APPLICABLE";
+ Pattern licensePattern = Pattern.compile(LICENSE_PATTERN,Pattern.DOTALL | Pattern.UNIX_LINES);
+ Matcher matcher = licensePattern.matcher(content);
+ String license = "";
+ while (matcher.find()) {
+ license = matcher.group(0);
+ }
+ return license;
+ }
+ }
+
+ private Image vmImage;
+
+ /**
+ * Construtor.
+ */
+ public MaemoSDKVMInstallerContentLabelProvider() {
+ super();
+ vmImage = Activator.MAEMO_VM_DESCRIPTOR.createImage();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.maemo.mica.common.ui.common.LazyLoadingThreadTableContentProvider
+ * #createContentFetchThread(java.lang.Object)
+ */
+ @Override
+ protected Thread createContentFetchThread(Object newInput) {
+ return new MaemoVMInstallScriptFetcherThread(newInput);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
+ * Object)
+ */
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
+ * )
+ */
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
+ * Object)
+ */
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ public String getColumnText(Object element, int column) {
+ if (element == LOADING_LABEL)
+ return super.getColumnText(element, column);
+
+ if (element instanceof MaemoSDKVMInfo) {
+ MaemoSDKVMInfo data = (MaemoSDKVMInfo) element;
+ if (column == 0)
+ return data.getDescriptor().getName();
+ }
+ return "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getColumnImage(Object element, int column) {
+ if (element instanceof MaemoSDKVMInfo) {
+ if (column == 0)
+ return vmImage;
+ }
+ return null;
+ }
+
+}
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
Modified: 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/MaemoSDKVMLicenseWizardPage.java 2009-09-08 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMLicenseWizardPage.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raul Herbster (INdT) - initial API and implementation
- *******************************************************************************/
-package org.maemo.esbox.internal.vm.vmware.ui.wizards;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMDescription;
-import org.maemo.esbox.internal.vm.vmware.Activator;
-
-/**
- * Page that display license contents.
- *
- * @author raulherbster
- *
- */
-public class MaemoSDKVMLicenseWizardPage extends WizardPage {
-
- private Browser licenseText;
- private boolean licenseTermsAgreed = false;
- private boolean ok = false;
-
- /**
- * Constructor
- *
- * @param wizard
- * parent wizard.
- */
- protected MaemoSDKVMLicenseWizardPage(NewMaemoSDKVMWizard wizard) {
- super("maemovm_licensepage", "License",
- Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
- setWizard(wizard);
- ok = true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
- * .Composite)
- */
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(1, false);
- container.setLayout(layout);
- GridData licenseGridData = new GridData(GridData.BEGINNING
- | GridData.FILL_BOTH);
- licenseGridData.widthHint = 500;
- licenseGridData.heightHint = 300;
- licenseText = new Browser(container, SWT.BORDER | SWT.WRAP);
- licenseText.setLayoutData(licenseGridData);
- licenseText.setText("");
-
- Button agreeButton = new Button(container, SWT.RADIO);
- agreeButton.setText("I accept the terms of the license agreements"); //$NON-NLS-1$
- agreeButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent event) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent event) {
- licenseTermsAgreed = true;
- setPageComplete(licenseTermsAgreed);
- }
- });
- Button disagreeButton = new Button(container, SWT.RADIO);
- disagreeButton
- .setText("I do not accept the terms of the license agreements"); //$NON-NLS-1$
- disagreeButton.setSelection(true);
- disagreeButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent event) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent event) {
- licenseTermsAgreed = false;
- ((NewMaemoSDKVMWizard) getWizard()).getInstallData()
- .setLicenseTermsAgreed(licenseTermsAgreed);
- setPageComplete(licenseTermsAgreed);
- }
- });
-
- setControl(container);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
- */
- @Override
- public boolean canFlipToNextPage() {
- return ok && licenseTermsAgreed;
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- MaemoSDKVMDescription descriptor = ((NewMaemoSDKVMWizard)getWizard()).getInstallData().getFileToDownload().getDescriptor();
-
- // if an existing Maemo SDK VM is being used, the license of latest VM is used instead.
- // the text is not HTML-formmated. Then, it is necessary to add necessary HTML tags.
- licenseText.setText("<html><body><pre>"+descriptor.getLicense()+"</pre></body></html>");
-
- ((Composite)getControl()).layout();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 INdT, (c) 2009 Nokia Corporation
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Raul Herbster (INdT) - initial API and implementation
+ *******************************************************************************/
+package org.maemo.esbox.internal.vm.vmware.ui.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.esbox.internal.api.vm.vmware.MaemoSDKVMDescription;
+import org.maemo.esbox.internal.vm.vmware.Activator;
+
+/**
+ * Page that display license contents.
+ *
+ * @author raulherbster
+ *
+ */
+public class MaemoSDKVMLicenseWizardPage extends WizardPage {
+
+ private Browser licenseText;
+ private boolean licenseTermsAgreed = false;
+ private boolean ok = false;
+
+ /**
+ * Constructor
+ *
+ * @param wizard
+ * parent wizard.
+ */
+ protected MaemoSDKVMLicenseWizardPage(NewMaemoSDKVMWizard wizard) {
+ super("maemovm_licensepage", "License",
+ Activator.MAEMO_VM_WIZBAN_DESCRIPTOR);
+ setWizard(wizard);
+ ok = true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+ * .Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(1, false);
+ container.setLayout(layout);
+ GridData licenseGridData = new GridData(GridData.BEGINNING
+ | GridData.FILL_BOTH);
+ licenseGridData.widthHint = 500;
+ licenseGridData.heightHint = 300;
+ licenseText = new Browser(container, SWT.BORDER | SWT.WRAP);
+ licenseText.setLayoutData(licenseGridData);
+ licenseText.setText("");
+
+ Button agreeButton = new Button(container, SWT.RADIO);
+ agreeButton.setText("I accept the terms of the license agreements"); //$NON-NLS-1$
+ agreeButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent event) {
+ licenseTermsAgreed = true;
+ setPageComplete(licenseTermsAgreed);
+ }
+ });
+ Button disagreeButton = new Button(container, SWT.RADIO);
+ disagreeButton
+ .setText("I do not accept the terms of the license agreements"); //$NON-NLS-1$
+ disagreeButton.setSelection(true);
+ disagreeButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ // do nothing
+ }
+
+ public void widgetSelected(SelectionEvent event) {
+ licenseTermsAgreed = false;
+ ((NewMaemoSDKVMWizard) getWizard()).getInstallData()
+ .setLicenseTermsAgreed(licenseTermsAgreed);
+ setPageComplete(licenseTermsAgreed);
+ }
+ });
+
+ setControl(container);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
+ */
+ @Override
+ public boolean canFlipToNextPage() {
+ return ok && licenseTermsAgreed;
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+
+ MaemoSDKVMDescription descriptor = ((NewMaemoSDKVMWizard)getWizard()).getInstallData().getFileToDownload().getDescriptor();
+
+ // if an existing Maemo SDK VM is being used, the license of latest VM is used instead.
+ // the text is not HTML-formmated. Then, it is necessary to add necessary HTML tags.
+ licenseText.setText("<html><body><pre>"+descriptor.getLicense()+"</pre></body></html>");
+
+ ((Composite)getControl()).layout();
+ }
+
+}
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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMSelectionWizardPage.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/MaemoSDKVMUncompressInfoWizardPage.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/internal/vm/vmware/ui/wizards/NewMaemoSDKVMWizard.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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 19:32:20 UTC (rev 2120)
+++ branches/work_Fabricio/org.maemo.esbox.vm.vmware/src/org/maemo/esbox/vm/vmware/IVMwareConfiguration.java 2009-09-08 19:45:43 UTC (rev 2121)
@@ -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