debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/TRKLaunchDelegate.java
author tzelaw
Tue, 14 Apr 2009 15:03:19 -0500
changeset 94 d74b720418db
parent 2 d760517a8095
child 728 a39d0ba41f81
child 857 d66843399035
permissions -rw-r--r--
Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
/*
cawthron
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
cawthron
parents:
diff changeset
     3
* All rights reserved.
cawthron
parents:
diff changeset
     4
* This component and the accompanying materials are made available
cawthron
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
cawthron
parents:
diff changeset
     6
* which accompanies this distribution, and is available
cawthron
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
cawthron
parents:
diff changeset
     8
*
cawthron
parents:
diff changeset
     9
* Initial Contributors:
cawthron
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
cawthron
parents:
diff changeset
    11
*
cawthron
parents:
diff changeset
    12
* Contributors:
cawthron
parents:
diff changeset
    13
*
cawthron
parents:
diff changeset
    14
* Description: 
cawthron
parents:
diff changeset
    15
*
cawthron
parents:
diff changeset
    16
*/
cawthron
parents:
diff changeset
    17
package com.nokia.cdt.internal.debug.launch;
cawthron
parents:
diff changeset
    18
cawthron
parents:
diff changeset
    19
import java.io.File;
cawthron
parents:
diff changeset
    20
cawthron
parents:
diff changeset
    21
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
cawthron
parents:
diff changeset
    22
import org.eclipse.cdt.core.model.ICProject;
cawthron
parents:
diff changeset
    23
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
cawthron
parents:
diff changeset
    24
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
cawthron
parents:
diff changeset
    25
import org.eclipse.cdt.debug.core.cdi.ICDISession;
cawthron
parents:
diff changeset
    26
import org.eclipse.cdt.ui.CUIPlugin;
cawthron
parents:
diff changeset
    27
import org.eclipse.core.runtime.*;
cawthron
parents:
diff changeset
    28
import org.eclipse.debug.core.*;
cawthron
parents:
diff changeset
    29
import org.eclipse.jface.dialogs.MessageDialog;
cawthron
parents:
diff changeset
    30
import org.eclipse.swt.widgets.Display;
cawthron
parents:
diff changeset
    31
cawthron
parents:
diff changeset
    32
import com.freescale.cdt.debug.cw.CWException;
cawthron
parents:
diff changeset
    33
import com.freescale.cdt.debug.cw.core.RemoteConnectionsTRKHelper;
cawthron
parents:
diff changeset
    34
import com.freescale.cdt.debug.cw.core.cdi.Session;
94
d74b720418db Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality
tzelaw
parents: 2
diff changeset
    35
import com.freescale.cdt.debug.cw.core.cdi.model.Target;
2
cawthron
parents:
diff changeset
    36
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
cawthron
parents:
diff changeset
    37
import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
cawthron
parents:
diff changeset
    38
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
cawthron
parents:
diff changeset
    39
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
cawthron
parents:
diff changeset
    40
import com.nokia.carbide.remoteconnections.interfaces.IConnection;
cawthron
parents:
diff changeset
    41
import com.nokia.cdt.debug.cw.symbian.SettingsData;
cawthron
parents:
diff changeset
    42
import com.nokia.cdt.debug.cw.symbian.SymbianPlugin;
cawthron
parents:
diff changeset
    43
import com.nokia.cdt.internal.debug.launch.ui.PartialUpgradeAlertDialog;
cawthron
parents:
diff changeset
    44
cawthron
parents:
diff changeset
    45
import cwdbg.PreferenceConstants;
cawthron
parents:
diff changeset
    46
cawthron
parents:
diff changeset
    47
public class TRKLaunchDelegate extends NokiaAbstractLaunchDelegate {
cawthron
parents:
diff changeset
    48
cawthron
parents:
diff changeset
    49
	private static final String DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION = "DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION"; //$NON-NLS-1$
cawthron
parents:
diff changeset
    50
	private static final int LARGE_SIS_THRESHOLD = 250 * 1024; // 250K
cawthron
parents:
diff changeset
    51
	
cawthron
parents:
diff changeset
    52
	protected Session cwDebugSession;
cawthron
parents:
diff changeset
    53
	
cawthron
parents:
diff changeset
    54
	
cawthron
parents:
diff changeset
    55
	public void launch(
cawthron
parents:
diff changeset
    56
			ILaunchConfiguration 	config, 
cawthron
parents:
diff changeset
    57
			String 					mode, 
cawthron
parents:
diff changeset
    58
			ILaunch 				launch, 
cawthron
parents:
diff changeset
    59
			IProgressMonitor monitor) throws CoreException 
cawthron
parents:
diff changeset
    60
	{
cawthron
parents:
diff changeset
    61
	// See comment at definition of the "mutex" for why this "synchronized".		
cawthron
parents:
diff changeset
    62
	synchronized(Session.sessionStartStopMutex()) {
cawthron
parents:
diff changeset
    63
cawthron
parents:
diff changeset
    64
		cwDebugSession = null;
cawthron
parents:
diff changeset
    65
cawthron
parents:
diff changeset
    66
		if (monitor == null) {
cawthron
parents:
diff changeset
    67
            monitor = new NullProgressMonitor();
cawthron
parents:
diff changeset
    68
        }
cawthron
parents:
diff changeset
    69
cawthron
parents:
diff changeset
    70
        monitor.beginTask(LaunchMessages.getString("LocalRunLaunchDelegate.Launching_Local_C_Application"), 10); //$NON-NLS-1$
cawthron
parents:
diff changeset
    71
        // check for cancellation
cawthron
parents:
diff changeset
    72
        if (monitor.isCanceled()) {
cawthron
parents:
diff changeset
    73
            return;
cawthron
parents:
diff changeset
    74
        }
cawthron
parents:
diff changeset
    75
		
cawthron
parents:
diff changeset
    76
        if (!RemoteConnectionsTRKHelper.configUsesConnectionAttribute(config)) {
cawthron
parents:
diff changeset
    77
        	config = RemoteConnectionsTRKHelper.attemptUpdateLaunchConfiguration(config.getWorkingCopy());
cawthron
parents:
diff changeset
    78
        }
cawthron
parents:
diff changeset
    79
        
cawthron
parents:
diff changeset
    80
        final IConnection connection = RemoteConnectionsTRKHelper.getConnectionFromConfig(config);
cawthron
parents:
diff changeset
    81
		if (connection == null) {
cawthron
parents:
diff changeset
    82
			IStatus status = new Status(Status.ERROR, LaunchPlugin.PLUGIN_ID, 
cawthron
parents:
diff changeset
    83
				LaunchMessages.getString("TRKLaunchDelegate.NoConnectionErrorMsg")); //$NON-NLS-1$
cawthron
parents:
diff changeset
    84
			throw new DebugException(status);
cawthron
parents:
diff changeset
    85
		}
cawthron
parents:
diff changeset
    86
		connection.useConnection(true);
cawthron
parents:
diff changeset
    87
		
cawthron
parents:
diff changeset
    88
        try {
cawthron
parents:
diff changeset
    89
        	addBeingLaunched(config); // indicating the LC is being launched
cawthron
parents:
diff changeset
    90
        	
cawthron
parents:
diff changeset
    91
            monitor.worked(1);
cawthron
parents:
diff changeset
    92
            IPath exePath = verifyProgramPath(config);
cawthron
parents:
diff changeset
    93
            ICProject project = verifyCProject(config);
cawthron
parents:
diff changeset
    94
            IBinaryObject exeFile = verifyBinary(project, exePath);
cawthron
parents:
diff changeset
    95
            String arguments[] = getProgramArgumentsArray(config);
cawthron
parents:
diff changeset
    96
cawthron
parents:
diff changeset
    97
            // See comment for this method for more.
cawthron
parents:
diff changeset
    98
            SettingsData.setInternalPreferences(config, SettingsData.LaunchConfig_AppTRK);
cawthron
parents:
diff changeset
    99
            
cawthron
parents:
diff changeset
   100
            // set the partial upgrade pref value
cawthron
parents:
diff changeset
   101
            ILaunchConfigurationWorkingCopy workingCopy = config.getWorkingCopy();
cawthron
parents:
diff changeset
   102
            workingCopy.setAttribute(PreferenceConstants.J_PN_PUSisFileHostPath, ""); //$NON-NLS-1$
cawthron
parents:
diff changeset
   103
            
cawthron
parents:
diff changeset
   104
            String sisHostPath = config.getAttribute(PreferenceConstants.J_PN_SisFileHostPath, ""); //$NON-NLS-1$
cawthron
parents:
diff changeset
   105
            if (sisHostPath.length() > 0) {
cawthron
parents:
diff changeset
   106
            	// app trk launch - see if there's a partial upgrade sis file
cawthron
parents:
diff changeset
   107
            	IPath sisPath = new Path(sisHostPath);
cawthron
parents:
diff changeset
   108
            	String buildConfigName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
cawthron
parents:
diff changeset
   109
				if (buildConfigName.length() > 0) {
cawthron
parents:
diff changeset
   110
			        ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project.getProject());
cawthron
parents:
diff changeset
   111
			        if (cpi != null) {
cawthron
parents:
diff changeset
   112
			        	for (ICarbideBuildConfiguration buildConfig : cpi.getBuildConfigurations()) {
cawthron
parents:
diff changeset
   113
			        		if (buildConfig.getDisplayString().equals(buildConfigName)) {
cawthron
parents:
diff changeset
   114
								IPath puSisPath = CarbideCPPBuilder.getPartialUpgradeSisPath(buildConfig, sisPath);
cawthron
parents:
diff changeset
   115
								if (puSisPath != null && puSisPath.toFile().exists()) {
cawthron
parents:
diff changeset
   116
									workingCopy.setAttribute(PreferenceConstants.J_PN_PUSisFileHostPath, puSisPath.toOSString());
cawthron
parents:
diff changeset
   117
								}
cawthron
parents:
diff changeset
   118
								break;
cawthron
parents:
diff changeset
   119
			        		}
cawthron
parents:
diff changeset
   120
			        	}
cawthron
parents:
diff changeset
   121
			        }
cawthron
parents:
diff changeset
   122
				}
cawthron
parents:
diff changeset
   123
			}
cawthron
parents:
diff changeset
   124
            
cawthron
parents:
diff changeset
   125
            // save the changes
cawthron
parents:
diff changeset
   126
            workingCopy.doSave();
cawthron
parents:
diff changeset
   127
                        
cawthron
parents:
diff changeset
   128
            // set the default source locator if required
cawthron
parents:
diff changeset
   129
            setDefaultSourceLocator(launch, config);
cawthron
parents:
diff changeset
   130
cawthron
parents:
diff changeset
   131
            if (mode.equals(ILaunchManager.DEBUG_MODE)) {
cawthron
parents:
diff changeset
   132
                // debug mode
cawthron
parents:
diff changeset
   133
                ICDebugConfiguration debugConfig = getDebugConfig(config);
cawthron
parents:
diff changeset
   134
                ICDISession dsession = null;
cawthron
parents:
diff changeset
   135
                String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
cawthron
parents:
diff changeset
   136
                        ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
cawthron
parents:
diff changeset
   137
                if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
cawthron
parents:
diff changeset
   138
                    dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
cawthron
parents:
diff changeset
   139
                            new SubProgressMonitor(monitor, 8));
cawthron
parents:
diff changeset
   140
cawthron
parents:
diff changeset
   141
					assert(dsession instanceof Session);
cawthron
parents:
diff changeset
   142
					cwDebugSession = (Session)dsession;
cawthron
parents:
diff changeset
   143
cawthron
parents:
diff changeset
   144
					doAdditionalSessionSetup(cwDebugSession);
cawthron
parents:
diff changeset
   145
					
cawthron
parents:
diff changeset
   146
					IPath[] otherExecutables = getOtherExecutables(project, exePath, config, monitor);					
cawthron
parents:
diff changeset
   147
					{
cawthron
parents:
diff changeset
   148
						try {
cawthron
parents:
diff changeset
   149
							monitor.worked(1);
cawthron
parents:
diff changeset
   150
							
cawthron
parents:
diff changeset
   151
							// if enabled in the prefs, show the console view(s)
cawthron
parents:
diff changeset
   152
							if (config.getAttribute(PreferenceConstants.J_PN_ViewUnframedData, false)) {
cawthron
parents:
diff changeset
   153
								SymbianPlugin.getDefault().openUnframedDataConsole(true);
cawthron
parents:
diff changeset
   154
							}
cawthron
parents:
diff changeset
   155
cawthron
parents:
diff changeset
   156
							if (config.getAttribute(PreferenceConstants.J_PN_ViewCommMessages, false)) {
cawthron
parents:
diff changeset
   157
								SymbianPlugin.getDefault().openTRKCommLogConsole(true);
cawthron
parents:
diff changeset
   158
							}
cawthron
parents:
diff changeset
   159
							
cawthron
parents:
diff changeset
   160
							config = synchronizeWithProjectAccessPaths(project, config);
cawthron
parents:
diff changeset
   161
							
cawthron
parents:
diff changeset
   162
							File wd = getWorkingDirectory(config);
94
d74b720418db Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality
tzelaw
parents: 2
diff changeset
   163
							Target target = cwDebugSession.launchExecutable(launch, config, exeFile, otherExecutables, arguments, wd, getEnvironmentAsProperty(config), monitor, project, getTargetLabel(exeFile.getName()), true);
d74b720418db Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality
tzelaw
parents: 2
diff changeset
   164
							ATFLaunchSupport.saveDebugTargetFromLaunchDelegate(target.getCoreModelTarget());
d74b720418db Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality
tzelaw
parents: 2
diff changeset
   165
							
2
cawthron
parents:
diff changeset
   166
						} catch (CoreException e) {
cawthron
parents:
diff changeset
   167
							Session session = (Session)dsession;
cawthron
parents:
diff changeset
   168
							session.cleanupAfterLaunchFailure();
cawthron
parents:
diff changeset
   169
							throw e;
cawthron
parents:
diff changeset
   170
						} catch (Exception e) {
cawthron
parents:
diff changeset
   171
							Session session = (Session)dsession;
cawthron
parents:
diff changeset
   172
							session.debuggingStopped(null);
cawthron
parents:
diff changeset
   173
							this.abort(e.getLocalizedMessage(), null, 0);
cawthron
parents:
diff changeset
   174
						}
cawthron
parents:
diff changeset
   175
					}
cawthron
parents:
diff changeset
   176
                }
cawthron
parents:
diff changeset
   177
            }
cawthron
parents:
diff changeset
   178
            else if (mode.equals(ILaunchManager.RUN_MODE)) {
cawthron
parents:
diff changeset
   179
                // Run the program.
cawthron
parents:
diff changeset
   180
            	// Connect to DE, download and launch the program, close debug session.
cawthron
parents:
diff changeset
   181
                ICDebugConfiguration debugConfig = getDebugConfig(config);
cawthron
parents:
diff changeset
   182
                ICDISession dsession = null;
cawthron
parents:
diff changeset
   183
                
cawthron
parents:
diff changeset
   184
                // Set up communication with DE.
cawthron
parents:
diff changeset
   185
                dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
cawthron
parents:
diff changeset
   186
                            new SubProgressMonitor(monitor, 8));
cawthron
parents:
diff changeset
   187
cawthron
parents:
diff changeset
   188
                // Launch the program through the DE.
cawthron
parents:
diff changeset
   189
                cwDebugSession = (Session)dsession;
cawthron
parents:
diff changeset
   190
				cwDebugSession.launchExecutable(
cawthron
parents:
diff changeset
   191
										launch, 
cawthron
parents:
diff changeset
   192
										config, 
cawthron
parents:
diff changeset
   193
										exeFile, 
cawthron
parents:
diff changeset
   194
										new IPath[0], 
cawthron
parents:
diff changeset
   195
										arguments, 
cawthron
parents:
diff changeset
   196
										null, 
cawthron
parents:
diff changeset
   197
										getEnvironmentAsProperty(config), 
cawthron
parents:
diff changeset
   198
										monitor, 
cawthron
parents:
diff changeset
   199
										project, 
cawthron
parents:
diff changeset
   200
										"",  //$NON-NLS-1$
cawthron
parents:
diff changeset
   201
										false  /* run instead of debug */);
cawthron
parents:
diff changeset
   202
				
cawthron
parents:
diff changeset
   203
				// The above call would throw exception on error. So it must have succeeded 
cawthron
parents:
diff changeset
   204
				// if control gets here. Show success message in a dialog.
cawthron
parents:
diff changeset
   205
	    		//
cawthron
parents:
diff changeset
   206
	    		// get the name of the executable that's launched instead of, say, the DLL name if
cawthron
parents:
diff changeset
   207
	    		// exeFile is a DLL.
cawthron
parents:
diff changeset
   208
	    		final String exeLaunched = config.getAttribute(PreferenceConstants.J_PN_RemoteProcessToLaunch, exeFile.toString());
cawthron
parents:
diff changeset
   209
				Display display = Display.getCurrent();
cawthron
parents:
diff changeset
   210
				if (display == null) {
cawthron
parents:
diff changeset
   211
					display = Display.getDefault();
cawthron
parents:
diff changeset
   212
				}
cawthron
parents:
diff changeset
   213
				
cawthron
parents:
diff changeset
   214
				display.syncExec(new Runnable() {
cawthron
parents:
diff changeset
   215
					public void run() {
cawthron
parents:
diff changeset
   216
						connection.useConnection(false);
cawthron
parents:
diff changeset
   217
						MessageDialog.openInformation(
cawthron
parents:
diff changeset
   218
							CUIPlugin.getActiveWorkbenchShell(),
cawthron
parents:
diff changeset
   219
							LaunchMessages.getString("CarbideCPPLaunchDelegate.DebuggerName"),  //$NON-NLS-1$
cawthron
parents:
diff changeset
   220
							LaunchMessages.getString("TRKLaunchDelegate.runSucceed") + //$NON-NLS-1$
cawthron
parents:
diff changeset
   221
						           "\n\t\"" + exeLaunched + "\""); //$NON-NLS-1$ //$NON-NLS-2$
cawthron
parents:
diff changeset
   222
					}
cawthron
parents:
diff changeset
   223
				});
cawthron
parents:
diff changeset
   224
            }
cawthron
parents:
diff changeset
   225
        } catch (CWException e) {
cawthron
parents:
diff changeset
   226
       		connection.useConnection(false);
cawthron
parents:
diff changeset
   227
        	if (! monitor.isCanceled()) // don't throw on user cancellation
cawthron
parents:
diff changeset
   228
        		e.printStackTrace();
cawthron
parents:
diff changeset
   229
		} catch (CoreException e) {
cawthron
parents:
diff changeset
   230
			connection.useConnection(false);
cawthron
parents:
diff changeset
   231
        	if (! monitor.isCanceled()) // don't throw on user cancellation
cawthron
parents:
diff changeset
   232
        		throw e;
cawthron
parents:
diff changeset
   233
		} finally {
cawthron
parents:
diff changeset
   234
            monitor.done();
cawthron
parents:
diff changeset
   235
            removeBeingLaunched(config);
cawthron
parents:
diff changeset
   236
        }
cawthron
parents:
diff changeset
   237
	} // end of synchronized.
cawthron
parents:
diff changeset
   238
	}
cawthron
parents:
diff changeset
   239
cawthron
parents:
diff changeset
   240
	@Override
cawthron
parents:
diff changeset
   241
	public boolean buildForLaunch(final ILaunchConfiguration configuration,
cawthron
parents:
diff changeset
   242
			String mode, IProgressMonitor monitor) throws CoreException {
cawthron
parents:
diff changeset
   243
		// for app trk, check to see if we need to ask the user if they want to enable
cawthron
parents:
diff changeset
   244
		// partial upgrade builds
cawthron
parents:
diff changeset
   245
        String sisHostPath = configuration.getAttribute(PreferenceConstants.J_PN_SisFileHostPath, ""); //$NON-NLS-1$
cawthron
parents:
diff changeset
   246
        if (sisHostPath.length() > 0) {
cawthron
parents:
diff changeset
   247
        	// app trk launch - see if the partial upgrade option is enabled
cawthron
parents:
diff changeset
   248
        	IPath sisPath = new Path(sisHostPath);
cawthron
parents:
diff changeset
   249
        	String buildConfigName = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, ""); //$NON-NLS-1$
cawthron
parents:
diff changeset
   250
			if (buildConfigName.length() > 0) {
cawthron
parents:
diff changeset
   251
	            final ICProject project = verifyCProject(configuration);
cawthron
parents:
diff changeset
   252
		        ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project.getProject());
cawthron
parents:
diff changeset
   253
		        if (cpi != null) {
cawthron
parents:
diff changeset
   254
		        	for (ICarbideBuildConfiguration buildConfig : cpi.getBuildConfigurations()) {
cawthron
parents:
diff changeset
   255
		        		if (buildConfig.getDisplayString().equals(buildConfigName)) {
cawthron
parents:
diff changeset
   256
							if (null == CarbideCPPBuilder.getPartialUpgradeSisPath(buildConfig, sisPath)) {
cawthron
parents:
diff changeset
   257
								if (!configuration.getAttribute(DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION, false)) {
cawthron
parents:
diff changeset
   258
									// get the size of the sis file if it exists
cawthron
parents:
diff changeset
   259
									File sisFile = sisPath.toFile();
cawthron
parents:
diff changeset
   260
									if (sisFile.exists() && sisFile.length() > LARGE_SIS_THRESHOLD) {
cawthron
parents:
diff changeset
   261
										// it's larger than the threshold so present dialog.
cawthron
parents:
diff changeset
   262
										
cawthron
parents:
diff changeset
   263
										Display.getDefault().syncExec(new Runnable() {
cawthron
parents:
diff changeset
   264
cawthron
parents:
diff changeset
   265
											public void run() {
cawthron
parents:
diff changeset
   266
												PartialUpgradeAlertDialog dlg = new PartialUpgradeAlertDialog(CUIPlugin.getActiveWorkbenchShell(), project.getProject());
cawthron
parents:
diff changeset
   267
												dlg.open();
cawthron
parents:
diff changeset
   268
cawthron
parents:
diff changeset
   269
												// if they check the option then remember it
cawthron
parents:
diff changeset
   270
												if (dlg.dontAskAgain()) {
cawthron
parents:
diff changeset
   271
										            try {
cawthron
parents:
diff changeset
   272
										            	ILaunchConfigurationWorkingCopy workingCopy = configuration.getWorkingCopy();
cawthron
parents:
diff changeset
   273
														workingCopy.setAttribute(DONT_ASK_ABOUT_PARTIAL_UPGRADE_OPTION, true);
cawthron
parents:
diff changeset
   274
cawthron
parents:
diff changeset
   275
														// save the changes
cawthron
parents:
diff changeset
   276
											            workingCopy.doSave();
cawthron
parents:
diff changeset
   277
													} catch (CoreException e) {
cawthron
parents:
diff changeset
   278
														e.printStackTrace();
cawthron
parents:
diff changeset
   279
														LaunchPlugin.log(e);
cawthron
parents:
diff changeset
   280
													}
cawthron
parents:
diff changeset
   281
												}
cawthron
parents:
diff changeset
   282
											}
cawthron
parents:
diff changeset
   283
										});
cawthron
parents:
diff changeset
   284
									}
cawthron
parents:
diff changeset
   285
								}
cawthron
parents:
diff changeset
   286
							}
cawthron
parents:
diff changeset
   287
							break;
cawthron
parents:
diff changeset
   288
		        		}
cawthron
parents:
diff changeset
   289
		        	}
cawthron
parents:
diff changeset
   290
		        }
cawthron
parents:
diff changeset
   291
			}
cawthron
parents:
diff changeset
   292
		}
cawthron
parents:
diff changeset
   293
		
cawthron
parents:
diff changeset
   294
		
cawthron
parents:
diff changeset
   295
		return super.buildForLaunch(configuration, mode, monitor);
cawthron
parents:
diff changeset
   296
	}
cawthron
parents:
diff changeset
   297
}