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