# HG changeset patch # User ssobek # Date 1280262028 18000 # Node ID 2c1a7d3f4ab4c40794eba5d1f9746976082c588c # Parent fc09c1bebf0e30d5d15751aad5c132ca3d0d3a86# Parent c2c8b7393fe75b3a352ce1d27171b7687350f573 Merge with c2c8b7393fe75b3a352ce1d27171b7687350f573 diff -r fc09c1bebf0e -r 2c1a7d3f4ab4 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Tue Jul 27 15:00:54 2010 -0500 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java Tue Jul 27 15:20:28 2010 -0500 @@ -149,6 +149,7 @@ private ComboViewer connectionTypeViewer; private Text nameText; private boolean modifiedName; + private String generatedName; private boolean initialized; private Composite agentTestTabComposite; private ListViewer servicesListViewer; @@ -649,12 +650,17 @@ public void settingsChanged() { if (!modifiedName) { - String preferredName = connectionFactory.getSettingsFromUI().get(IConnectionFactory2.PREFERRED_CONNECTION_NAME); - if (preferredName != null) { - nameText.setText(ensureUniquePreferredName(preferredName)); - } - else { - nameText.setText(getInitialNameText()); + String currentName = nameText.getText(); + if (currentName == null || currentName.length() == 0 || currentName.equals(generatedName)) { + String preferredName = connectionFactory.getSettingsFromUI().get(IConnectionFactory2.PREFERRED_CONNECTION_NAME); + if (preferredName != null) { + preferredName = ensureUniquePreferredName(preferredName); + generatedName = preferredName; + nameText.setText(preferredName); + } + else { + nameText.setText(getInitialNameText()); + } } modifiedName = false; } @@ -1065,6 +1071,7 @@ private String getInitialNameText() { IConnection connectionToEdit = settingsWizard.getConnectionToEdit(); if (connectionToEdit != null) { + generatedName = ""; return connectionToEdit.getDisplayName(); } @@ -1072,6 +1079,7 @@ while (true) { String name = MessageFormat.format(INITIAL_NAME_FMT, CONNECTION_PREFIX, Long.toString(i++)); if (isNameUnique(name)) { + generatedName = name; return name; } } diff -r fc09c1bebf0e -r 2c1a7d3f4ab4 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Tue Jul 27 15:00:54 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/LaunchPlugin.java Tue Jul 27 15:20:28 2010 -0500 @@ -102,6 +102,7 @@ public static final String REMOTE_CONNECTIONS_TRK_SERVICE = "com.nokia.carbide.trk.support.service.TRKService"; //$NON-NLS-1$ public static final String REMOTE_CONNECTIONS_TRACING_SERVICE = "com.nokia.carbide.trk.support.service.TracingService"; //$NON-NLS-1$ + public static final String REMOTE_CONNECTIONS_PLATSIM_SERVICE = "com.nokia.cdt.internal.debug.launch.platSim.service.PlatSimService"; //$NON-NLS-1$ // Preference constants public static final String Use_New_Project_Assist = "com.nokia.cdt.debug.launch.Use_New_Project_Assist"; //$NON-NLS-1$ @@ -599,7 +600,12 @@ public static IService getTRKService() { return RemoteConnectionsActivator.getConnectionTypeProvider(). - findServiceByID(REMOTE_CONNECTIONS_TRK_SERVICE); //$NON-NLS-1$ + findServiceByID(REMOTE_CONNECTIONS_TRK_SERVICE); + } + + public static IService getPlatSimService() { + return RemoteConnectionsActivator.getConnectionTypeProvider(). + findServiceByID(REMOTE_CONNECTIONS_PLATSIM_SERVICE); } /** diff -r fc09c1bebf0e -r 2c1a7d3f4ab4 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/StopModeMainTab.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/StopModeMainTab.java Tue Jul 27 15:00:54 2010 -0500 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/StopModeMainTab.java Tue Jul 27 15:20:28 2010 -0500 @@ -16,16 +16,24 @@ */ package com.nokia.cdt.internal.debug.launch.ui; +import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; +import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2; +import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener; +import com.nokia.carbide.remoteconnections.interfaces.IConnection; import com.nokia.cdt.internal.debug.launch.LaunchPlugin; public class StopModeMainTab extends CarbideMainTab { + protected IClientServiceSiteUI2 clientSiteUI; + protected String connection; public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); @@ -47,6 +55,15 @@ fProjLabel.setToolTipText(Messages.getString("StopModeMainTab.2")); //$NON-NLS-1$ fProjText.setToolTipText(Messages.getString("StopModeMainTab.2")); //$NON-NLS-1$ + clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI2(LaunchPlugin.getPlatSimService()); + clientSiteUI.createComposite(comp); + clientSiteUI.addListener(new IListener() { + public void connectionSelected() { + connection = clientSiteUI.getSelectedConnection(); + updateLaunchConfigurationDialog(); + } + }); + createVerticalSpacer(comp, 1); if (wantsTerminalOption() /*&& ProcessFactory.supportesTerminal()*/) { createTerminalOption(comp, 1); @@ -60,10 +77,56 @@ public void initializeFrom(ILaunchConfiguration config) { super.initializeFrom(config); + + // if a PlatSim stop mode launch does not have a connection, + // it may need to be converted to have a connection + try { + connection = RemoteConnectionsTRKHelper.getConnectionIdFromConfig(config); + } catch (CoreException e) { + } + + if (connection == null && config instanceof ILaunchConfigurationWorkingCopy) { + String location = null; + String instanceId = null; + try { + // for new launches, the remote connection holds the location and instance + // we can use "1" as the default PlatSim instanceId, but we won't create a new + // connection if we do not have a PlatSim_Location attribute + location = config.getAttribute("com.nokia.cdt.debug.launch.PlatSim_Location", (String) null); + instanceId = config.getAttribute("com.nokia.cdt.debug.launch.PlatSim_Instance_Id", "1"); + } catch (CoreException ce) { + LaunchPlugin.log(ce); + } + + if (location != null && location.length() > 0) { + + ILaunchConfigurationWorkingCopy wcConfig = (ILaunchConfigurationWorkingCopy)config; + + // if an existing PlatSim connection matches, then use it + // if no connection matches, then create a new one + IConnection connectionToUse = RemoteConnectionsTRKHelper.findOrCreatePlatSimConnection(location, instanceId); + connection = connectionToUse.getIdentifier(); + if (connection != null) { + wcConfig.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection); + } + } + } + + if (clientSiteUI != null) + { + if (connection != null) + clientSiteUI.selectConnection(connection); + else { + connection = clientSiteUI.getSelectedConnection(); + } + } } public void performApply(ILaunchConfigurationWorkingCopy config) { super.performApply(config); + if (connection != null) { + config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection); + } } /*