[Esbox-commits] r831 - in trunk: common/org.maemo.esbox.launch/src/org/maemo/esbox/launch common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch device/org.maemo.esbox.device.launch device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch device/org.maemo.esbox.device.launch.rse device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui
lwang at garage.maemo.org
lwang at garage.maemo.org
Fri Oct 3 19:19:04 EEST 2008
Author: lwang
Date: 2008-10-03 19:19:03 +0300 (Fri, 03 Oct 2008)
New Revision: 831
Modified:
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java
trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java
trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java
trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java
trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml
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/RSEConnectionConfigPage.java
trunk/device/org.maemo.esbox.device.launch/plugin.xml
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java
trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java
Log:
1. Change launch protocol type names to "SSH Copy" and "SBRSH Mount" and ensure backward compatibility.
2. Some cleanup on LaunchShortcut code.
Modified: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/AbstractLaunchProtocolType.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -60,8 +60,13 @@
typeName = config.getAttribute(LaunchProtocolFactory.ATTR_NAME);
if (typeName == null)
- msg += MessageFormat.format(format, LaunchProtocolFactory.ATTR_NAME, config.getName());
-
+ msg += MessageFormat.format(format, LaunchProtocolFactory.ATTR_NAME, config.getName());
+ else {
+ // Sanity check for any new protocol type extension.
+ if (! recognize(typeName))
+ msg += MessageFormat.format("LaunchProtocolType name ''{0}'' is not recognized by itself. Check the recognize() method!", typeName);
+ }
+
typeDescription = config.getAttribute(LaunchProtocolFactory.ATTR_DESCRIPTION);
if (typeDescription == null)
msg += MessageFormat.format(format, LaunchProtocolFactory.ATTR_DESCRIPTION, config.getName());
Modified: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ILaunchProtocolType.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -54,4 +54,15 @@
* @param configuration
*/
public void setDefaults(ILaunchConfigurationWorkingCopy configuration);
+
+ /**
+ * Check if the given protocol type name is recognized by this
+ * launch protocol type. This is to ensure existing launch configurations
+ * (e.g. those from previous ESbox version) with old protocol type names
+ * will still work.
+ *
+ * @param name protocol type name
+ * @return
+ */
+ public boolean recognize(String name);
}
Modified: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/LaunchProtocolFactory.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -33,7 +33,6 @@
// !!! Make sure they are in sync with the xml file. !!!
//
private static final String EXTENSION_ID = Activator.PLUGIN_ID + ".LaunchProtocolType";
- private static final String DEFAULT_LAUNCH_PROTOCOL_NAME = "SSH";
public static final String ATTR_ID = "id";
public static final String ATTR_NAME = "name";
@@ -122,12 +121,25 @@
}
/**
- * This is the default remote connection type that we'll give to a new launch configuration.
+ * This is the default remote connection type that we'll give to a
+ * new launch configuration.
*
- * @return
+ * @return - empty string if no LaunchProtocolType extensions available.
*/
public String getDefaultProtocolName() {
- return DEFAULT_LAUNCH_PROTOCOL_NAME;
+ String[] names = getAllProtocolTypeNames();
+
+ // Use SSH by default, if any
+ for (String n : names)
+ if (n.contains("SSH"))
+ return n;
+
+ // otherwise the first available
+ if (names.length > 0)
+ return names[0];
+
+ // otherwise
+ return "";
}
/**
Modified: trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java
===================================================================
--- trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/common/org.maemo.esbox.launch/src/org/maemo/esbox/launch/ui/ESboxDownloadTab.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -192,9 +192,7 @@
}
for (int i = 0; i < fLaunchProtocolPool.size(); i++) {
- // Use "contains()" instead of "equals()" to accommodate values from ESbox 1.4.1
- // launch configurations..... 08/10/08
- if (downloadMethod.contains(fLaunchProtocolPool.get(i).getName()))
+ if (fLaunchProtocolPool.get(i).recognize(downloadMethod))
{
fDownloadMethodCombo.select(i);
@@ -275,6 +273,9 @@
* Change UI based on change of certain options.
*/
private void updateUI() {
+ if (fDownloadMethodCombo.getSelectionIndex() < 0)
+ return;
+
ILaunchProtocolType protocol =fLaunchProtocolPool.get(fDownloadMethodCombo.getSelectionIndex());
if (protocol == null) {
// should not happen
Modified: trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/cpp/org.maemo.esbox.cpp.launch/src/org/maemo/esbox/cpp/launch/remote/ESboxRemoteLaunchShortcut.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -12,9 +12,10 @@
package org.maemo.esbox.cpp.launch.remote;
+import java.text.MessageFormat;
+
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.window.Window;
@@ -23,17 +24,16 @@
import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
import org.maemo.esbox.cpp.launch.CppLaunchConfigurationData;
import org.maemo.esbox.internal.cpp.launch.Activator;
-import org.maemo.esbox.launch.*;
+import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
import org.maemo.esbox.launch.ui.DownloadMethodSelectionDialog;
-import java.text.MessageFormat;
-
/**
*
*/
public class ESboxRemoteLaunchShortcut extends AbstractLaunchShortcut {
- String fDownloadMethod = null;
+ protected String fDownloadMethod = null;
@Override
protected ILaunchConfigurationType getCLaunchConfigType() {
@@ -67,10 +67,16 @@
if (sdkTarget == null)
return configName;
+ // It's better to get the short name from extension points. But no big deal.
+ String shortName = fDownloadMethod.contains("SSH") ? "SSH" :
+ fDownloadMethod.contains("SBRSH")? "SBRSH" :
+ fDownloadMethod.contains("RSE")? "RSE" :
+ fDownloadMethod; // any other protocols.
+
configName = MessageFormat.format(format,
binFileName,
sdkTarget.getName(),
- fDownloadMethod.contains("SSH") ? "SSH" : "SBRSH");
+ shortName);
return configName;
}
Modified: trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java
===================================================================
--- trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/cpp/org.maemo.esbox.cpp.launch.dsf.gdb/src/org/maemo/esbox/cpp/launch/dsf/gdb/launch/RemoteLaunchShortcut.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -12,55 +12,26 @@
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.ILaunchShortcut;
-import org.eclipse.jface.window.Window;
-import org.maemo.esbox.core.sdk.ISDKTarget;
-import org.maemo.esbox.cpp.launch.AbstractLaunchShortcut;
import org.maemo.esbox.cpp.launch.dsf.gdb.DsfLaunchConfigurationData;
-import org.maemo.esbox.launch.ESboxLaunchUtils;
+import org.maemo.esbox.cpp.launch.remote.ESboxRemoteLaunchShortcut;
import org.maemo.esbox.launch.IESboxCDTLaunchConfigurationConstants;
-import org.maemo.esbox.launch.ui.DownloadMethodSelectionDialog;
-import java.text.MessageFormat;
-
/**
* @author LWang.
*
*/
-public class RemoteLaunchShortcut extends AbstractLaunchShortcut implements
- ILaunchShortcut {
+public class RemoteLaunchShortcut extends ESboxRemoteLaunchShortcut {
- private String fDownloadMethod = null;
-
/* (non-Javadoc)
* @see org.maemo.esbox.launch.AbstractLaunchShortcut#createLaunchConfigurationName(java.lang.String, org.eclipse.cdt.core.model.ICProject)
*/
@Override
protected String createLaunchConfigurationName(String binFileName,
ICProject project) throws CoreException {
-
- fDownloadMethod = chooseDownloadMethod();
- if (fDownloadMethod == null || fDownloadMethod.length() == 0)
- throw new CoreException(Status.CANCEL_STATUS);
-
- // binName (SDKTargetName-DownloadMethodNaem)
- String format = "{0} ({1}-{2} DSF)"; //$NON-NLS-1$
-
- String configName = binFileName;
- ISDKTarget sdkTarget = ESboxLaunchUtils.getSDKTarget(project.getProject());
-
- if (sdkTarget == null)
- return configName;
-
- configName = MessageFormat.format(format,
- binFileName,
- sdkTarget.getName(),
- fDownloadMethod.contains("SSH") ? "SSH" : "SBRSH");
-
- return configName;
+ String configName = super.createLaunchConfigurationName(binFileName, project);
+ return configName + "(DSF)";
}
/* (non-Javadoc)
@@ -77,22 +48,11 @@
@Override
protected void setDefaultForLaunchConfiguration(
ILaunchConfigurationWorkingCopy config) throws CoreException {
+
DsfLaunchConfigurationData.setDefaults(config, IESboxCDTLaunchConfigurationConstants.CONFIG_TYPE_MAEMOREMOTE_DSF);
- }
- /**
- * Dialog asking user to choose the download method for remote debug.
- *
- * @return String -- download method.
- */
- private String chooseDownloadMethod() {
- DownloadMethodSelectionDialog dialog = new DownloadMethodSelectionDialog(getShell());
- if (dialog.open() == Window.OK) {
- Object[] result = dialog.getResult();
- if(result.length > 0) {
- return (String)result[0];
- }
- }
- return null;
+ if (fDownloadMethod != null)
+ config.setAttribute(IESboxCDTLaunchConfigurationConstants.ATTR_DOWNLOAD_METHOD, fDownloadMethod);
}
+
}
Modified: trunk/device/org.maemo.esbox.device.launch/plugin.xml
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/plugin.xml 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/device/org.maemo.esbox.device.launch/plugin.xml 2008-10-03 16:19:03 UTC (rev 831)
@@ -4,13 +4,13 @@
<extension
point="org.maemo.esbox.launch.LaunchProtocolType">
<launch_protocol
- name="SSH"
+ name="SSH Copy"
id="org.maemo.esbox.launch.launch_protocol.ssh"
description="See "http://maemo.org/development/documentation/pc_connectivity/" for how to set up SSH for Maemo development. When used for downloading, this protocol will copy program files to the remote device."
class="org.maemo.esbox.device.launch.SSHLaunchProtocolType">
</launch_protocol>
<launch_protocol
- name="SBRSH"
+ name="SBRSH Mount"
id="org.maemo.esbox.launch.launch_protocol.sbrsh"
description="See "http://www.scratchbox.org/documentation/user/scratchbox-1.0/html/sbrsh.html" on what's SBRSH. See "http://maemo.org/development/documentation/pc_connectivity/" for how to set up SBRSH. When used for downloading, the protocol will mount the project folder from host PC to remote device."
class="org.maemo.esbox.device.launch.SBRSHLaunchProtocolType">
Modified: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SBRSHLaunchProtocolType.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -271,4 +271,8 @@
throw new CoreException(new ESboxDebuggerStatus(e));
}
}
+
+ public boolean recognize(String name) {
+ return name.contains("SBRSH");
+ }
}
Modified: trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java
===================================================================
--- trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/device/org.maemo.esbox.device.launch/src/org/maemo/esbox/device/launch/SSHLaunchProtocolType.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -242,4 +242,9 @@
storeFilesToDownload(configuration, files);
}
+
+ public boolean recognize(String name) {
+ // Names used: "SSH Copy", "SSH".
+ return name.contains("SSH");
+ }
}
Modified: trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml
===================================================================
--- trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/device/org.maemo.esbox.device.launch.rse/plugin.xml 2008-10-03 16:19:03 UTC (rev 831)
@@ -5,9 +5,9 @@
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."
+ description="Use RSE connection as the vehicle for launching. See "RSE User's Guide" at http://help.eclipse.org for more."
id="org.maemo.esbox.device.launch.rse.RSELaunchProtocol"
- name="RSE Connection">
+ name="RSE Copy">
</launch_protocol>
</extension>
<extension
Modified: 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 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/RSELaunchProtocolType.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -123,4 +123,7 @@
SSHLaunchProtocolType.setDefaultFilesToDownload(configuration);
}
+ public boolean recognize(String name) {
+ return name.contains("RSE");
+ }
}
Modified: 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 2008-10-02 21:24:27 UTC (rev 830)
+++ trunk/device/org.maemo.esbox.device.launch.rse/src/org/maemo/esbox/device/launch/rse/ui/RSEConnectionConfigPage.java 2008-10-03 16:19:03 UTC (rev 831)
@@ -72,12 +72,18 @@
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;
- }
-
+ if (id == null) { // existing configuration without RSE connection set
+ if (fConnectionNames.length > 0)
+ selection = 0; // select first one as default.
+ }
+ else {
+ for (int i=0; i < fConnectionNames.length; i++)
+ if (fConnectionNames[i].equals(id)) {
+ selection = i;
+ break;
+ }
+ }
+
setInitializing(true);
fConnectionCombo.selectItem(selection);
More information about the Esbox-commits
mailing list