[Esbox-commits] r829 - in trunk/device/org.maemo.esbox.device.launch.rse: . .settings META-INF src src/org src/org/maemo src/org/maemo/esbox src/org/maemo/esbox/device src/org/maemo/esbox/device/launch src/org/maemo/esbox/device/launch/rse src/org/maemo/esbox/device/launch/rse/ui src/org/maemo/esbox/internal src/org/maemo/esbox/internal/device src/org/maemo/esbox/internal/device/launch src/org/maemo/esbox/internal/device/launch/rse

lwang at garage.maemo.org lwang at garage.maemo.org
Fri Oct 3 00:17:34 EEST 2008


Author: lwang
Date: 2008-10-03 00:17:34 +0300 (Fri, 03 Oct 2008)
New Revision: 829

Added:
   trunk/device/org.maemo.esbox.device.launch.rse/.classpath
   trunk/device/org.maemo.esbox.device.launch.rse/.project
   trunk/device/org.maemo.esbox.device.launch.rse/.settings/
   trunk/device/org.maemo.esbox.device.launch.rse/.settings/org.eclipse.jdt.core.prefs
   trunk/device/org.maemo.esbox.device.launch.rse/META-INF/
   trunk/device/org.maemo.esbox.device.launch.rse/META-INF/MANIFEST.MF
   trunk/device/org.maemo.esbox.device.launch.rse/build.properties
   trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml
   trunk/device/org.maemo.esbox.device.launch.rse/src/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocol.java
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocolType.java
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSEConnectionConfigPage.java
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSELaunchProtocolPage.java
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/launch/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/launch/rse/
   trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/launch/rse/Activator.java
Log:
Initial version of RSE launch integration

Added: trunk/device/org.maemo.esbox.device.launch.rse/.classpath
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/.classpath	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/.classpath	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/.classpath
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/.project
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/.project	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/.project	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.maemo.esbox.device.launch.rse</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/.project
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/.settings/org.eclipse.jdt.core.prefs	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,7 @@
+#Wed Sep 10 19:01:35 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/META-INF/MANIFEST.MF
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/META-INF/MANIFEST.MF	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESbox RSE-based Launch Plug-in
+Bundle-SymbolicName: org.maemo.esbox.device.launch.rse;singleton:=true
+Bundle-Version: 1.5.0.qualifier
+Bundle-Activator: org.maemo.esbox.internal.device.launch.rse.Activator
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.debug.core;bundle-version="3.4.0",
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.eclipse.rse.core;bundle-version="3.0.1",
+ org.eclipse.rse.subsystems.shells.core;bundle-version="3.0.0",
+ org.eclipse.rse.subsystems.files.core;bundle-version="3.0.1",
+ org.eclipse.rse.services;bundle-version="3.0.1",
+ org.maemo.esbox.launch;bundle-version="1.5.0",
+ org.maemo.esbox.core;bundle-version="1.5.0",
+ org.maemo.esbox.ui;bundle-version="1.5.0",
+ org.maemo.esbox.device.launch;bundle-version="1.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/build.properties
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/build.properties	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/build.properties	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/build.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.maemo.esbox.launch.LaunchProtocolType">
+      <launch_protocol
+            class="org.maemo.esbox.device.launch.rse.RSELaunchProtocolType"
+            description="Use RSE connection as the vehicle for launching."
+            id="org.maemo.esbox.device.launch.rse.RSELaunchProtocol"
+            name="RSE Connection">
+      </launch_protocol>
+   </extension>
+   <extension
+         point="org.maemo.esbox.launch.LaunchProtocolPage">
+      <launch_protocol_page
+            class="org.maemo.esbox.device.launch.rse.ui.RSELaunchProtocolPage"
+            launch_protocol_id="org.maemo.esbox.device.launch.rse.RSELaunchProtocol">
+      </launch_protocol_page>
+   </extension>
+
+</plugin>


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocol.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocol.java	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocol.java	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ling Wang (Nokia) - initial version. Sep 10, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch.rse;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.rse.core.model.IHost;
+import org.maemo.esbox.core.machine.IMachine;
+import org.maemo.esbox.launch.AbstractLaunchProtocol;
+
+/**
+ * @author LWang
+ *
+ */
+public class RSELaunchProtocol extends AbstractLaunchProtocol {
+
+	private IHost fRSEHost;
+	
+	/**
+	 * @param config
+	 */
+	public RSELaunchProtocol(ILaunchConfiguration config, IHost host) {
+		super(config);
+		fRSEHost = host;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.launch.ILaunchProtocol#convertHostToTargetPath(org.eclipse.core.runtime.IPath)
+	 */
+	public IPath convertHostToTargetPath(IPath hostPath) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.launch.ILaunchProtocol#downloadFiles(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public IStatus downloadFiles(IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.launch.ILaunchProtocol#downloadFiles(java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public IStatus downloadFiles(Map<IPath, List<IPath>> targetPathToHostFiles,
+			IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.launch.ILaunchProtocol#getFileLocationOnTarget(org.eclipse.core.runtime.IPath)
+	 */
+	public IPath getFileLocationOnTarget(IPath filePath) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.launch.ILaunchProtocol#getTargetFoldersForHostFileMappings()
+	 */
+	public Map<IPath, List<IPath>> getTargetFoldersForHostFileMappings() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.maemo.esbox.launch.ILaunchProtocol#requireRunAsRoot()
+	 */
+	public void requireRunAsRoot() throws CoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public IMachine getDeviceMachine() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocol.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocolType.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocolType.java	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocolType.java	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ling Wang (Nokia) - initial version. Sep 10, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch.rse;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.maemo.esbox.device.launch.SSHLaunchProtocolType;
+import org.maemo.esbox.internal.device.launch.rse.Activator;
+import org.maemo.esbox.launch.AbstractLaunchProtocolType;
+import org.maemo.esbox.launch.ILaunchProtocol;
+import org.maemo.esbox.launch.ILaunchProtocolType;
+
+/**
+ * @author LWang
+ *
+ */
+public class RSELaunchProtocolType extends AbstractLaunchProtocolType
+		implements ILaunchProtocolType {
+
+	private static final String ATTR_RSE_CONNECTION_ID = "org.maemo.esbox.device.launch.rse_conneciton_id";
+	
+	/**
+	 * Get ID of all existing RSE connections.
+	 * Currently we use connection "aliasName" as its ID.
+	 * 
+	 * @return
+	 */
+	static public String[] getRSEConnectionIDs() {
+		IHost[] hosts = SystemStartHere.getConnections(); 
+		String[] names = new String[hosts.length];
+		
+		for (int i = 0 ; i < hosts.length; i++) {
+			names[i] = hosts[i].getAliasName();
+		}
+		
+		return names;
+	}
+	
+	/**
+	 * Retrieve RSE connection ID from the given launch configuration.
+	 * 
+	 * @param configuration
+	 * @return - connection ID or null if not available yet.
+	 */
+	static public String getRSEConnection(ILaunchConfiguration configuration) {
+		String rseConnectionID = null;
+		try {
+			rseConnectionID = configuration.getAttribute(ATTR_RSE_CONNECTION_ID, (String)null);
+		} catch (CoreException e) {
+		}
+
+		return rseConnectionID;
+	}
+	
+	/**
+	 * Set RSE connection for the given launch configuration.
+	 * 
+	 * @param configuration
+	 */
+	static public void setRSEConnection(ILaunchConfigurationWorkingCopy configuration, String rseConnection) {
+		configuration.setAttribute(ATTR_RSE_CONNECTION_ID, rseConnection);
+	}
+	
+	public RSELaunchProtocolType() {
+	}
+
+	public ILaunchProtocol getLaunchProtocol(ILaunchConfiguration configuration)
+			throws CoreException {
+		
+		String rseConnectionID = getRSEConnection(configuration);
+
+		if (rseConnectionID == null)
+			throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), 
+							"No RSE Connection found in the launch configuration:" + configuration.getName()));
+		
+		IHost[] hosts = SystemStartHere.getConnections(); 
+
+		IHost foundConnection = null;
+		for (IHost h : hosts) {
+			if (h.getAliasName().equals(rseConnectionID)) {
+				foundConnection = h;
+				break;
+			}
+		}
+		if (rseConnectionID == null) {
+			String msg = MessageFormat.format(
+					"The RSE connection ''{0}'' specified in the launch configuration ''{1}'' does not exist any more.",
+					rseConnectionID, configuration.getName());
+			throw new CoreException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), msg)); 
+		}
+
+		return new RSELaunchProtocol(configuration, foundConnection);
+	}
+
+	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+		IHost[] hosts = SystemStartHere.getConnections(); 
+		String  hostID = null;
+		
+		if (hosts.length > 0)
+			hostID = hosts[0].getAliasName();
+		
+		setRSEConnection(configuration, hostID);
+		
+		// Reuse SSH code. It's not safe in theory, but in practice we'll
+		// always have SSHLaunchProtocol extension in the installation.
+		//
+		SSHLaunchProtocolType.setDefaultFilesToDownload(configuration);
+	}
+
+}


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocolType.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSEConnectionConfigPage.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSEConnectionConfigPage.java	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSEConnectionConfigPage.java	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ling Wang (Nokia) - initial version. Oct 1, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch.rse.ui;
+
+import java.text.MessageFormat;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.maemo.esbox.device.launch.rse.RSELaunchProtocolType;
+import org.maemo.esbox.device.launch.ui.SSHLaunchProtocolPage;
+import org.maemo.esbox.launch.ui.AbstractConnectionConfigPage;
+import org.maemo.esbox.ui.common.ComboDialogField;
+import org.maemo.esbox.ui.common.DialogField;
+import org.maemo.esbox.ui.common.IDialogFieldListener;
+
+/**
+ * @author LWang
+ *
+ */
+public class RSEConnectionConfigPage extends AbstractConnectionConfigPage {
+
+	private ComboDialogField	fConnectionCombo;
+	private String[]			fConnectionNames;
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite page = SSHLaunchProtocolPage.createCompositeEx( parent, 2, GridData.FILL_BOTH );
+		
+		fConnectionCombo = new ComboDialogField(SWT.READ_ONLY | SWT.DROP_DOWN);
+		fConnectionCombo.setLabelText("RSE Connections: ");
+		
+		// We keep a record of existing RSE connections.
+		// XXX: what if user modified the RSE connections during or after the
+		//      launch configuration is created ?
+		fConnectionNames = RSELaunchProtocolType.getRSEConnectionIDs();
+		fConnectionCombo.setItems(fConnectionNames);
+		fConnectionCombo.doFillIntoGrid(page, 2);
+
+		fConnectionCombo.setDialogFieldListener(new IDialogFieldListener() {
+
+			public void dialogFieldChanged(DialogField field) {
+				update();
+			}});
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+	 */
+	public String getName() {
+		return "internal RSE Connection Selector";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+	 */
+	public void initializeFrom(ILaunchConfiguration configuration) {
+		String id = RSELaunchProtocolType.getRSEConnection(configuration);
+		
+		int selection = -1;	// default, nothing selected in the list.
+		
+		for (int i=0; i < fConnectionNames.length; i++)
+			if (fConnectionNames[i].equals(id)) {
+				selection = i;
+				break;
+			}
+
+		setInitializing(true);
+		
+		fConnectionCombo.selectItem(selection);
+		
+		setInitializing(false);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+	 */
+	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+		int selection = fConnectionCombo.getSelectionIndex();
+		if (selection >= 0 && selection < fConnectionNames.length) {
+			String id = fConnectionNames[fConnectionCombo.getSelectionIndex()];
+		
+			RSELaunchProtocolType.setRSEConnection(configuration, id);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+	 */
+	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+		// Done by corresponding xxxLaunchProtocolType.setDefaults(). 
+	}
+
+	@Override
+	public boolean isValid(ILaunchConfiguration configuration) {
+		setErrorMessage(null);
+		setMessage(null);
+
+		String id = RSELaunchProtocolType.getRSEConnection(configuration);
+
+		// the connection stored in the configuration does not exist any more.
+		String msg = null;
+		
+		if (id != null) {
+			int i;
+			for (i=0; i < fConnectionNames.length; i++)
+				if (fConnectionNames[i].equals(id))
+					break;
+
+			if (i == fConnectionNames.length) {
+				// the connection stored in the configuration does not exist any more.
+				msg = MessageFormat.format(
+						"RSE Connection ''{0}'' in the launch configuration does not exist any more. ",  
+						id);
+				if (fConnectionNames.length > 0)
+					msg += "Select one from the \"RSE Connections\" list.";
+				else 
+					msg += "Please create an RSE connection.";
+			}
+		}
+		else  {
+			if (fConnectionNames.length == 0)
+				msg = "No RSE Connection is available yet. Please create one.";
+		}
+
+		setErrorMessage(msg);
+	
+		return msg == null;
+	}
+}


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSEConnectionConfigPage.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSELaunchProtocolPage.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSELaunchProtocolPage.java	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSELaunchProtocolPage.java	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Nokia Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Ling Wang (Nokia) - initial version. Sep 10, 2008
+ *******************************************************************************/
+
+package org.maemo.esbox.device.launch.rse.ui;
+
+import org.maemo.esbox.device.launch.ui.SSHLaunchProtocolPage;
+import org.maemo.esbox.launch.ui.IConnectionConfigPage;
+
+/**
+ * @author LWang
+ *
+ */
+public class RSELaunchProtocolPage extends SSHLaunchProtocolPage {
+
+	@Override
+	protected IConnectionConfigPage getConnectionConfigPage() {
+		return new RSEConnectionConfigPage();
+	}
+
+	public String getName() {
+		return "internal RSELaunchProtocolPage";
+	}
+}


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSELaunchProtocolPage.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/launch/rse/Activator.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/launch/rse/Activator.java	                        (rev 0)
+++ trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/launch/rse/Activator.java	2008-10-02 21:17:34 UTC (rev 829)
@@ -0,0 +1,62 @@
+package org.maemo.esbox.internal.device.launch.rse;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * 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.device.launch.rse";
+
+	// 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;
+	}
+
+	/**
+	 * Convenience method which returns the unique identifier of this plugin.
+	 */
+	public static String getUniqueIdentifier() {
+		if (getDefault() == null) {
+			// If the default instance is not yet initialized,
+			// return a static identifier. This identifier must
+			// match the plugin id defined in plugin.xml
+			return PLUGIN_ID;
+		}
+		return getDefault().getBundle().getSymbolicName();
+	}
+}


Property changes on: trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/internal/device/launch/rse/Activator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the Esbox-commits mailing list