debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/ui/RunModeMainTab.java
changeset 728 a39d0ba41f81
parent 621 83547d5dea23
child 730 8ecd45ef360e
equal deleted inserted replaced
727:e9804d5e613f 728:a39d0ba41f81
    36 import org.eclipse.swt.widgets.Label;
    36 import org.eclipse.swt.widgets.Label;
    37 import org.eclipse.swt.widgets.Text;
    37 import org.eclipse.swt.widgets.Text;
    38 
    38 
    39 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
    39 import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
    40 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
    40 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
    41 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI;
    41 import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2;
    42 import com.nokia.carbide.remoteconnections.interfaces.IConnection;
    42 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;
    43 import com.nokia.cdt.internal.debug.launch.LaunchPlugin;
    45 
    44 
    46 import cwdbg.PreferenceConstants;
    45 import cwdbg.PreferenceConstants;
    47 
    46 
    48 public class RunModeMainTab extends CarbideMainTab implements IResourceChangeListener {
    47 public class RunModeMainTab extends CarbideMainTab implements IResourceChangeListener {
    56 		this.wantsConnectionUI = wantsConnectionUI;
    55 		this.wantsConnectionUI = wantsConnectionUI;
    57 	}
    56 	}
    58 
    57 
    59 	protected Label remoteLabel;
    58 	protected Label remoteLabel;
    60 	protected Text remoteText;
    59 	protected Text remoteText;
    61 	protected IConnection connection;
    60 	protected String connection;
    62 	protected boolean wantsConnectionUI = true;
    61 	protected boolean wantsConnectionUI = true;
    63 	protected IClientServiceSiteUI clientSiteUI;
    62 	protected IClientServiceSiteUI2 clientSiteUI;
    64 	
    63 	
    65 	public void createControl(Composite parent) {
    64 	public void createControl(Composite parent) {
    66 		Composite comp = new Composite(parent, SWT.NONE);
    65 		Composite comp = new Composite(parent, SWT.NONE);
    67 		setControl(comp);
    66 		setControl(comp);
    68 		
    67 		
    79 		fProjText.setToolTipText(Messages.getString("RunModeMainTab.8")); //$NON-NLS-1$
    78 		fProjText.setToolTipText(Messages.getString("RunModeMainTab.8")); //$NON-NLS-1$
    80 
    79 
    81 		if (wantsConnectionUI)
    80 		if (wantsConnectionUI)
    82 		{
    81 		{
    83 			createVerticalSpacer(comp, 1);
    82 			createVerticalSpacer(comp, 1);
    84 			clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI(LaunchPlugin.getTRKService());
    83 			clientSiteUI = RemoteConnectionsActivator.getConnectionsManager().getClientSiteUI2(LaunchPlugin.getTRKService());
    85 			clientSiteUI.createComposite(comp);
    84 			clientSiteUI.createComposite(comp);
    86 			clientSiteUI.addListener(new IListener() {
    85 			clientSiteUI.addListener(new IListener() {
    87 				public void connectionSelected() {
    86 				public void connectionSelected() {
    88 					connection = clientSiteUI.getSelectedConnection();
    87 					connection = clientSiteUI.getSelectedConnection();
    89 					updateLaunchConfigurationDialog();
    88 					updateLaunchConfigurationDialog();
   151 		}
   150 		}
   152 		try {
   151 		try {
   153 	        if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) {
   152 	        if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) {
   154 	        	config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy());
   153 	        	config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy());
   155 	        }
   154 	        }
   156 			connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config);
   155 			connection = RemoteConnectionsTRKHelper.getConnectionIdFromConfig(config);
   157 		} catch (CoreException e) {
   156 		} catch (CoreException e) {
   158 		}
   157 		}
   159 		if (clientSiteUI != null)
   158 		if (clientSiteUI != null)
   160 		{
   159 		{
   161 			if (connection != null)
   160 			if (connection != null)
   168 
   167 
   169 	public void performApply(ILaunchConfigurationWorkingCopy config) {
   168 	public void performApply(ILaunchConfigurationWorkingCopy config) {
   170 		super.performApply(config);
   169 		super.performApply(config);
   171 		config.setAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, remoteText.getText());
   170 		config.setAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, remoteText.getText());
   172 		if (connection != null) {
   171 		if (connection != null) {
   173 			config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection.getIdentifier());
   172 			config.setAttribute(RemoteConnectionsTRKHelper.CONNECTION_ATTRIBUTE, connection);
   174 		}		
   173 		}		
   175 		// Now check if the process to launch is the main target exe 
   174 		// 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 
   175 		// for debugging. If not, try to set process to launch as the 
   177 		// main target if its in the list of target executables
   176 		// main target if its in the list of target executables
   178 		if (isRemoteTextValid(remoteText.getText()) == null) {
   177 		if (isRemoteTextValid(remoteText.getText()) == null) {