author | dadubrow |
Wed, 20 Oct 2010 09:35:54 -0500 | |
changeset 2163 | f0a9f2d04d4a |
parent 2160 | 3a82092877ea |
permissions | -rw-r--r-- |
956 | 1 |
/* |
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
package com.nokia.cdt.internal.debug.launch.newwizard; |
|
19 |
||
20 |
import java.text.MessageFormat; |
|
21 |
||
22 |
import org.eclipse.core.runtime.IPath; |
|
1090 | 23 |
import org.eclipse.core.runtime.Path; |
956 | 24 |
import org.eclipse.core.runtime.Status; |
25 |
import org.eclipse.swt.widgets.Composite; |
|
26 |
import org.eclipse.swt.widgets.Shell; |
|
27 |
||
28 |
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
|
29 |
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; |
|
30 |
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; |
|
31 |
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; |
|
2163 | 32 |
import com.nokia.cdt.internal.debug.launch.newwizard.IDebugRunProcessWizardData.EExeSelection; |
956 | 33 |
import com.nokia.cpp.internal.api.utils.core.PathUtils; |
34 |
||
35 |
/** |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class DebugRunProcessSection extends AbstractLaunchWizardSection { |
|
2163 | 39 |
|
40 |
private IDebugRunProcessWizardData debugRunProcessWizardData; |
|
956 | 41 |
|
2163 | 42 |
public DebugRunProcessSection(IWizardData data, AbstractUnifiedLaunchOptionsPage launchOptionsPage) { |
969 | 43 |
super(data, MessageFormat.format(Messages.getString("DebugRunProcessSection.Title"), data.getModeLabel()), launchOptionsPage); //$NON-NLS-1$ |
2163 | 44 |
debugRunProcessWizardData = (IDebugRunProcessWizardData) data; |
956 | 45 |
} |
46 |
||
47 |
@Override |
|
48 |
public void createControl(Composite parent) { |
|
49 |
createSection(parent, 1); |
|
50 |
} |
|
51 |
||
52 |
@Override |
|
53 |
protected void dispose() { |
|
54 |
||
55 |
} |
|
56 |
||
57 |
@Override |
|
58 |
public void initializeSettings() { |
|
2163 | 59 |
debugRunProcessWizardData.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); |
60 |
if (debugRunProcessWizardData.getLaunchableExes().size() > 0) |
|
61 |
debugRunProcessWizardData.setExeSelectionPath(debugRunProcessWizardData.getLaunchableExes().get(0)); |
|
62 |
else if (debugRunProcessWizardData.getDefaultExecutable() != null) |
|
63 |
debugRunProcessWizardData.setExeSelectionPath(debugRunProcessWizardData.getDefaultExecutable()); |
|
64 |
if (Path.EMPTY.equals(debugRunProcessWizardData.getExeSelectionPath())) |
|
65 |
debugRunProcessWizardData.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); |
|
1211 | 66 |
|
956 | 67 |
ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(data.getProject()); |
1211 | 68 |
boolean hasSisInstall = false; |
956 | 69 |
if (cpi != null) { |
70 |
ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); |
|
71 |
for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { |
|
72 |
IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath(); |
|
2163 | 73 |
debugRunProcessWizardData.setSisPath(sisPath.toOSString()); |
1211 | 74 |
if (info.isEnabled()) { |
75 |
hasSisInstall = true; |
|
76 |
break; |
|
77 |
} |
|
956 | 78 |
} |
79 |
} |
|
1211 | 80 |
|
2163 | 81 |
if (debugRunProcessWizardData.getExeSelection().equals(EExeSelection.ATTACH_TO_PROCESS)) { |
82 |
debugRunProcessWizardData.setInstallPackage(false); |
|
1211 | 83 |
} else { |
2163 | 84 |
Boolean detectedSysTrk = debugRunProcessWizardData.isSysTRKConnection(); // TRUE, FALSE, or null |
85 |
boolean isSysTrk = detectedSysTrk == Boolean.TRUE || (detectedSysTrk == null && debugRunProcessWizardData.isInternalLayout()); |
|
86 |
debugRunProcessWizardData.setInstallPackage(hasSisInstall || !isSysTrk); |
|
1211 | 87 |
} |
88 |
||
956 | 89 |
} |
90 |
||
91 |
@Override |
|
92 |
protected AbstractLaunchSettingsDialog createChangeSettingsDialog( |
|
2163 | 93 |
Shell shell, IWizardData dialogData) { |
956 | 94 |
return new DebugRunProcessDialog(shell, dialogData); |
95 |
} |
|
96 |
||
97 |
@Override |
|
98 |
protected void refresh() { |
|
99 |
updateUI(); |
|
100 |
} |
|
101 |
||
102 |
@Override |
|
103 |
protected void validate() { |
|
104 |
||
105 |
status = Status.OK_STATUS; |
|
106 |
||
2163 | 107 |
switch (debugRunProcessWizardData.getExeSelection()) { |
956 | 108 |
case USE_PROJECT_EXECUTABLE: |
2163 | 109 |
if (debugRunProcessWizardData.getExeSelectionPath() == null) |
969 | 110 |
status = error(Messages.getString("DebugRunProcessSection.NoExesError"), //$NON-NLS-1$ |
956 | 111 |
data.getModeLabel().toLowerCase()); |
112 |
break; |
|
113 |
case USE_REMOTE_EXECUTABLE: |
|
2163 | 114 |
if (debugRunProcessWizardData.getExeSelectionPath() == null) |
969 | 115 |
status = error(Messages.getString("DebugRunProcessSection.NoRemoteExeError"), //$NON-NLS-1$ |
956 | 116 |
data.getModeLabel().toLowerCase()); |
117 |
break; |
|
118 |
case ATTACH_TO_PROCESS: |
|
119 |
break; |
|
120 |
} |
|
121 |
||
2163 | 122 |
if (debugRunProcessWizardData.isInstallPackage() && (debugRunProcessWizardData.getSisPath() == null || debugRunProcessWizardData.getSisPath().length() == 0)) |
1186
067198a8221d
Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents:
1090
diff
changeset
|
123 |
status = error(Messages.getString("DebugRunProcessSection.MustInstallError"), |
067198a8221d
Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents:
1090
diff
changeset
|
124 |
data.getModeLabel().toLowerCase()); //$NON-NLS-1$ |
956 | 125 |
} |
126 |
||
127 |
@Override |
|
128 |
protected void updateUI() { |
|
129 |
||
130 |
validate(); |
|
131 |
||
132 |
if (status.isOK()) { |
|
969 | 133 |
String mainFormat = Messages.getString("DebugRunProcessSection.MainFormat"); //$NON-NLS-1$ |
134 |
String copyOrInstallMsg = ""; //$NON-NLS-1$ |
|
135 |
String runOrLaunchMsg = ""; //$NON-NLS-1$ |
|
956 | 136 |
|
2163 | 137 |
switch (debugRunProcessWizardData.getExeSelection()) { |
956 | 138 |
case USE_PROJECT_EXECUTABLE: |
1186
067198a8221d
Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents:
1090
diff
changeset
|
139 |
runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), |
2163 | 140 |
debugRunProcessWizardData.getExeSelectionPath().lastSegment()); //$NON-NLS-1$ |
956 | 141 |
break; |
142 |
case USE_REMOTE_EXECUTABLE: |
|
1186
067198a8221d
Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents:
1090
diff
changeset
|
143 |
runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), |
2163 | 144 |
PathUtils.convertPathToWindows(debugRunProcessWizardData.getExeSelectionPath().toString())); //$NON-NLS-1$ |
956 | 145 |
break; |
146 |
case ATTACH_TO_PROCESS: |
|
969 | 147 |
runOrLaunchMsg = Messages.getString("DebugRunProcessSection.AttachMsg"); //$NON-NLS-1$ |
956 | 148 |
break; |
149 |
} |
|
150 |
||
151 |
copyOrInstallMsg = getCopyOrInstallMsg(); |
|
152 |
||
153 |
String runOrDebugProcessMessage = MessageFormat.format(mainFormat, copyOrInstallMsg, runOrLaunchMsg); |
|
154 |
descriptionLabel.setText(runOrDebugProcessMessage); |
|
155 |
} else { |
|
969 | 156 |
descriptionLabel.setText(status.getMessage() + "\n\n" + //$NON-NLS-1$ |
157 |
MessageFormat.format(Messages.getString("DebugRunProcessSection.ChangeMsg"), //$NON-NLS-1$ |
|
956 | 158 |
data.getModeLabel().toLowerCase())); |
159 |
} |
|
160 |
} |
|
161 |
||
162 |
private String getCopyOrInstallMsg() { |
|
2163 | 163 |
if (debugRunProcessWizardData.requiresInstallPackage()) |
164 |
return MessageFormat.format(Messages.getString("DebugRunProcessSection.InstallMsg"), debugRunProcessWizardData.getSisPath()); //$NON-NLS-1$ |
|
1186
067198a8221d
Bug 11067: fix some issues with the PNP launch wizard
Ed Swartz <ed.swartz@nokia.com>
parents:
1090
diff
changeset
|
165 |
else |
969 | 166 |
return Messages.getString("DebugRunProcessSection.CopyMsg"); //$NON-NLS-1$ |
956 | 167 |
} |
168 |
||
169 |
} |