debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/wizard/AttachTRKLaunchWizard.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 org.eclipse.core.resources.IProject;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    20
import org.eclipse.core.runtime.CoreException;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    21
import org.eclipse.core.runtime.IPath;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    22
import org.eclipse.debug.core.DebugPlugin;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    23
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    24
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
import java.util.List;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import com.nokia.cdt.debug.cw.symbian.SettingsData;
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
public class AttachTRKLaunchWizard extends AbstractLaunchWizard {
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    30
    private BuildOptionsSelectionPage fBuildOptionsSelectionPage;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    31
    private TRKConnectionWizardPage fMainPage;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    32
	private boolean hasFinished = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    33
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
    public AttachTRKLaunchWizard(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
    35
    	super(project, configurationName, mmps, exes, defaultExecutable, false, false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
		setWindowTitle(Messages.getString("AttachTRKLaunchWizard.1")); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
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
    39
	@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
    40
	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
    41
		return SettingsData.ATTACH_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
    42
	}
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
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
	@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
    45
	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
    46
		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
    47
	}
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
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    49
    public boolean performFinish() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    50
    	hasFinished = true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    51
    	return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    52
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
    public void addPages() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
    	super.addPages();
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    56
        fBuildOptionsSelectionPage = new BuildOptionsSelectionPage();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
        fMainPage = new TRKConnectionWizardPage(this);
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    58
        addPage(fBuildOptionsSelectionPage);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    59
        addPage(fMainPage);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
	    addPage(getSummaryPage());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    61
   }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    62
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    63
    public String toString() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    64
    	return Messages.getString("AttachTRKLaunchWizard.2"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    65
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    66
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    67
    public String getDescription() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    68
    	return Messages.getString("AttachTRKLaunchWizard.3"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    69
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    70
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
    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
    72
    	// 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
    73
    	if (!hasFinished) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
    		return null;
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
    	ILaunchConfigurationWorkingCopy config = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
    	try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
    		// create our config
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    80
    		config = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(SettingsData.ATTACH_LAUNCH_TYPE_ID).newInstance(null, getConfigName());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
    		// set the default values
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    83
    		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
    84
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    85
    		// now let the wizard pages update values 
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    86
    		fBuildOptionsSelectionPage.updateConfiguration(config);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    87
    		fMainPage.updateConfiguration(config);
273
c2533fd23253 Fix for Bug 8513.
stechong
parents: 212
diff changeset
    88
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    89
    	} catch (CoreException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    90
			e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    91
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    92
		return config;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    93
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    94
}