debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AppTRKLaunchWizard.java
author stechong
Thu, 18 Jun 2009 16:52:27 -0500
changeset 273 c2533fd23253
parent 212 0e84cf0560e1
child 566 960058f9da89
child 1968 3482df86a51d
permissions -rw-r--r--
Fix for Bug 8513.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     1
/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
* All rights reserved.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
* Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
* Description: 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    15
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    16
*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    17
package com.nokia.cdt.internal.debug.launch.wizard;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    18
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    19
import com.nokia.cdt.debug.cw.symbian.SettingsData;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    20
import com.nokia.cdt.internal.debug.launch.ui.RunModeMainTab;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    21
import com.nokia.cdt.internal.debug.launch.wizard.MainExecutableSelectionWizardPage.IPathValidator;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    22
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    23
import org.eclipse.core.resources.IProject;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    24
import org.eclipse.core.runtime.CoreException;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
import org.eclipse.core.runtime.IPath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
import org.eclipse.debug.core.DebugPlugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    28
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
import java.util.List;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    31
public class AppTRKLaunchWizard extends AbstractLaunchWizard {
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    32
    private BuildOptionsSelectionPage fBuildOptionsSelectionPage;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    33
    private TRKConnectionWizardPage fMainPage;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
    private TRKSISSelectionWizardPage fSISSelectionPage;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
	private boolean hasFinished = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
    public AppTRKLaunchWizard(List<IPath> mmps, List<IPath> exes, IPath defaultExecutable, IProject project, String configurationName) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
    	super(project, configurationName, mmps, exes, defaultExecutable, exes.size() > 1, true);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
		setWindowTitle(Messages.getString("AppTRKLaunchWizard.1")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
212
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    42
	@Override
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    43
	public String getLaunchTypeID() {
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    44
		return SettingsData.APP_TRK_LAUNCH_TYPE_ID;
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    45
	}
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    46
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    47
	@Override
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    48
	public boolean supportsCategory(String categoryId) {
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    49
		return categoryId.equals(PHONE_CATEGORY_ID);
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    50
	}
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    51
0e84cf0560e1 added the new launch wizard UI and updated existing wizards to match. fixed bug where the launch wizard wasn't taking into account if a launch type supported the given mode (run/debug). fixed some problems with the refactor of the t32 and platsim into their own plugins.
wpaul
parents: 0
diff changeset
    52
	public boolean performFinish() {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
    	hasFinished = true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
    	return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    56
 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
    public void addPages() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    58
    	super.addPages();
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    59
        fBuildOptionsSelectionPage = new BuildOptionsSelectionPage();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
        fMainPage = new TRKConnectionWizardPage(this);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    61
        fSISSelectionPage = new TRKSISSelectionWizardPage(this);
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    62
        addPage(fBuildOptionsSelectionPage);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    63
        addPage(fMainPage);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    64
        addPage(fSISSelectionPage);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    65
	    addPage(getSummaryPage());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    66
	    MainExecutableSelectionWizardPage binarySelectionPage = getBinarySelectionPage();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    67
	    if (binarySelectionPage != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    68
			binarySelectionPage.setPathValidator(new IPathValidator() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    69
				public String isValidPath(IPath path) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    70
					return RunModeMainTab.isRemoteTextValid(path.toOSString());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    72
		    });
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
	    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
   }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
    public String toString() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
    	return Messages.getString("AppTRKLaunchWizard.2"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    80
    public String getDescription() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
    	return Messages.getString("AppTRKLaunchWizard.3"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    83
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    84
    public ILaunchConfigurationWorkingCopy createLaunchConfiguration(IPath mmpPath, IPath exePath, IPath processToLaunchTargetPath) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    85
    	// if we haven't finished then don't create anything
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    86
    	if (!hasFinished) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    87
    		return null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    88
    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    89
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    90
    	ILaunchConfigurationWorkingCopy config = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    91
    	try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    92
    		// create our config
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    93
    		config = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(SettingsData.APP_TRK_LAUNCH_TYPE_ID).newInstance(null, getConfigName());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    94
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    95
    		// set the default values
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    96
    		SettingsData.setDefaults(config, SettingsData.LaunchConfig_AppTRK, getProject(), mmpPath, exePath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    97
    		if (processToLaunchTargetPath != null)
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    98
    			SettingsData.setProcessToLaunch(config, processToLaunchTargetPath);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    99
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   100
    		// now let the wizard pages update values 
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
   101
    		fBuildOptionsSelectionPage.updateConfiguration(config);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   102
    		fMainPage.updateConfiguration(config);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   103
    		fSISSelectionPage.updateConfiguration(config);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   104
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
    	} catch (CoreException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   106
			e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   107
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   108
		return config;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
}