author | Ed Swartz <ed.swartz@nokia.com> |
Mon, 26 Apr 2010 10:28:50 -0500 | |
branch | RCL_2_4 |
changeset 1278 | 49840c7f58f4 |
parent 1277 | 12fd76372d95 |
child 1280 | 7114a2177fac |
permissions | -rw-r--r-- |
911 | 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.io.File; |
|
21 |
import java.text.MessageFormat; |
|
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
22 |
import java.util.ArrayList; |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
23 |
import java.util.Iterator; |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
24 |
import java.util.LinkedHashSet; |
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
25 |
import java.util.List; |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
26 |
import java.util.Set; |
911 | 27 |
|
28 |
import org.eclipse.cdt.core.model.CoreModel; |
|
29 |
import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent; |
|
30 |
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener; |
|
31 |
import org.eclipse.core.resources.IProject; |
|
32 |
import org.eclipse.core.runtime.IPath; |
|
33 |
import org.eclipse.core.runtime.IStatus; |
|
34 |
import org.eclipse.core.runtime.Path; |
|
35 |
import org.eclipse.core.runtime.Status; |
|
36 |
import org.eclipse.jface.layout.GridDataFactory; |
|
37 |
import org.eclipse.jface.layout.GridLayoutFactory; |
|
38 |
import org.eclipse.jface.resource.JFaceResources; |
|
39 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
|
40 |
import org.eclipse.jface.viewers.ComboViewer; |
|
41 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
|
42 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
43 |
import org.eclipse.jface.viewers.LabelProvider; |
|
44 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
|
45 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
46 |
import org.eclipse.swt.SWT; |
|
47 |
import org.eclipse.swt.events.ControlAdapter; |
|
48 |
import org.eclipse.swt.events.ControlEvent; |
|
49 |
import org.eclipse.swt.events.DisposeEvent; |
|
50 |
import org.eclipse.swt.events.DisposeListener; |
|
51 |
import org.eclipse.swt.events.ModifyEvent; |
|
52 |
import org.eclipse.swt.events.ModifyListener; |
|
53 |
import org.eclipse.swt.events.SelectionAdapter; |
|
54 |
import org.eclipse.swt.events.SelectionEvent; |
|
55 |
import org.eclipse.swt.layout.GridData; |
|
56 |
import org.eclipse.swt.widgets.Button; |
|
57 |
import org.eclipse.swt.widgets.Combo; |
|
58 |
import org.eclipse.swt.widgets.Composite; |
|
59 |
import org.eclipse.swt.widgets.Control; |
|
60 |
import org.eclipse.swt.widgets.FileDialog; |
|
61 |
import org.eclipse.swt.widgets.Label; |
|
62 |
import org.eclipse.swt.widgets.Link; |
|
63 |
import org.eclipse.swt.widgets.Shell; |
|
64 |
import org.eclipse.swt.widgets.Text; |
|
65 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
|
66 |
||
67 |
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
|
68 |
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; |
|
69 |
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; |
|
70 |
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
71 |
import com.nokia.cdt.internal.debug.launch.LaunchPlugin; |
953 | 72 |
import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection; |
911 | 73 |
import com.nokia.cpp.internal.api.utils.core.PathUtils; |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
74 |
import com.nokia.cpp.internal.api.utils.core.TextUtils; |
911 | 75 |
import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; |
76 |
||
77 |
/** |
|
78 |
* This dialog allows in-depth configuration of the debug/run process options. |
|
79 |
*/ |
|
80 |
public class DebugRunProcessDialog extends AbstractLaunchSettingsDialog implements ICProjectDescriptionListener { |
|
81 |
private ComboViewer projectExecutableViewer; |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
82 |
private ComboViewer remoteProgramViewer; |
911 | 83 |
private Button projectExecutableRadioButton; |
84 |
private Button remoteExecutableRadioButton; |
|
85 |
private Button attachToProcessRadioButton; |
|
86 |
||
87 |
private Label packageInfoLabel; |
|
88 |
private Button installPackageCheckbox; |
|
89 |
private Combo sisFile; |
|
90 |
private Text sisEdit; |
|
91 |
private Button sisBrowse; |
|
92 |
private Composite installPackageUI; |
|
93 |
||
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
94 |
private List<IPath> remotePathEntries = new ArrayList<IPath>(); |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
95 |
|
953 | 96 |
protected DebugRunProcessDialog(Shell shell, LaunchWizardData data) { |
911 | 97 |
super(shell, data); |
98 |
} |
|
99 |
||
100 |
||
101 |
/* (non-Javadoc) |
|
102 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
|
103 |
*/ |
|
104 |
@Override |
|
105 |
protected Control createDialogArea(Composite parent) { |
|
106 |
Composite composite = initDialogArea(parent, |
|
966 | 107 |
MessageFormat.format(Messages.getString("DebugRunProcessDialog.ChangeProcessMsg"), data.getModeLabel()), //$NON-NLS-1$ |
911 | 108 |
data.isDebug() ? LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_DEBUG_PROCESS : |
109 |
LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_RUN_PROCESS); |
|
110 |
||
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
111 |
loadRemoteProgramEntries(); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
112 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
113 |
composite.addDisposeListener(new DisposeListener() { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
114 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
115 |
public void widgetDisposed(DisposeEvent e) { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
116 |
saveRemoteProgramEntries(); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
117 |
} |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
118 |
}); |
911 | 119 |
|
120 |
createProcessSelector(composite); |
|
121 |
||
122 |
Label sep = new Label(composite, SWT.NONE); |
|
123 |
GridDataFactory.fillDefaults().applyTo(sep); |
|
124 |
||
125 |
createPackageConfiguration(composite); |
|
126 |
||
127 |
initUI(); |
|
128 |
||
129 |
validate(); |
|
130 |
||
131 |
return composite; |
|
132 |
} |
|
133 |
||
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
134 |
// pref key for paths the user has manually entered |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
135 |
final static String USER_REMOTE_PATHS = "user.remote.paths"; //$NON-NLS-1$ |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
136 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
137 |
/** |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
138 |
* |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
139 |
*/ |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
140 |
protected void saveRemoteProgramEntries() { |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
141 |
// in case user was typing, ensure that entry is present |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
142 |
if(remoteProgramViewer != null) { |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
143 |
IPath currentPath = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim()); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
144 |
remotePathEntries.remove(currentPath); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
145 |
remotePathEntries.add(0, currentPath); // MRU |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
146 |
} |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
147 |
|
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
148 |
Set<IPath> uniqueRemotePathEntries = new LinkedHashSet<IPath>(remotePathEntries); |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
149 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
150 |
for (Iterator<IPath> iter = uniqueRemotePathEntries.iterator(); iter.hasNext(); ) { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
151 |
IPath path = iter.next(); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
152 |
if (path.isEmpty() || data.getExes().contains(path)) |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
153 |
iter.remove(); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
154 |
} |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
155 |
|
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
156 |
// truncate size, removing from end |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
157 |
List<IPath> mruPathEntries = new ArrayList<IPath>(uniqueRemotePathEntries); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
158 |
while (mruPathEntries.size() > 10) { |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
159 |
mruPathEntries.remove(mruPathEntries.size() - 1); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
160 |
} |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
161 |
|
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
162 |
String pathSoup = TextUtils.catenateStrings(mruPathEntries.toArray(), "|"); //$NON-NLS-1$ |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
163 |
LaunchPlugin.getDefault().getPreferenceStore().setValue(USER_REMOTE_PATHS, pathSoup); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
164 |
} |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
165 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
166 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
167 |
/** |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
168 |
* |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
169 |
*/ |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
170 |
protected void loadRemoteProgramEntries() { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
171 |
String pathSoup = LaunchPlugin.getDefault().getPreferenceStore().getString(USER_REMOTE_PATHS); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
172 |
if (pathSoup != null) { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
173 |
String[] paths = pathSoup.split("\\|"); //$NON-NLS-1$ |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
174 |
for (String path : paths) |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
175 |
remotePathEntries.add(PathUtils.createPath(path)); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
176 |
} |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
177 |
} |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
178 |
|
911 | 179 |
|
180 |
private void createProcessSelector(Composite composite) { |
|
181 |
Label label; |
|
182 |
||
183 |
label = new Label(composite, SWT.WRAP); |
|
966 | 184 |
label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.ModeLabel"), data.getModeLabel())); //$NON-NLS-1$ |
911 | 185 |
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); |
186 |
||
187 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(composite); |
|
188 |
||
189 |
Composite radioGroup = new Composite(composite, SWT.NONE); |
|
190 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(radioGroup); |
|
191 |
GridLayoutFactory.fillDefaults().extendedMargins(INDENT, 0, 0, 0).numColumns(2).applyTo(radioGroup); |
|
192 |
||
193 |
createProjectExecutableRadioButton(radioGroup); |
|
194 |
createRemoteExecutableRadioButton(radioGroup); |
|
195 |
||
196 |
label = new Label(radioGroup, SWT.SEPARATOR | SWT.HORIZONTAL); |
|
197 |
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(label); |
|
198 |
||
199 |
createAttachToProcessRadioButton(radioGroup); |
|
200 |
||
201 |
String msg; |
|
202 |
if (data.isDebug()) |
|
966 | 203 |
msg = Messages.getString("DebugRunProcessDialog.DebugConfigureMsg"); //$NON-NLS-1$ |
911 | 204 |
else |
966 | 205 |
msg = Messages.getString("DebugRunProcessDialog.RunConfigureMsg"); //$NON-NLS-1$ |
911 | 206 |
setMessage(msg); |
207 |
||
208 |
switch (data.getExeSelection()) { |
|
209 |
case USE_PROJECT_EXECUTABLE: |
|
210 |
projectExecutableRadioButton.setSelection(true); |
|
211 |
break; |
|
212 |
case USE_REMOTE_EXECUTABLE: |
|
213 |
remoteExecutableRadioButton.setSelection(true); |
|
214 |
break; |
|
215 |
case ATTACH_TO_PROCESS: |
|
216 |
attachToProcessRadioButton.setSelection(true); |
|
217 |
break; |
|
218 |
} |
|
219 |
} |
|
220 |
||
221 |
private void createPackageConfiguration(Composite composite) { |
|
222 |
Label label; |
|
223 |
||
224 |
label = new Label(composite, SWT.WRAP); |
|
966 | 225 |
label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.DeployLabel"), data.getModeLabel())); //$NON-NLS-1$ |
911 | 226 |
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); |
227 |
||
228 |
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); |
|
229 |
||
230 |
packageInfoLabel = new Label(composite, SWT.WRAP); |
|
231 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(packageInfoLabel); |
|
232 |
composite.addControlListener(new ControlAdapter() { |
|
233 |
@Override |
|
234 |
public void controlResized(ControlEvent e) { |
|
235 |
packageInfoLabel.pack(); |
|
236 |
} |
|
237 |
}); |
|
238 |
||
239 |
installPackageCheckbox = new Button(composite, SWT.CHECK); |
|
240 |
GridDataFactory.fillDefaults().applyTo(installPackageCheckbox); |
|
241 |
||
966 | 242 |
installPackageCheckbox.setText(Messages.getString("DebugRunProcessDialog.InstallBeforeLaunchLabel")); //$NON-NLS-1$ |
911 | 243 |
installPackageUI = new Composite(composite, SWT.NONE); |
244 |
GridDataFactory.fillDefaults().indent(INDENT, 0).applyTo(installPackageUI); |
|
245 |
||
246 |
createSISContents(installPackageUI); |
|
247 |
||
248 |
||
249 |
installPackageCheckbox.addSelectionListener(new SelectionAdapter() { |
|
250 |
@Override |
|
251 |
public void widgetSelected(SelectionEvent e) { |
|
252 |
data.setInstallPackage(installPackageCheckbox.getSelection()); |
|
253 |
updatePackageUI(); |
|
254 |
} |
|
255 |
}); |
|
256 |
||
257 |
||
953 | 258 |
if (data.isInstallPackage()) { |
911 | 259 |
installPackageCheckbox.setSelection(true); |
953 | 260 |
updatePackageUI(); |
911 | 261 |
} |
262 |
||
263 |
updateSisFile(); |
|
264 |
updatePackageUI(); |
|
265 |
} |
|
266 |
||
267 |
protected void createSISContents(Composite composite) { |
|
268 |
GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(composite); |
|
269 |
||
270 |
final IProject project = data.getProject(); |
|
271 |
ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); |
|
272 |
if (cpi != null) { |
|
273 |
final Label sisLabel = new Label(composite, SWT.NONE); |
|
966 | 274 |
sisLabel.setText(Messages.getString("DebugRunProcessDialog.SISFileLabel")); //$NON-NLS-1$ |
911 | 275 |
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(1, 1).applyTo(sisLabel); |
966 | 276 |
sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
277 |
sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ |
|
911 | 278 |
|
279 |
sisFile = new Combo(composite, SWT.READ_ONLY); |
|
1044
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
280 |
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(sisFile); |
966 | 281 |
sisFile.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
282 |
sisFile.setData(UID, "DebugRunProcessDialog.sisFile"); //$NON-NLS-1$ |
|
911 | 283 |
|
284 |
sisFile.addSelectionListener(new SelectionAdapter() { |
|
285 |
@Override |
|
286 |
public void widgetSelected(SelectionEvent e) { |
|
287 |
updateSisFile(); |
|
288 |
} |
|
289 |
}); |
|
290 |
||
1044
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
291 |
updateSisFileCombo(cpi); |
911 | 292 |
|
293 |
// listen for events so we can detect if they click on the link below and add new sis info. |
|
294 |
CoreModel.getDefault().getProjectDescriptionManager().addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED); |
|
295 |
||
296 |
composite.addDisposeListener(new DisposeListener() { |
|
297 |
||
298 |
public void widgetDisposed(DisposeEvent e) { |
|
299 |
CoreModel.getDefault().getProjectDescriptionManager().removeCProjectDescriptionListener(DebugRunProcessDialog.this); |
|
300 |
} |
|
301 |
}); |
|
302 |
||
303 |
Link link = new Link(composite, SWT.NONE); |
|
966 | 304 |
link.setText("<a>" + Messages.getString("DebugRunProcessDialog.SISConfigLinkText") + "...</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
911 | 305 |
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).grab(true, false).applyTo(link); |
306 |
link.addSelectionListener(new SelectionAdapter() { |
|
307 |
public void widgetSelected(SelectionEvent e) { |
|
966 | 308 |
PreferencesUtil.createPropertyDialogOn(getShell(), project, "com.nokia.carbide.cdt.internal.builder.ui.CarbideBuildConfigurationsPage", null, null).open(); //$NON-NLS-1$ |
911 | 309 |
} |
310 |
}); |
|
966 | 311 |
link.setData(UID, "DebugRunProcessDialog.link"); //$NON-NLS-1$ |
911 | 312 |
} else { |
313 |
// not a Carbide project, just an executable. show a browse/edit combo |
|
314 |
// to let them select a sis file if they want to. |
|
315 |
final Label sisLabel = new Label(composite, SWT.NONE); |
|
316 |
sisLabel.setText("SIS File to Install:"); //$NON-NLS-1$ |
|
317 |
GridDataFactory.swtDefaults().span(2, 1).applyTo(sisLabel); |
|
966 | 318 |
sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
319 |
sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ |
|
911 | 320 |
|
321 |
sisEdit = new Text(composite, SWT.BORDER); |
|
322 |
GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(sisEdit); |
|
966 | 323 |
sisEdit.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
911 | 324 |
sisEdit.addModifyListener(new ModifyListener() { |
325 |
public void modifyText(ModifyEvent e) { |
|
326 |
updateSisFile(); |
|
327 |
validate(); |
|
328 |
} |
|
329 |
}); |
|
1044
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
330 |
String sisPath = data.getSisPath(); |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
331 |
if (sisPath != null) |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
332 |
sisEdit.setText(sisPath); |
966 | 333 |
sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit"); //$NON-NLS-1$ |
911 | 334 |
|
335 |
sisBrowse = new Button(composite, SWT.NONE); |
|
966 | 336 |
sisBrowse.setText(Messages.getString("DebugRunProcessDialog.BrowseLabel")); //$NON-NLS-1$ |
911 | 337 |
sisBrowse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
338 |
sisBrowse.addSelectionListener(new SelectionAdapter() { |
|
339 |
public void widgetSelected(SelectionEvent evt) { |
|
340 |
FileDialog dialog = new FileDialog(getShell(), SWT.NONE); |
|
341 |
||
966 | 342 |
dialog.setText(Messages.getString("DebugRunProcessDialog.Title")); //$NON-NLS-1$ |
343 |
dialog.setFilterExtensions(new String[] {"*.sis*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ |
|
344 |
dialog.setFilterNames(new String[] {Messages.getString("DebugRunProcessDialog.InstallFilterName"), Messages.getString("DebugRunProcessDialog.AllFilterName")}); //$NON-NLS-1$ //$NON-NLS-2$ |
|
911 | 345 |
|
346 |
BrowseDialogUtils.initializeFrom(dialog, sisEdit); |
|
347 |
||
348 |
String result = dialog.open(); |
|
349 |
if (result != null && new File(result).exists()) { |
|
350 |
sisEdit.setText(result); |
|
351 |
updateSisFile(); |
|
352 |
validate(); |
|
353 |
} |
|
354 |
} |
|
355 |
}); |
|
966 | 356 |
sisBrowse.setData(UID, "DebugRunProcessDialog.sisBrowse"); //$NON-NLS-1$ |
911 | 357 |
} |
358 |
} |
|
1044
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
359 |
|
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
360 |
|
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
361 |
private void updateSisFileCombo(ICarbideProjectInfo cpi) { |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
362 |
sisFile.add(Messages.getString("DebugRunProcessDialog.NoneItem")); //$NON-NLS-1$ |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
363 |
|
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
364 |
ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
365 |
for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
366 |
IPath sisPath = info.getSigningType() == ISISBuilderInfo.DONT_SIGN ? info.getUnsignedSISFullPath() : info.getSignedSISFullPath(); |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
367 |
sisFile.add(sisPath.toOSString()); |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
368 |
} |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
369 |
|
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
370 |
// select the first sis file if any, otherwise select none |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
371 |
if (sisFile.getItemCount() > 1) { |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
372 |
sisFile.select(1); |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
373 |
} else { |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
374 |
sisFile.select(0); |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
375 |
} |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
376 |
updateSisFile(); |
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
377 |
} |
911 | 378 |
|
379 |
||
380 |
/** |
|
381 |
* |
|
382 |
*/ |
|
383 |
protected void updateSisFile() { |
|
384 |
String sisPath; |
|
385 |
if (sisFile != null) { |
|
953 | 386 |
sisPath = sisFile.getSelectionIndex() == 0 ? null : sisFile.getText(); //$NON-NLS-1$ |
911 | 387 |
data.setSisPath(sisPath); |
388 |
} else if (sisEdit != null) { |
|
389 |
sisPath = sisEdit.getText(); |
|
390 |
data.setSisPath(sisPath); |
|
391 |
} |
|
392 |
} |
|
393 |
||
394 |
||
395 |
private void updatePackageUI() { |
|
396 |
installPackageUI.setEnabled(data.isInstallPackage()); |
|
397 |
for (Control kid : installPackageUI.getChildren()) |
|
398 |
kid.setEnabled(data.isInstallPackage()); |
|
399 |
} |
|
400 |
||
401 |
||
402 |
public void handleEvent(CProjectDescriptionEvent event) { |
|
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
403 |
Shell shell = getShell(); |
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
404 |
if (shell == null || shell.isDisposed()) { |
911 | 405 |
return; |
406 |
} |
|
407 |
||
408 |
IProject project = event.getProject() ; |
|
409 |
||
410 |
if (project != data.getProject()) { |
|
411 |
return; |
|
412 |
} |
|
413 |
||
414 |
if (sisFile != null) { |
|
415 |
ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); |
|
416 |
if (cpi != null) { |
|
417 |
sisFile.removeAll(); |
|
418 |
||
1044
698d7a6c6f6a
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
966
diff
changeset
|
419 |
updateSisFileCombo(cpi); |
911 | 420 |
} |
421 |
} |
|
422 |
} |
|
423 |
||
424 |
protected void initUI() { |
|
1091 | 425 |
List<IPath> exes = data.getLaunchableExes(); |
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
426 |
projectExecutableViewer.setInput(exes); |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
427 |
|
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
428 |
// this path may either be a project-relative or remote path |
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
429 |
IPath exeSelectionPath = data.getExeSelectionPath(); |
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
430 |
if (exeSelectionPath.equals(Path.EMPTY) && !exes.isEmpty()) |
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
431 |
exeSelectionPath = exes.get(0); |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
432 |
|
1091 | 433 |
if (!Path.EMPTY.equals(exeSelectionPath)) { |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
434 |
// keep previous path if possible... |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
435 |
IPath remotePath = exeSelectionPath; |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
436 |
if (data.getExes().contains(remotePath)) { |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
437 |
// unless that was actually a host-side path, which should be converted |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
438 |
remotePath = createSuggestedRemotePath(exeSelectionPath); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
439 |
} else { |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
440 |
// selection is already a remote path; map back to project if possible |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
441 |
for (IPath exe : data.getExes()) { |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
442 |
if (exe.lastSegment().equals(remotePath.lastSegment())) { |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
443 |
exeSelectionPath = exe; |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
444 |
break; |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
445 |
} |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
446 |
} |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
447 |
} |
1091 | 448 |
projectExecutableViewer.setSelection(new StructuredSelection(exeSelectionPath)); |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
449 |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
450 |
if (remoteProgramViewer != null) { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
451 |
if (!remotePathEntries.contains(remotePath)) { |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
452 |
remotePathEntries.add(0, remotePath); // MRU |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
453 |
remoteProgramViewer.add(remotePath); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
454 |
} |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
455 |
remoteProgramViewer.setSelection(new StructuredSelection(remotePath)); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
456 |
} |
1091 | 457 |
} |
458 |
||
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
459 |
if (data.getExeSelection() == EExeSelection.USE_PROJECT_EXECUTABLE && exeSelectionPath != null) { |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
460 |
projectExecutableViewer.getControl().forceFocus(); |
911 | 461 |
} |
462 |
||
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
463 |
if (data.getExeSelection() == EExeSelection.USE_REMOTE_EXECUTABLE && exeSelectionPath != null) { |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
464 |
remoteProgramViewer.getControl().forceFocus(); |
911 | 465 |
} |
466 |
||
467 |
if (data.getExeSelection() == EExeSelection.ATTACH_TO_PROCESS) { |
|
468 |
attachToProcessRadioButton.forceFocus(); |
|
469 |
} |
|
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
470 |
|
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
471 |
handleProjectExecutableRadioSelected(); |
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
472 |
handleRemoteExecutableRadioSelected(); |
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
473 |
handleAttachToProcessRadioSelected(); |
911 | 474 |
} |
475 |
||
476 |
||
477 |
private IPath createSuggestedRemotePath(IPath exeSelectionPath) { |
|
478 |
String filename = exeSelectionPath.lastSegment(); |
|
966 | 479 |
return PathUtils.createPath("C:/sys/bin").append(filename); //$NON-NLS-1$ |
911 | 480 |
} |
481 |
||
482 |
/** |
|
483 |
* Allow selecting an executable detected to be built by the program. |
|
484 |
* @param radioGroup |
|
485 |
*/ |
|
486 |
private void createProjectExecutableRadioButton(Composite radioGroup) { |
|
487 |
projectExecutableRadioButton = new Button(radioGroup, SWT.RADIO); |
|
488 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(projectExecutableRadioButton); |
|
966 | 489 |
projectExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchProjectExeLabel")); //$NON-NLS-1$ |
490 |
projectExecutableRadioButton.setData(UID, "radio_project_executable"); //$NON-NLS-1$ |
|
911 | 491 |
|
492 |
projectExecutableViewer = new ComboViewer(radioGroup, SWT.READ_ONLY); |
|
493 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(projectExecutableViewer.getControl()); |
|
966 | 494 |
projectExecutableViewer.getControl().setData(UID, "combo_project_executable"); //$NON-NLS-1$ |
911 | 495 |
|
496 |
projectExecutableViewer.setContentProvider(new ArrayContentProvider()); |
|
497 |
projectExecutableViewer.setLabelProvider(new LabelProvider() { |
|
498 |
@Override |
|
499 |
public String getText(Object element) { |
|
500 |
if (element instanceof IPath) |
|
501 |
return ((IPath) element).lastSegment(); |
|
502 |
return super.getText(element); |
|
503 |
} |
|
504 |
}); |
|
505 |
||
506 |
projectExecutableRadioButton.addSelectionListener(new SelectionAdapter() { |
|
507 |
@Override |
|
508 |
public void widgetSelected(SelectionEvent e) { |
|
913 | 509 |
handleProjectExecutableRadioSelected(); |
911 | 510 |
} |
913 | 511 |
|
911 | 512 |
}); |
513 |
||
514 |
projectExecutableViewer.addSelectionChangedListener(new ISelectionChangedListener() { |
|
515 |
||
516 |
public void selectionChanged(SelectionChangedEvent event) { |
|
517 |
Object sel = ((IStructuredSelection) event.getSelection()).getFirstElement(); |
|
518 |
if (sel instanceof IPath) { |
|
519 |
data.setExeSelectionPath((IPath) sel); |
|
520 |
||
521 |
// track the default remote program from the executable, for easy editing |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
522 |
if (remoteProgramViewer != null) { |
911 | 523 |
IPath exeSelectionPath = createSuggestedRemotePath(data.getExeSelectionPath()); |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
524 |
// path should already be in model |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
525 |
remoteProgramViewer.setSelection(new StructuredSelection(exeSelectionPath)); |
911 | 526 |
} |
527 |
||
528 |
validate(); |
|
529 |
} |
|
530 |
} |
|
531 |
}); |
|
532 |
} |
|
533 |
||
913 | 534 |
private void handleProjectExecutableRadioSelected() { |
535 |
if (projectExecutableRadioButton.getSelection()) { |
|
536 |
projectExecutableViewer.getControl().setEnabled(true); |
|
537 |
data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); |
|
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
538 |
IPath selectedPath = (IPath) ((IStructuredSelection) projectExecutableViewer.getSelection()).getFirstElement(); |
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
539 |
if (selectedPath != null) { |
1191
0523013ddf00
Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents:
1091
diff
changeset
|
540 |
data.setExeSelectionPath(selectedPath); |
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
541 |
} |
913 | 542 |
validate(); |
543 |
} else { |
|
544 |
projectExecutableViewer.getControl().setEnabled(false); |
|
545 |
// another button becomes active and sets the new launch process |
|
546 |
} |
|
547 |
} |
|
548 |
||
911 | 549 |
/** |
550 |
* Allow user to enter an executable path. |
|
551 |
* @param radioGroup |
|
552 |
*/ |
|
553 |
private void createRemoteExecutableRadioButton(Composite radioGroup) { |
|
554 |
remoteExecutableRadioButton = new Button(radioGroup, SWT.RADIO); |
|
555 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(remoteExecutableRadioButton); |
|
966 | 556 |
remoteExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgLabel")); //$NON-NLS-1$ |
911 | 557 |
|
966 | 558 |
remoteExecutableRadioButton.setData(UID, "radio_remote_program"); //$NON-NLS-1$ |
911 | 559 |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
560 |
remoteProgramViewer = new ComboViewer(radioGroup, SWT.BORDER); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
561 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(remoteProgramViewer.getControl()); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
562 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
563 |
remotePathEntries.addAll(data.getExes()); |
911 | 564 |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
565 |
remoteProgramViewer.setContentProvider(new ArrayContentProvider()); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
566 |
remoteProgramViewer.setLabelProvider(new LabelProvider() { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
567 |
@Override |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
568 |
public String getText(Object element) { |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
569 |
if (element instanceof IPath) |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
570 |
return PathUtils.convertPathToWindows((IPath) element); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
571 |
return super.getText(element); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
572 |
} |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
573 |
}); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
574 |
remoteProgramViewer.setInput(remotePathEntries); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
575 |
remoteProgramViewer.getCombo().setVisibleItemCount(remotePathEntries.size()); |
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
576 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
577 |
|
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
578 |
remoteProgramViewer.setData(UID, "combo_remote_program"); //$NON-NLS-1$ |
911 | 579 |
|
580 |
remoteExecutableRadioButton.addSelectionListener(new SelectionAdapter() { |
|
581 |
@Override |
|
582 |
public void widgetSelected(SelectionEvent e) { |
|
913 | 583 |
handleRemoteExecutableRadioSelected(); |
911 | 584 |
} |
913 | 585 |
|
911 | 586 |
}); |
587 |
||
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
588 |
remoteProgramViewer.getCombo().addModifyListener(new ModifyListener() { |
915
3b26c948790f
better initialization and validation in debugrunprocess dialog
dadubrow
parents:
913
diff
changeset
|
589 |
public void modifyText(ModifyEvent e) { |
1278
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
590 |
IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim()); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
591 |
data.setExeSelectionPath(path); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
592 |
|
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
593 |
// MRU behavior |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
594 |
remotePathEntries.remove(path); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
595 |
remotePathEntries.add(0, path); |
49840c7f58f4
Fix remote program selector changes: was not properly initializing from project EXE, and MRU logic was not correct.
Ed Swartz <ed.swartz@nokia.com>
parents:
1277
diff
changeset
|
596 |
|
911 | 597 |
validate(); |
598 |
} |
|
599 |
}); |
|
600 |
} |
|
601 |
||
913 | 602 |
private void handleRemoteExecutableRadioSelected() { |
603 |
if (remoteExecutableRadioButton.getSelection()) { |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
604 |
remoteProgramViewer.getControl().setEnabled(true); |
913 | 605 |
data.setExeSelection(EExeSelection.USE_REMOTE_EXECUTABLE); |
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
606 |
IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText()); |
1191
0523013ddf00
Merge commits 1174, 1175, 1176, 1184, 1185 from default:
Ed Swartz <ed.swartz@nokia.com>
parents:
1091
diff
changeset
|
607 |
data.setExeSelectionPath(path); |
913 | 608 |
validate(); |
609 |
} else { |
|
1277
12fd76372d95
PNP launch wizard changes: make Remote Program text entry into combo viewer with history
Ed Swartz <ed.swartz@nokia.com>
parents:
1191
diff
changeset
|
610 |
remoteProgramViewer.getControl().setEnabled(false); |
913 | 611 |
// another button becomes active and sets the new launch process |
612 |
} |
|
613 |
} |
|
614 |
||
911 | 615 |
/** |
616 |
* Allow user to attach to a process. |
|
617 |
* @param radioGroup |
|
618 |
*/ |
|
619 |
private void createAttachToProcessRadioButton(Composite radioGroup) { |
|
620 |
attachToProcessRadioButton = new Button(radioGroup, SWT.RADIO); |
|
621 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(attachToProcessRadioButton); |
|
966 | 622 |
attachToProcessRadioButton.setText(Messages.getString("DebugRunProcessDialog.AttachLabel")); //$NON-NLS-1$ |
911 | 623 |
|
966 | 624 |
attachToProcessRadioButton.setData(UID, "radio_attach_to_process"); //$NON-NLS-1$ |
911 | 625 |
|
626 |
Label label = new Label(radioGroup, SWT.WRAP); |
|
627 |
GridDataFactory.fillDefaults().grab(false, false).align(SWT.LEFT, SWT.CENTER).applyTo(label); |
|
628 |
||
966 | 629 |
label.setText(Messages.getString("DebugRunProcessDialog.AttachAddlMsg")); //$NON-NLS-1$ |
911 | 630 |
|
631 |
attachToProcessRadioButton.addSelectionListener(new SelectionAdapter() { |
|
632 |
@Override |
|
633 |
public void widgetSelected(SelectionEvent e) { |
|
913 | 634 |
handleAttachToProcessRadioSelected(); |
911 | 635 |
} |
913 | 636 |
|
911 | 637 |
}); |
638 |
||
639 |
} |
|
640 |
||
913 | 641 |
private void handleAttachToProcessRadioSelected() { |
642 |
if (attachToProcessRadioButton.getSelection()) { |
|
643 |
data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); |
|
644 |
data.setExeSelectionPath(null); |
|
645 |
validate(); |
|
646 |
} else { |
|
647 |
// another button becomes active and sets the new launch process |
|
648 |
} |
|
649 |
} |
|
650 |
||
911 | 651 |
@Override |
652 |
protected void validate() { |
|
653 |
IStatus status = Status.OK_STATUS; |
|
654 |
||
655 |
// check launch method |
|
656 |
IPath exePath = data.getExeSelectionPath(); |
|
657 |
switch (data.getExeSelection()) { |
|
658 |
case USE_PROJECT_EXECUTABLE: |
|
659 |
if (exePath.isEmpty()) { |
|
966 | 660 |
status = error(Messages.getString("DebugRunProcessDialog.NoExesError")); //$NON-NLS-1$ |
911 | 661 |
} |
662 |
break; |
|
663 |
case USE_REMOTE_EXECUTABLE: |
|
664 |
if (exePath.isEmpty()) { |
|
966 | 665 |
status = error(Messages.getString("DebugRunProcessDialog.EnterPathError")); //$NON-NLS-1$ |
911 | 666 |
} else { |
667 |
String exePathString = exePath.toString(); |
|
668 |
char drive = exePathString.charAt(0); |
|
669 |
char colon = exePathString.length() < 2 ? 0x0 : exePathString.charAt(1); |
|
670 |
char root = exePathString.length() < 3 ? 0x0 : exePathString.charAt(2); |
|
671 |
char lastChar = exePathString.charAt(exePathString.length() - 1); |
|
672 |
if (!Character.isLetter(drive) || colon != ':' || (root != '\\' && root != '/') || |
|
673 |
lastChar == '\\' || lastChar == '/' || lastChar == ':') { |
|
966 | 674 |
status = error(Messages.getString("DebugRunProcessDialog.AbsolutePathError")); //$NON-NLS-1$ |
911 | 675 |
} else if (exePath.getFileExtension() == null) { |
966 | 676 |
status = warning(Messages.getString("DebugRunProcessDialog.FilePathError")); //$NON-NLS-1$ |
911 | 677 |
} |
678 |
} |
|
679 |
break; |
|
680 |
case ATTACH_TO_PROCESS: |
|
681 |
break; |
|
682 |
} |
|
683 |
||
684 |
// check SIS selection |
|
685 |
if (data.isInstallPackage()) { |
|
686 |
if (sisEdit != null) { |
|
687 |
String text = sisEdit.getText().trim(); |
|
688 |
if (text.length() > 0) { |
|
689 |
// empty is allowed, but if they specify something, make sure |
|
690 |
// it exists |
|
691 |
File file = new File(text); |
|
692 |
if (!file.exists()) { |
|
966 | 693 |
status = error(Messages.getString("DebugRunProcessDialog.SISFileExistError"), text); //$NON-NLS-1$ |
911 | 694 |
} |
695 |
} |
|
696 |
} |
|
697 |
} |
|
698 |
||
699 |
updateStatus(status); |
|
700 |
} |
|
701 |
} |
|
702 |