author | dadubrow |
Mon, 01 Mar 2010 14:30:07 -0600 | |
changeset 1045 | 7bd4eb5648d7 |
parent 969 | b0dd389735fb |
child 1090 | 02cf64aef519 |
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; |
|
23 |
import org.eclipse.core.runtime.Status; |
|
24 |
import org.eclipse.swt.widgets.Composite; |
|
25 |
import org.eclipse.swt.widgets.Shell; |
|
26 |
||
27 |
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
|
28 |
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; |
|
29 |
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; |
|
30 |
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; |
|
31 |
import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection; |
|
32 |
import com.nokia.cpp.internal.api.utils.core.PathUtils; |
|
33 |
||
34 |
/** |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class DebugRunProcessSection extends AbstractLaunchWizardSection { |
|
38 |
||
960 | 39 |
public DebugRunProcessSection(LaunchWizardData data, UnifiedLaunchOptionsPage launchOptionsPage) { |
969 | 40 |
super(data, MessageFormat.format(Messages.getString("DebugRunProcessSection.Title"), data.getModeLabel()), launchOptionsPage); //$NON-NLS-1$ |
956 | 41 |
} |
42 |
||
43 |
@Override |
|
44 |
public void createControl(Composite parent) { |
|
45 |
createSection(parent, 1); |
|
46 |
} |
|
47 |
||
48 |
@Override |
|
49 |
protected void dispose() { |
|
50 |
||
51 |
} |
|
52 |
||
53 |
@Override |
|
54 |
public void initializeSettings() { |
|
55 |
data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); |
|
56 |
if (data.getExes().size() > 0) |
|
57 |
data.setExeSelectionPath(data.getExes().get(0)); |
|
58 |
else if (data.getDefaultExecutable() != null) |
|
59 |
data.setExeSelectionPath(data.getDefaultExecutable()); |
|
60 |
ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(data.getProject()); |
|
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
61 |
data.setInstallPackage(!data.isSysTRKConnection()); |
956 | 62 |
if (cpi != null) { |
63 |
ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); |
|
64 |
for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { |
|
65 |
IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath(); |
|
66 |
data.setSisPath(sisPath.toOSString()); |
|
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
||
71 |
@Override |
|
72 |
protected AbstractLaunchSettingsDialog createChangeSettingsDialog( |
|
73 |
Shell shell, LaunchWizardData dialogData) { |
|
74 |
return new DebugRunProcessDialog(shell, dialogData); |
|
75 |
} |
|
76 |
||
77 |
@Override |
|
78 |
protected void refresh() { |
|
79 |
updateUI(); |
|
80 |
} |
|
81 |
||
82 |
@Override |
|
83 |
protected void validate() { |
|
84 |
||
85 |
status = Status.OK_STATUS; |
|
86 |
||
87 |
switch (data.getExeSelection()) { |
|
88 |
case USE_PROJECT_EXECUTABLE: |
|
89 |
if (data.getExeSelectionPath() == null) |
|
969 | 90 |
status = error(Messages.getString("DebugRunProcessSection.NoExesError"), //$NON-NLS-1$ |
956 | 91 |
data.getModeLabel().toLowerCase()); |
92 |
break; |
|
93 |
case USE_REMOTE_EXECUTABLE: |
|
94 |
if (data.getExeSelectionPath() == null) |
|
969 | 95 |
status = error(Messages.getString("DebugRunProcessSection.NoRemoteExeError"), //$NON-NLS-1$ |
956 | 96 |
data.getModeLabel().toLowerCase()); |
97 |
break; |
|
98 |
case ATTACH_TO_PROCESS: |
|
99 |
break; |
|
100 |
} |
|
101 |
||
102 |
if (data.isInstallPackage() && (data.getSisPath() == null || data.getSisPath().length() == 0)) |
|
969 | 103 |
status = error(Messages.getString("DebugRunProcessSection.MustInstallError")); //$NON-NLS-1$ |
956 | 104 |
} |
105 |
||
106 |
@Override |
|
107 |
protected void updateUI() { |
|
108 |
||
109 |
validate(); |
|
110 |
||
111 |
if (status.isOK()) { |
|
969 | 112 |
String mainFormat = Messages.getString("DebugRunProcessSection.MainFormat"); //$NON-NLS-1$ |
113 |
String copyOrInstallMsg = ""; //$NON-NLS-1$ |
|
114 |
String runOrLaunchMsg = ""; //$NON-NLS-1$ |
|
956 | 115 |
|
116 |
switch (data.getExeSelection()) { |
|
117 |
case USE_PROJECT_EXECUTABLE: |
|
969 | 118 |
runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), data.getExeSelectionPath().lastSegment()); //$NON-NLS-1$ |
956 | 119 |
break; |
120 |
case USE_REMOTE_EXECUTABLE: |
|
969 | 121 |
runOrLaunchMsg = MessageFormat.format(Messages.getString("DebugRunProcessSection.LaunchFormat"), PathUtils.convertPathToWindows(data.getExeSelectionPath())); //$NON-NLS-1$ |
956 | 122 |
break; |
123 |
case ATTACH_TO_PROCESS: |
|
969 | 124 |
runOrLaunchMsg = Messages.getString("DebugRunProcessSection.AttachMsg"); //$NON-NLS-1$ |
956 | 125 |
break; |
126 |
} |
|
127 |
||
128 |
copyOrInstallMsg = getCopyOrInstallMsg(); |
|
129 |
||
130 |
String runOrDebugProcessMessage = MessageFormat.format(mainFormat, copyOrInstallMsg, runOrLaunchMsg); |
|
131 |
descriptionLabel.setText(runOrDebugProcessMessage); |
|
132 |
} else { |
|
969 | 133 |
descriptionLabel.setText(status.getMessage() + "\n\n" + //$NON-NLS-1$ |
134 |
MessageFormat.format(Messages.getString("DebugRunProcessSection.ChangeMsg"), //$NON-NLS-1$ |
|
956 | 135 |
data.getModeLabel().toLowerCase())); |
136 |
} |
|
137 |
} |
|
138 |
||
139 |
private String getCopyOrInstallMsg() { |
|
140 |
if (data.isSysTRKConnection() || !data.isInstallPackage()) |
|
969 | 141 |
return Messages.getString("DebugRunProcessSection.CopyMsg"); //$NON-NLS-1$ |
956 | 142 |
else |
969 | 143 |
return MessageFormat.format(Messages.getString("DebugRunProcessSection.InstallMsg"), data.getSisPath()); //$NON-NLS-1$ |
956 | 144 |
} |
145 |
||
146 |
} |