author | Ed Swartz <ed.swartz@nokia.com> |
Mon, 26 Apr 2010 15:40:54 -0500 | |
changeset 1285 | 84caa86f9460 |
parent 1284 | 7ef1318ac801 |
child 2163 | f0a9f2d04d4a |
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 |
* |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
12 |
* Contributors: |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
13 |
* |
956 | 14 |
* Description: |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
15 |
* |
956 | 16 |
*/ |
17 |
||
18 |
package com.nokia.cdt.internal.debug.launch.newwizard; |
|
19 |
||
20 |
import java.io.File; |
|
21 |
import java.text.MessageFormat; |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
22 |
import java.util.ArrayList; |
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
|
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; |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
50 |
import org.eclipse.swt.events.FocusAdapter; |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
51 |
import org.eclipse.swt.events.FocusEvent; |
956 | 52 |
import org.eclipse.swt.events.ModifyEvent; |
53 |
import org.eclipse.swt.events.ModifyListener; |
|
54 |
import org.eclipse.swt.events.SelectionAdapter; |
|
55 |
import org.eclipse.swt.events.SelectionEvent; |
|
56 |
import org.eclipse.swt.layout.GridData; |
|
57 |
import org.eclipse.swt.widgets.Button; |
|
58 |
import org.eclipse.swt.widgets.Combo; |
|
59 |
import org.eclipse.swt.widgets.Composite; |
|
60 |
import org.eclipse.swt.widgets.Control; |
|
61 |
import org.eclipse.swt.widgets.FileDialog; |
|
62 |
import org.eclipse.swt.widgets.Label; |
|
63 |
import org.eclipse.swt.widgets.Link; |
|
64 |
import org.eclipse.swt.widgets.Shell; |
|
65 |
import org.eclipse.swt.widgets.Text; |
|
66 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
|
67 |
||
68 |
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; |
|
69 |
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; |
|
70 |
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; |
|
71 |
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
|
72 |
import com.nokia.cdt.internal.debug.launch.LaunchPlugin; |
956 | 73 |
import com.nokia.cdt.internal.debug.launch.newwizard.LaunchWizardData.EExeSelection; |
74 |
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
|
75 |
import com.nokia.cpp.internal.api.utils.core.TextUtils; |
956 | 76 |
import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; |
77 |
||
78 |
/** |
|
79 |
* This dialog allows in-depth configuration of the debug/run process options. |
|
80 |
*/ |
|
81 |
public class DebugRunProcessDialog extends AbstractLaunchSettingsDialog implements ICProjectDescriptionListener { |
|
82 |
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
|
83 |
private ComboViewer remoteProgramViewer; |
956 | 84 |
private Button projectExecutableRadioButton; |
85 |
private Button remoteExecutableRadioButton; |
|
86 |
private Button attachToProcessRadioButton; |
|
87 |
||
88 |
private Label packageInfoLabel; |
|
89 |
private Button installPackageCheckbox; |
|
90 |
private Combo sisFile; |
|
91 |
private Text sisEdit; |
|
92 |
private Button sisBrowse; |
|
93 |
private Composite installPackageUI; |
|
94 |
||
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
95 |
private List<IPath> remotePathEntries = new ArrayList<IPath>(); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
96 |
private List<IPath> projectGeneratedRemotePaths; |
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
|
97 |
|
956 | 98 |
protected DebugRunProcessDialog(Shell shell, LaunchWizardData data) { |
99 |
super(shell, data); |
|
100 |
} |
|
101 |
||
102 |
||
103 |
/* (non-Javadoc) |
|
104 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
|
105 |
*/ |
|
106 |
@Override |
|
107 |
protected Control createDialogArea(Composite parent) { |
|
108 |
Composite composite = initDialogArea(parent, |
|
969 | 109 |
MessageFormat.format(Messages.getString("DebugRunProcessDialog.ChangeProcessMsg"), data.getModeLabel()), //$NON-NLS-1$ |
956 | 110 |
data.isDebug() ? LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_DEBUG_PROCESS : |
111 |
LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_RUN_PROCESS); |
|
112 |
||
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
|
113 |
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
|
114 |
|
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 |
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
|
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 |
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
|
118 |
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
|
119 |
} |
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
|
120 |
}); |
956 | 121 |
|
122 |
createProcessSelector(composite); |
|
123 |
||
124 |
Label sep = new Label(composite, SWT.NONE); |
|
125 |
GridDataFactory.fillDefaults().applyTo(sep); |
|
126 |
||
127 |
createPackageConfiguration(composite); |
|
128 |
||
129 |
initUI(); |
|
130 |
||
131 |
validate(); |
|
132 |
||
133 |
return composite; |
|
134 |
} |
|
135 |
||
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
|
136 |
// 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
|
137 |
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
|
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 |
/** |
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 |
* |
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 |
protected void saveRemoteProgramEntries() { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
143 |
// in case user was typing, ensure that entry is present |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
144 |
if(remoteProgramViewer != null) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
145 |
IPath currentPath = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim()); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
146 |
remotePathEntries.remove(currentPath); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
147 |
remotePathEntries.add(0, currentPath); // MRU |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
148 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
149 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
150 |
// make a set, removing user dupes, and also removing the entries we added |
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
|
151 |
Set<IPath> uniqueRemotePathEntries = new LinkedHashSet<IPath>(remotePathEntries); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
152 |
if (projectGeneratedRemotePaths != null) |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
153 |
uniqueRemotePathEntries.removeAll(projectGeneratedRemotePaths); |
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
|
154 |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
155 |
// truncate size, removing from end |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
156 |
List<IPath> mruPathEntries = new ArrayList<IPath>(uniqueRemotePathEntries); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
157 |
while (mruPathEntries.size() > 10) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
158 |
mruPathEntries.remove(mruPathEntries.size() - 1); |
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
|
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 |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
161 |
String pathSoup = TextUtils.catenateStrings(mruPathEntries.toArray(), "|"); //$NON-NLS-1$ |
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
|
162 |
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
|
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 |
|
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 |
/** |
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 |
* |
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 |
*/ |
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 |
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
|
169 |
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
|
170 |
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
|
171 |
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
|
172 |
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
|
173 |
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
|
174 |
} |
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
|
175 |
} |
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
|
176 |
|
956 | 177 |
|
178 |
private void createProcessSelector(Composite composite) { |
|
179 |
Label label; |
|
180 |
||
181 |
label = new Label(composite, SWT.WRAP); |
|
969 | 182 |
label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.ModeLabel"), data.getModeLabel())); //$NON-NLS-1$ |
956 | 183 |
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); |
184 |
||
185 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(composite); |
|
186 |
||
187 |
Composite radioGroup = new Composite(composite, SWT.NONE); |
|
188 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(radioGroup); |
|
189 |
GridLayoutFactory.fillDefaults().extendedMargins(INDENT, 0, 0, 0).numColumns(2).applyTo(radioGroup); |
|
190 |
||
191 |
createProjectExecutableRadioButton(radioGroup); |
|
192 |
createRemoteExecutableRadioButton(radioGroup); |
|
193 |
||
194 |
label = new Label(radioGroup, SWT.SEPARATOR | SWT.HORIZONTAL); |
|
195 |
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(label); |
|
196 |
||
197 |
createAttachToProcessRadioButton(radioGroup); |
|
198 |
||
199 |
String msg; |
|
200 |
if (data.isDebug()) |
|
969 | 201 |
msg = Messages.getString("DebugRunProcessDialog.DebugConfigureMsg"); //$NON-NLS-1$ |
956 | 202 |
else |
969 | 203 |
msg = Messages.getString("DebugRunProcessDialog.RunConfigureMsg"); //$NON-NLS-1$ |
956 | 204 |
setMessage(msg); |
205 |
||
206 |
switch (data.getExeSelection()) { |
|
207 |
case USE_PROJECT_EXECUTABLE: |
|
208 |
projectExecutableRadioButton.setSelection(true); |
|
209 |
break; |
|
210 |
case USE_REMOTE_EXECUTABLE: |
|
211 |
remoteExecutableRadioButton.setSelection(true); |
|
212 |
break; |
|
213 |
case ATTACH_TO_PROCESS: |
|
214 |
attachToProcessRadioButton.setSelection(true); |
|
215 |
break; |
|
216 |
} |
|
217 |
} |
|
218 |
||
219 |
private void createPackageConfiguration(Composite composite) { |
|
220 |
Label label; |
|
221 |
||
222 |
label = new Label(composite, SWT.WRAP); |
|
969 | 223 |
label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.DeployLabel"), data.getModeLabel())); //$NON-NLS-1$ |
956 | 224 |
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); |
225 |
||
226 |
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); |
|
227 |
||
228 |
packageInfoLabel = new Label(composite, SWT.WRAP); |
|
229 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(packageInfoLabel); |
|
230 |
composite.addControlListener(new ControlAdapter() { |
|
231 |
@Override |
|
232 |
public void controlResized(ControlEvent e) { |
|
233 |
packageInfoLabel.pack(); |
|
234 |
} |
|
235 |
}); |
|
236 |
||
237 |
installPackageCheckbox = new Button(composite, SWT.CHECK); |
|
238 |
GridDataFactory.fillDefaults().applyTo(installPackageCheckbox); |
|
239 |
||
969 | 240 |
installPackageCheckbox.setText(Messages.getString("DebugRunProcessDialog.InstallBeforeLaunchLabel")); //$NON-NLS-1$ |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
241 |
installPackageCheckbox.setToolTipText(Messages.getString("DebugRunProcessDialog.SISCheckboxTooltip")); //$NON-NLS-1$ |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
242 |
|
956 | 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 |
||
258 |
if (data.isInstallPackage()) { |
|
259 |
installPackageCheckbox.setSelection(true); |
|
260 |
updatePackageUI(); |
|
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); |
|
969 | 274 |
sisLabel.setText(Messages.getString("DebugRunProcessDialog.SISFileLabel")); //$NON-NLS-1$ |
956 | 275 |
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(1, 1).applyTo(sisLabel); |
969 | 276 |
sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
277 |
sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ |
|
956 | 278 |
|
279 |
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
|
280 |
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(sisFile); |
969 | 281 |
sisFile.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
282 |
sisFile.setData(UID, "DebugRunProcessDialog.sisFile"); //$NON-NLS-1$ |
|
956 | 283 |
|
284 |
sisFile.addSelectionListener(new SelectionAdapter() { |
|
285 |
@Override |
|
286 |
public void widgetSelected(SelectionEvent e) { |
|
287 |
updateSisFile(); |
|
288 |
} |
|
289 |
}); |
|
290 |
||
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
291 |
updateSisFileCombo(cpi); |
956 | 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); |
|
969 | 304 |
link.setText("<a>" + Messages.getString("DebugRunProcessDialog.SISConfigLinkText") + "...</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
956 | 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) { |
|
969 | 308 |
PreferencesUtil.createPropertyDialogOn(getShell(), project, "com.nokia.carbide.cdt.internal.builder.ui.CarbideBuildConfigurationsPage", null, null).open(); //$NON-NLS-1$ |
956 | 309 |
} |
310 |
}); |
|
969 | 311 |
link.setData(UID, "DebugRunProcessDialog.link"); //$NON-NLS-1$ |
956 | 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); |
|
969 | 318 |
sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
319 |
sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ |
|
956 | 320 |
|
321 |
sisEdit = new Text(composite, SWT.BORDER); |
|
322 |
GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(sisEdit); |
|
969 | 323 |
sisEdit.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
956 | 324 |
sisEdit.addModifyListener(new ModifyListener() { |
325 |
public void modifyText(ModifyEvent e) { |
|
326 |
updateSisFile(); |
|
327 |
validate(); |
|
328 |
} |
|
329 |
}); |
|
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
330 |
String sisPath = data.getSisPath(); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
331 |
if (sisPath != null) |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
332 |
sisEdit.setText(sisPath); |
969 | 333 |
sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit"); //$NON-NLS-1$ |
956 | 334 |
|
335 |
sisBrowse = new Button(composite, SWT.NONE); |
|
969 | 336 |
sisBrowse.setText(Messages.getString("DebugRunProcessDialog.BrowseLabel")); //$NON-NLS-1$ |
956 | 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 |
||
969 | 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$ |
|
956 | 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 |
}); |
|
969 | 356 |
sisBrowse.setData(UID, "DebugRunProcessDialog.sisBrowse"); //$NON-NLS-1$ |
956 | 357 |
} |
358 |
} |
|
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
359 |
|
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
360 |
|
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
361 |
private void updateSisFileCombo(ICarbideProjectInfo cpi) { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
362 |
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
|
363 |
|
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
364 |
ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
365 |
for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
366 |
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
|
367 |
sisFile.add(sisPath.toOSString()); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
368 |
} |
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 |
// 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
|
371 |
if (sisFile.getItemCount() > 1) { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
372 |
sisFile.select(1); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
373 |
} else { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
374 |
sisFile.select(0); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
375 |
} |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
376 |
updateSisFile(); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
377 |
} |
956 | 378 |
|
379 |
||
380 |
/** |
|
381 |
* |
|
382 |
*/ |
|
383 |
protected void updateSisFile() { |
|
384 |
String sisPath; |
|
385 |
if (sisFile != null) { |
|
386 |
sisPath = sisFile.getSelectionIndex() == 0 ? null : sisFile.getText(); //$NON-NLS-1$ |
|
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) { |
|
403 |
Shell shell = getShell(); |
|
404 |
if (shell == null || shell.isDisposed()) { |
|
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 |
||
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
419 |
updateSisFileCombo(cpi); |
956 | 420 |
} |
421 |
} |
|
422 |
} |
|
423 |
||
424 |
protected void initUI() { |
|
1090 | 425 |
List<IPath> exes = data.getLaunchableExes(); |
956 | 426 |
projectExecutableViewer.setInput(exes); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
427 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
428 |
// this path may either be a project-relative or remote path |
956 | 429 |
IPath exeSelectionPath = data.getExeSelectionPath(); |
430 |
if (exeSelectionPath.equals(Path.EMPTY) && !exes.isEmpty()) |
|
431 |
exeSelectionPath = exes.get(0); |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
432 |
|
1090 | 433 |
if (!Path.EMPTY.equals(exeSelectionPath)) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
434 |
// keep previous path if possible... |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
435 |
IPath remotePath = exeSelectionPath; |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
436 |
if (data.getExes().contains(remotePath)) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
437 |
// unless that was actually a host-side path, which should be converted |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
438 |
remotePath = createSuggestedRemotePath(exeSelectionPath); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
439 |
} else { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
440 |
// selection is already a remote path; map back to project if possible |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
441 |
IPath projPath = getHostFileForRemoteLocation(exeSelectionPath); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
442 |
if (projPath != null) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
443 |
exeSelectionPath = projPath; |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
444 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
445 |
else { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
446 |
// remote path does not correspond to anything; select some project exe so |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
447 |
// the combo isn't empty |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
448 |
exeSelectionPath = exes.get(0); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
449 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
450 |
} |
1090 | 451 |
projectExecutableViewer.setSelection(new StructuredSelection(exeSelectionPath)); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
452 |
|
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
|
453 |
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
|
454 |
if (!remotePathEntries.contains(remotePath)) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
455 |
remotePathEntries.add(0, remotePath); // MRU |
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
|
456 |
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
|
457 |
} |
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
|
458 |
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
|
459 |
} |
1090 | 460 |
} |
461 |
||
956 | 462 |
if (data.getExeSelection() == EExeSelection.USE_PROJECT_EXECUTABLE && exeSelectionPath != null) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
463 |
projectExecutableViewer.getControl().forceFocus(); |
956 | 464 |
} |
465 |
||
466 |
if (data.getExeSelection() == EExeSelection.USE_REMOTE_EXECUTABLE && exeSelectionPath != null) { |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
467 |
remoteProgramViewer.getControl().forceFocus(); |
956 | 468 |
} |
469 |
||
470 |
if (data.getExeSelection() == EExeSelection.ATTACH_TO_PROCESS) { |
|
471 |
attachToProcessRadioButton.forceFocus(); |
|
472 |
} |
|
473 |
||
474 |
handleProjectExecutableRadioSelected(); |
|
475 |
handleRemoteExecutableRadioSelected(); |
|
476 |
handleAttachToProcessRadioSelected(); |
|
477 |
} |
|
478 |
||
479 |
||
480 |
private IPath createSuggestedRemotePath(IPath exeSelectionPath) { |
|
481 |
String filename = exeSelectionPath.lastSegment(); |
|
969 | 482 |
return PathUtils.createPath("C:/sys/bin").append(filename); //$NON-NLS-1$ |
956 | 483 |
} |
484 |
||
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
485 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
486 |
/** |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
487 |
* Get the host-side file for a given remote location. Opposite of |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
488 |
* {@link #createSuggestedRemotePath(IPath)}. |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
489 |
* @param path |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
490 |
* @return host path or <code>null</code> |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
491 |
*/ |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
492 |
private IPath getHostFileForRemoteLocation(IPath path) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
493 |
for (IPath exe : data.getExes()) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
494 |
// no... we don't have any knowledge (yet) of the actual install path, |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
495 |
// so comparing the exact path will fail if the user edited it. |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
496 |
// IPath remoteSuggested = createSuggestedRemotePath(exe); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
497 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
498 |
// be pretty loose in the matching for now |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
499 |
if (exe.lastSegment().equalsIgnoreCase(path.lastSegment())) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
500 |
return exe; |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
501 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
502 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
503 |
return null; |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
504 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
505 |
|
956 | 506 |
/** |
507 |
* Allow selecting an executable detected to be built by the program. |
|
508 |
* @param radioGroup |
|
509 |
*/ |
|
510 |
private void createProjectExecutableRadioButton(Composite radioGroup) { |
|
511 |
projectExecutableRadioButton = new Button(radioGroup, SWT.RADIO); |
|
512 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(projectExecutableRadioButton); |
|
969 | 513 |
projectExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchProjectExeLabel")); //$NON-NLS-1$ |
514 |
projectExecutableRadioButton.setData(UID, "radio_project_executable"); //$NON-NLS-1$ |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
515 |
projectExecutableRadioButton.setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchProjectExecutableRadioTooltip")); //$NON-NLS-1$ |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
516 |
|
956 | 517 |
|
518 |
projectExecutableViewer = new ComboViewer(radioGroup, SWT.READ_ONLY); |
|
519 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(projectExecutableViewer.getControl()); |
|
969 | 520 |
projectExecutableViewer.getControl().setData(UID, "combo_project_executable"); //$NON-NLS-1$ |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
521 |
projectExecutableViewer.getControl().setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchProjectExecutableSelectorTooltip")); //$NON-NLS-1$ |
956 | 522 |
|
523 |
projectExecutableViewer.setContentProvider(new ArrayContentProvider()); |
|
524 |
projectExecutableViewer.setLabelProvider(new LabelProvider() { |
|
525 |
@Override |
|
526 |
public String getText(Object element) { |
|
527 |
if (element instanceof IPath) |
|
528 |
return ((IPath) element).lastSegment(); |
|
529 |
return super.getText(element); |
|
530 |
} |
|
531 |
}); |
|
532 |
||
533 |
projectExecutableRadioButton.addSelectionListener(new SelectionAdapter() { |
|
534 |
@Override |
|
535 |
public void widgetSelected(SelectionEvent e) { |
|
536 |
handleProjectExecutableRadioSelected(); |
|
537 |
} |
|
538 |
||
539 |
}); |
|
540 |
||
541 |
projectExecutableViewer.addSelectionChangedListener(new ISelectionChangedListener() { |
|
542 |
||
543 |
public void selectionChanged(SelectionChangedEvent event) { |
|
544 |
Object sel = ((IStructuredSelection) event.getSelection()).getFirstElement(); |
|
545 |
if (sel instanceof IPath) { |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
546 |
if (projectExecutableRadioButton.getSelection()) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
547 |
data.setExeSelectionPath((IPath) sel); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
548 |
} |
956 | 549 |
|
550 |
// track the default remote program from the executable, for easy editing |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
551 |
if (remoteProgramViewer != null && !remoteExecutableRadioButton.getSelection()) { |
956 | 552 |
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
|
553 |
// 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
|
554 |
remoteProgramViewer.setSelection(new StructuredSelection(exeSelectionPath)); |
956 | 555 |
} |
556 |
||
557 |
validate(); |
|
558 |
} |
|
559 |
} |
|
560 |
}); |
|
561 |
} |
|
562 |
||
563 |
private void handleProjectExecutableRadioSelected() { |
|
564 |
if (projectExecutableRadioButton.getSelection()) { |
|
565 |
projectExecutableViewer.getControl().setEnabled(true); |
|
566 |
data.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); |
|
567 |
IPath selectedPath = (IPath) ((IStructuredSelection) projectExecutableViewer.getSelection()).getFirstElement(); |
|
568 |
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
|
569 |
data.setExeSelectionPath(selectedPath); |
956 | 570 |
} |
571 |
validate(); |
|
572 |
} else { |
|
573 |
projectExecutableViewer.getControl().setEnabled(false); |
|
574 |
// another button becomes active and sets the new launch process |
|
575 |
} |
|
576 |
} |
|
577 |
||
578 |
/** |
|
579 |
* Allow user to enter an executable path. |
|
580 |
* @param radioGroup |
|
581 |
*/ |
|
582 |
private void createRemoteExecutableRadioButton(Composite radioGroup) { |
|
583 |
remoteExecutableRadioButton = new Button(radioGroup, SWT.RADIO); |
|
584 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(remoteExecutableRadioButton); |
|
969 | 585 |
remoteExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgLabel")); //$NON-NLS-1$ |
956 | 586 |
|
969 | 587 |
remoteExecutableRadioButton.setData(UID, "radio_remote_program"); //$NON-NLS-1$ |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
588 |
remoteExecutableRadioButton.setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgramRadioTooltip")); //$NON-NLS-1$ |
956 | 589 |
|
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
|
590 |
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
|
591 |
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
|
592 |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
593 |
projectGeneratedRemotePaths = new ArrayList<IPath>(); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
594 |
for (IPath launchable : data.getLaunchableExes()) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
595 |
projectGeneratedRemotePaths.add(createSuggestedRemotePath(launchable)); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
596 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
597 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
598 |
// add the entries before the user MRU entries |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
599 |
remotePathEntries.addAll(0, projectGeneratedRemotePaths); |
956 | 600 |
|
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
|
601 |
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
|
602 |
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
|
603 |
@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
|
604 |
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
|
605 |
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
|
606 |
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
|
607 |
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
|
608 |
} |
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
|
609 |
}); |
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
|
610 |
remoteProgramViewer.setInput(remotePathEntries); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
611 |
remoteProgramViewer.getCombo().setVisibleItemCount(Math.min(10, remotePathEntries.size())); |
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
|
612 |
|
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
|
613 |
remoteProgramViewer.setData(UID, "combo_remote_program"); //$NON-NLS-1$ |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
614 |
remoteProgramViewer.getControl().setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgramSelectorTooltip")); //$NON-NLS-1$ |
956 | 615 |
|
616 |
remoteExecutableRadioButton.addSelectionListener(new SelectionAdapter() { |
|
617 |
@Override |
|
618 |
public void widgetSelected(SelectionEvent e) { |
|
619 |
handleRemoteExecutableRadioSelected(); |
|
620 |
} |
|
621 |
||
622 |
}); |
|
623 |
||
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
|
624 |
remoteProgramViewer.getCombo().addModifyListener(new ModifyListener() { |
956 | 625 |
public void modifyText(ModifyEvent e) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
626 |
IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim()); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
627 |
if (remoteExecutableRadioButton.getSelection()) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
628 |
data.setExeSelectionPath(path); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
629 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
630 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
631 |
if (!projectExecutableRadioButton.getSelection()) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
632 |
IPath projPath = getHostFileForRemoteLocation(path); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
633 |
if (projPath != null) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
634 |
projectExecutableViewer.setSelection(new StructuredSelection(projPath)); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
635 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
636 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
637 |
|
956 | 638 |
validate(); |
639 |
} |
|
640 |
}); |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
641 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
642 |
remoteProgramViewer.getCombo().addFocusListener(new FocusAdapter() { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
643 |
/* (non-Javadoc) |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
644 |
* @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent) |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
645 |
*/ |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
646 |
@Override |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
647 |
public void focusLost(FocusEvent e) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
648 |
IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText().trim()); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
649 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
650 |
// MRU behavior |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
651 |
remotePathEntries.remove(path); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
652 |
remotePathEntries.add(0, path); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
653 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
654 |
}); |
956 | 655 |
} |
656 |
||
657 |
private void handleRemoteExecutableRadioSelected() { |
|
658 |
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
|
659 |
remoteProgramViewer.getControl().setEnabled(true); |
956 | 660 |
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
|
661 |
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
|
662 |
data.setExeSelectionPath(path); |
956 | 663 |
validate(); |
664 |
} 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
|
665 |
remoteProgramViewer.getControl().setEnabled(false); |
956 | 666 |
// another button becomes active and sets the new launch process |
667 |
} |
|
668 |
} |
|
669 |
||
670 |
/** |
|
671 |
* Allow user to attach to a process. |
|
672 |
* @param radioGroup |
|
673 |
*/ |
|
674 |
private void createAttachToProcessRadioButton(Composite radioGroup) { |
|
675 |
attachToProcessRadioButton = new Button(radioGroup, SWT.RADIO); |
|
676 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(attachToProcessRadioButton); |
|
969 | 677 |
attachToProcessRadioButton.setText(Messages.getString("DebugRunProcessDialog.AttachLabel")); //$NON-NLS-1$ |
956 | 678 |
|
969 | 679 |
attachToProcessRadioButton.setData(UID, "radio_attach_to_process"); //$NON-NLS-1$ |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
680 |
attachToProcessRadioButton.setToolTipText(Messages.getString("DebugRunProcessDialog.AttachProcessRadioTooltip")); //$NON-NLS-1$ |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
681 |
|
956 | 682 |
Label label = new Label(radioGroup, SWT.WRAP); |
683 |
GridDataFactory.fillDefaults().grab(false, false).align(SWT.LEFT, SWT.CENTER).applyTo(label); |
|
684 |
||
969 | 685 |
label.setText(Messages.getString("DebugRunProcessDialog.AttachAddlMsg")); //$NON-NLS-1$ |
956 | 686 |
|
687 |
attachToProcessRadioButton.addSelectionListener(new SelectionAdapter() { |
|
688 |
@Override |
|
689 |
public void widgetSelected(SelectionEvent e) { |
|
690 |
handleAttachToProcessRadioSelected(); |
|
691 |
} |
|
692 |
||
693 |
}); |
|
694 |
||
695 |
} |
|
696 |
||
697 |
private void handleAttachToProcessRadioSelected() { |
|
698 |
if (attachToProcessRadioButton.getSelection()) { |
|
699 |
data.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); |
|
700 |
data.setExeSelectionPath(null); |
|
701 |
validate(); |
|
702 |
} else { |
|
703 |
// another button becomes active and sets the new launch process |
|
704 |
} |
|
705 |
} |
|
706 |
||
707 |
@Override |
|
708 |
protected void validate() { |
|
709 |
IStatus status = Status.OK_STATUS; |
|
710 |
||
711 |
// check launch method |
|
712 |
IPath exePath = data.getExeSelectionPath(); |
|
713 |
switch (data.getExeSelection()) { |
|
714 |
case USE_PROJECT_EXECUTABLE: |
|
715 |
if (exePath.isEmpty()) { |
|
969 | 716 |
status = error(Messages.getString("DebugRunProcessDialog.NoExesError")); //$NON-NLS-1$ |
956 | 717 |
} |
718 |
break; |
|
719 |
case USE_REMOTE_EXECUTABLE: |
|
720 |
if (exePath.isEmpty()) { |
|
969 | 721 |
status = error(Messages.getString("DebugRunProcessDialog.EnterPathError")); //$NON-NLS-1$ |
956 | 722 |
} else { |
723 |
String exePathString = exePath.toString(); |
|
724 |
char drive = exePathString.charAt(0); |
|
725 |
char colon = exePathString.length() < 2 ? 0x0 : exePathString.charAt(1); |
|
726 |
char root = exePathString.length() < 3 ? 0x0 : exePathString.charAt(2); |
|
727 |
char lastChar = exePathString.charAt(exePathString.length() - 1); |
|
728 |
if (!Character.isLetter(drive) || colon != ':' || (root != '\\' && root != '/') || |
|
729 |
lastChar == '\\' || lastChar == '/' || lastChar == ':') { |
|
969 | 730 |
status = error(Messages.getString("DebugRunProcessDialog.AbsolutePathError")); //$NON-NLS-1$ |
956 | 731 |
} else if (exePath.getFileExtension() == null) { |
969 | 732 |
status = warning(Messages.getString("DebugRunProcessDialog.FilePathError")); //$NON-NLS-1$ |
956 | 733 |
} |
734 |
} |
|
735 |
break; |
|
736 |
case ATTACH_TO_PROCESS: |
|
737 |
break; |
|
738 |
} |
|
739 |
||
740 |
// check SIS selection |
|
741 |
if (data.isInstallPackage()) { |
|
742 |
if (sisEdit != null) { |
|
743 |
String text = sisEdit.getText().trim(); |
|
744 |
if (text.length() > 0) { |
|
745 |
// empty is allowed, but if they specify something, make sure |
|
746 |
// it exists |
|
747 |
File file = new File(text); |
|
748 |
if (!file.exists()) { |
|
969 | 749 |
status = error(Messages.getString("DebugRunProcessDialog.SISFileExistError"), text); //$NON-NLS-1$ |
956 | 750 |
} |
751 |
} |
|
752 |
} |
|
753 |
} |
|
754 |
||
755 |
updateStatus(status); |
|
756 |
} |
|
757 |
} |
|
758 |