debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RunModeMainTab.java
equal
deleted
inserted
replaced
21 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; |
21 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; |
22 import org.eclipse.core.resources.IResourceChangeEvent; |
22 import org.eclipse.core.resources.IResourceChangeEvent; |
23 import org.eclipse.core.resources.IResourceChangeListener; |
23 import org.eclipse.core.resources.IResourceChangeListener; |
24 import org.eclipse.core.resources.ResourcesPlugin; |
24 import org.eclipse.core.resources.ResourcesPlugin; |
25 import org.eclipse.core.runtime.CoreException; |
25 import org.eclipse.core.runtime.CoreException; |
|
26 import org.eclipse.core.runtime.IStatus; |
26 import org.eclipse.core.runtime.Path; |
27 import org.eclipse.core.runtime.Path; |
27 import org.eclipse.debug.core.ILaunchConfiguration; |
28 import org.eclipse.debug.core.ILaunchConfiguration; |
28 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
29 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
29 import org.eclipse.swt.SWT; |
30 import org.eclipse.swt.SWT; |
30 import org.eclipse.swt.events.ModifyEvent; |
31 import org.eclipse.swt.events.ModifyEvent; |
36 import org.eclipse.swt.widgets.Label; |
37 import org.eclipse.swt.widgets.Label; |
37 import org.eclipse.swt.widgets.Text; |
38 import org.eclipse.swt.widgets.Text; |
38 |
39 |
39 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; |
40 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper; |
40 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
41 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
41 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI; |
42 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2; |
42 import com.nokia.carbide.remoteconnections.interfaces.IConnection; |
43 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener; |
43 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI.IListener; |
|
44 import com.nokia.cdt.internal.debug.launch.LaunchPlugin; |
44 import com.nokia.cdt.internal.debug.launch.LaunchPlugin; |
45 |
45 |
46 import cwdbg.PreferenceConstants; |
46 import cwdbg.PreferenceConstants; |
47 |
47 |
48 public class RunModeMainTab extends CarbideMainTab implements IResourceChangeListener { |
48 public class RunModeMainTab extends CarbideMainTab implements IResourceChangeListener { |
56 this.wantsConnectionUI = wantsConnectionUI; |
56 this.wantsConnectionUI = wantsConnectionUI; |
57 } |
57 } |
58 |
58 |
59 protected Label remoteLabel; |
59 protected Label remoteLabel; |
60 protected Text remoteText; |
60 protected Text remoteText; |
61 protected IConnection connection; |
61 protected String connection; |
62 protected boolean wantsConnectionUI = true; |
62 protected boolean wantsConnectionUI = true; |
63 protected IClientServiceSiteUI clientSiteUI; |
63 protected IClientServiceSiteUI2 clientSiteUI; |
64 |
64 |
65 public void createControl(Composite parent) { |
65 public void createControl(Composite parent) { |
66 Composite comp = new Composite(parent, SWT.NONE); |
66 Composite comp = new Composite(parent, SWT.NONE); |
67 setControl(comp); |
67 setControl(comp); |
68 |
68 |
79 fProjText.setToolTipText(Messages.getString("RunModeMainTab.8")); //$NON-NLS-1$ |
79 fProjText.setToolTipText(Messages.getString("RunModeMainTab.8")); //$NON-NLS-1$ |
80 |
80 |
81 if (wantsConnectionUI) |
81 if (wantsConnectionUI) |
82 { |
82 { |
83 createVerticalSpacer(comp, 1); |
83 createVerticalSpacer(comp, 1); |
84 clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI(LaunchPlugin.getTRKService()); |
84 clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI2(LaunchPlugin.getTRKService()); |
85 clientSiteUI.createComposite(comp); |
85 clientSiteUI.createComposite(comp); |
86 clientSiteUI.addListener(new IListener() { |
86 clientSiteUI.addListener(new IListener() { |
87 public void connectionSelected() { |
87 public void connectionSelected() { |
88 connection = clientSiteUI.getSelectedConnection(); |
88 connection = clientSiteUI.getSelectedConnection(); |
89 updateLaunchConfigurationDialog(); |
89 updateLaunchConfigurationDialog(); |
151 } |
151 } |
152 try { |
152 try { |
153 if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) { |
153 if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) { |
154 config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy()); |
154 config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy()); |
155 } |
155 } |
156 connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config); |
156 connection = RemoteConnectionsTRKHelper.getConnectionIdFromConfig(config); |
157 } catch (CoreException e) { |
157 } catch (CoreException e) { |
158 } |
158 } |
159 if (clientSiteUI != null) |
159 if (clientSiteUI != null) |
160 { |
160 { |
161 if (connection != null) |
161 if (connection != null) |
168 |
168 |
169 public void performApply(ILaunchConfigurationWorkingCopy config) { |
169 public void performApply(ILaunchConfigurationWorkingCopy config) { |
170 super.performApply(config); |
170 super.performApply(config); |
171 config.setAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, remoteText.getText()); |
171 config.setAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, remoteText.getText()); |
172 if (connection != null) { |
172 if (connection != null) { |
173 config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection.getIdentifier()); |
173 config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection); |
174 } |
174 } |
175 // Now check if the process to launch is the main target exe |
175 // Now check if the process to launch is the main target exe |
176 // for debugging. If not, try to set process to launch as the |
176 // for debugging. If not, try to set process to launch as the |
177 // main target if its in the list of target executables |
177 // main target if its in the list of target executables |
178 if (isRemoteTextValid(remoteText.getText()) == null) { |
178 if (isRemoteTextValid(remoteText.getText()) == null) { |
235 result = false; |
235 result = false; |
236 } |
236 } |
237 else { |
237 else { |
238 if (clientSiteUI != null) |
238 if (clientSiteUI != null) |
239 { |
239 { |
240 connection = clientSiteUI.getSelectedConnection(); |
240 IStatus status = clientSiteUI.getSelectionStatus(); |
241 if (connection == null) { |
241 if (!status.isOK()) { |
242 setErrorMessage(Messages.getString("RunModeMainTab.NoConnectionError")); //$NON-NLS-1$ |
242 // unfortunately, no way to display a warning here... |
243 result = false; |
243 setErrorMessage(status.getMessage()); |
|
244 result = status.getSeverity() != IStatus.ERROR; |
244 } |
245 } |
245 } |
246 } |
246 } |
247 } |
247 } |
248 } |
248 |
249 |