author | dadubrow |
Wed, 20 Oct 2010 09:35:54 -0500 | |
changeset 2163 | f0a9f2d04d4a |
parent 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 |
* |
|
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; |
2163 | 73 |
import com.nokia.cdt.internal.debug.launch.newwizard.IDebugRunProcessWizardData.EExeSelection; |
956 | 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 |
|
2163 | 98 |
private IDebugRunProcessWizardData debugRunProcessWizardData; |
99 |
||
100 |
protected DebugRunProcessDialog(Shell shell, IWizardData data) { |
|
956 | 101 |
super(shell, data); |
2163 | 102 |
debugRunProcessWizardData = (IDebugRunProcessWizardData) data; |
956 | 103 |
} |
104 |
||
105 |
||
106 |
/* (non-Javadoc) |
|
107 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
|
108 |
*/ |
|
109 |
@Override |
|
110 |
protected Control createDialogArea(Composite parent) { |
|
111 |
Composite composite = initDialogArea(parent, |
|
969 | 112 |
MessageFormat.format(Messages.getString("DebugRunProcessDialog.ChangeProcessMsg"), data.getModeLabel()), //$NON-NLS-1$ |
956 | 113 |
data.isDebug() ? LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_DEBUG_PROCESS : |
114 |
LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_RUN_PROCESS); |
|
115 |
||
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
|
116 |
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
|
117 |
|
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 |
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
|
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 |
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
|
121 |
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
|
122 |
} |
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
|
123 |
}); |
956 | 124 |
|
125 |
createProcessSelector(composite); |
|
126 |
||
127 |
Label sep = new Label(composite, SWT.NONE); |
|
128 |
GridDataFactory.fillDefaults().applyTo(sep); |
|
129 |
||
130 |
createPackageConfiguration(composite); |
|
131 |
||
132 |
initUI(); |
|
133 |
||
134 |
validate(); |
|
135 |
||
136 |
return composite; |
|
137 |
} |
|
138 |
||
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
|
139 |
// 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
|
140 |
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
|
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 |
/** |
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 |
* |
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 |
*/ |
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 |
protected void saveRemoteProgramEntries() { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
146 |
// 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
|
147 |
if(remoteProgramViewer != null) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
148 |
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
|
149 |
remotePathEntries.remove(currentPath); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
150 |
remotePathEntries.add(0, currentPath); // MRU |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
151 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
152 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
153 |
// 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
|
154 |
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
|
155 |
if (projectGeneratedRemotePaths != null) |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
156 |
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
|
157 |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
158 |
// truncate size, removing from end |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
159 |
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
|
160 |
while (mruPathEntries.size() > 10) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
161 |
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
|
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 |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
164 |
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
|
165 |
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
|
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 |
/** |
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 |
* |
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 |
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
|
172 |
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
|
173 |
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
|
174 |
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
|
175 |
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
|
176 |
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
|
177 |
} |
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
|
178 |
} |
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
|
179 |
|
956 | 180 |
|
181 |
private void createProcessSelector(Composite composite) { |
|
182 |
Label label; |
|
183 |
||
184 |
label = new Label(composite, SWT.WRAP); |
|
969 | 185 |
label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.ModeLabel"), data.getModeLabel())); //$NON-NLS-1$ |
956 | 186 |
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); |
187 |
||
188 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(composite); |
|
189 |
||
190 |
Composite radioGroup = new Composite(composite, SWT.NONE); |
|
191 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(radioGroup); |
|
192 |
GridLayoutFactory.fillDefaults().extendedMargins(INDENT, 0, 0, 0).numColumns(2).applyTo(radioGroup); |
|
193 |
||
194 |
createProjectExecutableRadioButton(radioGroup); |
|
195 |
createRemoteExecutableRadioButton(radioGroup); |
|
196 |
||
197 |
label = new Label(radioGroup, SWT.SEPARATOR | SWT.HORIZONTAL); |
|
198 |
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(label); |
|
199 |
||
200 |
createAttachToProcessRadioButton(radioGroup); |
|
201 |
||
202 |
String msg; |
|
203 |
if (data.isDebug()) |
|
969 | 204 |
msg = Messages.getString("DebugRunProcessDialog.DebugConfigureMsg"); //$NON-NLS-1$ |
956 | 205 |
else |
969 | 206 |
msg = Messages.getString("DebugRunProcessDialog.RunConfigureMsg"); //$NON-NLS-1$ |
956 | 207 |
setMessage(msg); |
208 |
||
2163 | 209 |
switch (debugRunProcessWizardData.getExeSelection()) { |
956 | 210 |
case USE_PROJECT_EXECUTABLE: |
211 |
projectExecutableRadioButton.setSelection(true); |
|
212 |
break; |
|
213 |
case USE_REMOTE_EXECUTABLE: |
|
214 |
remoteExecutableRadioButton.setSelection(true); |
|
215 |
break; |
|
216 |
case ATTACH_TO_PROCESS: |
|
217 |
attachToProcessRadioButton.setSelection(true); |
|
218 |
break; |
|
219 |
} |
|
220 |
} |
|
221 |
||
222 |
private void createPackageConfiguration(Composite composite) { |
|
223 |
Label label; |
|
224 |
||
225 |
label = new Label(composite, SWT.WRAP); |
|
969 | 226 |
label.setText(MessageFormat.format(Messages.getString("DebugRunProcessDialog.DeployLabel"), data.getModeLabel())); //$NON-NLS-1$ |
956 | 227 |
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); |
228 |
||
229 |
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); |
|
230 |
||
231 |
packageInfoLabel = new Label(composite, SWT.WRAP); |
|
232 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(packageInfoLabel); |
|
233 |
composite.addControlListener(new ControlAdapter() { |
|
234 |
@Override |
|
235 |
public void controlResized(ControlEvent e) { |
|
236 |
packageInfoLabel.pack(); |
|
237 |
} |
|
238 |
}); |
|
239 |
||
240 |
installPackageCheckbox = new Button(composite, SWT.CHECK); |
|
241 |
GridDataFactory.fillDefaults().applyTo(installPackageCheckbox); |
|
242 |
||
969 | 243 |
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
|
244 |
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
|
245 |
|
956 | 246 |
installPackageUI = new Composite(composite, SWT.NONE); |
247 |
GridDataFactory.fillDefaults().indent(INDENT, 0).applyTo(installPackageUI); |
|
248 |
||
249 |
createSISContents(installPackageUI); |
|
250 |
||
251 |
||
252 |
installPackageCheckbox.addSelectionListener(new SelectionAdapter() { |
|
253 |
@Override |
|
254 |
public void widgetSelected(SelectionEvent e) { |
|
2163 | 255 |
debugRunProcessWizardData.setInstallPackage(installPackageCheckbox.getSelection()); |
956 | 256 |
updatePackageUI(); |
257 |
} |
|
258 |
}); |
|
259 |
||
260 |
||
2163 | 261 |
if (debugRunProcessWizardData.isInstallPackage()) { |
956 | 262 |
installPackageCheckbox.setSelection(true); |
263 |
updatePackageUI(); |
|
264 |
} |
|
265 |
||
266 |
updateSisFile(); |
|
267 |
updatePackageUI(); |
|
268 |
} |
|
269 |
||
270 |
protected void createSISContents(Composite composite) { |
|
271 |
GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(composite); |
|
272 |
||
273 |
final IProject project = data.getProject(); |
|
274 |
ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); |
|
275 |
if (cpi != null) { |
|
276 |
final Label sisLabel = new Label(composite, SWT.NONE); |
|
969 | 277 |
sisLabel.setText(Messages.getString("DebugRunProcessDialog.SISFileLabel")); //$NON-NLS-1$ |
956 | 278 |
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(1, 1).applyTo(sisLabel); |
969 | 279 |
sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
280 |
sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ |
|
956 | 281 |
|
282 |
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
|
283 |
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(sisFile); |
969 | 284 |
sisFile.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
285 |
sisFile.setData(UID, "DebugRunProcessDialog.sisFile"); //$NON-NLS-1$ |
|
956 | 286 |
|
287 |
sisFile.addSelectionListener(new SelectionAdapter() { |
|
288 |
@Override |
|
289 |
public void widgetSelected(SelectionEvent e) { |
|
290 |
updateSisFile(); |
|
291 |
} |
|
292 |
}); |
|
293 |
||
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
294 |
updateSisFileCombo(cpi); |
956 | 295 |
|
296 |
// listen for events so we can detect if they click on the link below and add new sis info. |
|
297 |
CoreModel.getDefault().getProjectDescriptionManager().addCProjectDescriptionListener(this, CProjectDescriptionEvent.APPLIED); |
|
298 |
||
299 |
composite.addDisposeListener(new DisposeListener() { |
|
300 |
||
301 |
public void widgetDisposed(DisposeEvent e) { |
|
302 |
CoreModel.getDefault().getProjectDescriptionManager().removeCProjectDescriptionListener(DebugRunProcessDialog.this); |
|
303 |
} |
|
304 |
}); |
|
305 |
||
306 |
Link link = new Link(composite, SWT.NONE); |
|
969 | 307 |
link.setText("<a>" + Messages.getString("DebugRunProcessDialog.SISConfigLinkText") + "...</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
956 | 308 |
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).grab(true, false).applyTo(link); |
309 |
link.addSelectionListener(new SelectionAdapter() { |
|
310 |
public void widgetSelected(SelectionEvent e) { |
|
969 | 311 |
PreferencesUtil.createPropertyDialogOn(getShell(), project, "com.nokia.carbide.cdt.internal.builder.ui.CarbideBuildConfigurationsPage", null, null).open(); //$NON-NLS-1$ |
956 | 312 |
} |
313 |
}); |
|
969 | 314 |
link.setData(UID, "DebugRunProcessDialog.link"); //$NON-NLS-1$ |
956 | 315 |
} else { |
316 |
// not a Carbide project, just an executable. show a browse/edit combo |
|
317 |
// to let them select a sis file if they want to. |
|
318 |
final Label sisLabel = new Label(composite, SWT.NONE); |
|
319 |
sisLabel.setText("SIS File to Install:"); //$NON-NLS-1$ |
|
320 |
GridDataFactory.swtDefaults().span(2, 1).applyTo(sisLabel); |
|
969 | 321 |
sisLabel.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
322 |
sisLabel.setData(UID, "DebugRunProcessDialog.sisLabel"); //$NON-NLS-1$ |
|
956 | 323 |
|
324 |
sisEdit = new Text(composite, SWT.BORDER); |
|
325 |
GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(sisEdit); |
|
969 | 326 |
sisEdit.setToolTipText(Messages.getString("DebugRunProcessDialog.SISQueryTip")); //$NON-NLS-1$ |
956 | 327 |
sisEdit.addModifyListener(new ModifyListener() { |
328 |
public void modifyText(ModifyEvent e) { |
|
329 |
updateSisFile(); |
|
330 |
validate(); |
|
331 |
} |
|
332 |
}); |
|
2163 | 333 |
String sisPath = debugRunProcessWizardData.getSisPath(); |
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
334 |
if (sisPath != null) |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
335 |
sisEdit.setText(sisPath); |
969 | 336 |
sisEdit.setData(UID, "DebugRunProcessDialog.sisEdit"); //$NON-NLS-1$ |
956 | 337 |
|
338 |
sisBrowse = new Button(composite, SWT.NONE); |
|
969 | 339 |
sisBrowse.setText(Messages.getString("DebugRunProcessDialog.BrowseLabel")); //$NON-NLS-1$ |
956 | 340 |
sisBrowse.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
341 |
sisBrowse.addSelectionListener(new SelectionAdapter() { |
|
342 |
public void widgetSelected(SelectionEvent evt) { |
|
343 |
FileDialog dialog = new FileDialog(getShell(), SWT.NONE); |
|
344 |
||
969 | 345 |
dialog.setText(Messages.getString("DebugRunProcessDialog.Title")); //$NON-NLS-1$ |
346 |
dialog.setFilterExtensions(new String[] {"*.sis*", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ |
|
347 |
dialog.setFilterNames(new String[] {Messages.getString("DebugRunProcessDialog.InstallFilterName"), Messages.getString("DebugRunProcessDialog.AllFilterName")}); //$NON-NLS-1$ //$NON-NLS-2$ |
|
956 | 348 |
|
349 |
BrowseDialogUtils.initializeFrom(dialog, sisEdit); |
|
350 |
||
351 |
String result = dialog.open(); |
|
352 |
if (result != null && new File(result).exists()) { |
|
353 |
sisEdit.setText(result); |
|
354 |
updateSisFile(); |
|
355 |
validate(); |
|
356 |
} |
|
357 |
} |
|
358 |
}); |
|
969 | 359 |
sisBrowse.setData(UID, "DebugRunProcessDialog.sisBrowse"); //$NON-NLS-1$ |
956 | 360 |
} |
361 |
} |
|
1045
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 |
private void updateSisFileCombo(ICarbideProjectInfo cpi) { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
365 |
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
|
366 |
|
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
367 |
ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
368 |
for (ISISBuilderInfo info : config.getSISBuilderInfoList()) { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
369 |
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
|
370 |
sisFile.add(sisPath.toOSString()); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
371 |
} |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
372 |
|
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
373 |
// 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
|
374 |
if (sisFile.getItemCount() > 1) { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
375 |
sisFile.select(1); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
376 |
} else { |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
377 |
sisFile.select(0); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
378 |
} |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
379 |
updateSisFile(); |
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
380 |
} |
956 | 381 |
|
382 |
||
383 |
/** |
|
384 |
* |
|
385 |
*/ |
|
386 |
protected void updateSisFile() { |
|
387 |
String sisPath; |
|
388 |
if (sisFile != null) { |
|
389 |
sisPath = sisFile.getSelectionIndex() == 0 ? null : sisFile.getText(); //$NON-NLS-1$ |
|
2163 | 390 |
debugRunProcessWizardData.setSisPath(sisPath); |
956 | 391 |
} else if (sisEdit != null) { |
392 |
sisPath = sisEdit.getText(); |
|
2163 | 393 |
debugRunProcessWizardData.setSisPath(sisPath); |
956 | 394 |
} |
395 |
} |
|
396 |
||
397 |
||
398 |
private void updatePackageUI() { |
|
2163 | 399 |
installPackageUI.setEnabled(debugRunProcessWizardData.isInstallPackage()); |
956 | 400 |
for (Control kid : installPackageUI.getChildren()) |
2163 | 401 |
kid.setEnabled(debugRunProcessWizardData.isInstallPackage()); |
956 | 402 |
} |
403 |
||
404 |
||
405 |
public void handleEvent(CProjectDescriptionEvent event) { |
|
406 |
Shell shell = getShell(); |
|
407 |
if (shell == null || shell.isDisposed()) { |
|
408 |
return; |
|
409 |
} |
|
410 |
||
411 |
IProject project = event.getProject() ; |
|
412 |
||
413 |
if (project != data.getProject()) { |
|
414 |
return; |
|
415 |
} |
|
416 |
||
417 |
if (sisFile != null) { |
|
418 |
ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); |
|
419 |
if (cpi != null) { |
|
420 |
sisFile.removeAll(); |
|
421 |
||
1045
7bd4eb5648d7
bug 10808 tweak UI + validation + fix issues with non-carbide project case
dadubrow
parents:
969
diff
changeset
|
422 |
updateSisFileCombo(cpi); |
956 | 423 |
} |
424 |
} |
|
425 |
} |
|
426 |
||
427 |
protected void initUI() { |
|
2163 | 428 |
List<IPath> exes = debugRunProcessWizardData.getLaunchableExes(); |
956 | 429 |
projectExecutableViewer.setInput(exes); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
430 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
431 |
// this path may either be a project-relative or remote path |
2163 | 432 |
IPath exeSelectionPath = debugRunProcessWizardData.getExeSelectionPath(); |
956 | 433 |
if (exeSelectionPath.equals(Path.EMPTY) && !exes.isEmpty()) |
434 |
exeSelectionPath = exes.get(0); |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
435 |
|
1090 | 436 |
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
|
437 |
// keep previous path if possible... |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
438 |
IPath remotePath = exeSelectionPath; |
2163 | 439 |
if (debugRunProcessWizardData.getExes().contains(remotePath)) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
440 |
// 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
|
441 |
remotePath = createSuggestedRemotePath(exeSelectionPath); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
442 |
} else { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
443 |
// 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
|
444 |
IPath projPath = getHostFileForRemoteLocation(exeSelectionPath); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
445 |
if (projPath != null) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
446 |
exeSelectionPath = projPath; |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
447 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
448 |
else { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
449 |
// 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
|
450 |
// the combo isn't empty |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
451 |
exeSelectionPath = exes.get(0); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
452 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
453 |
} |
1090 | 454 |
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
|
455 |
|
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 |
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
|
457 |
if (!remotePathEntries.contains(remotePath)) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
458 |
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
|
459 |
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
|
460 |
} |
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
|
461 |
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
|
462 |
} |
1090 | 463 |
} |
464 |
||
2163 | 465 |
if (debugRunProcessWizardData.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
|
466 |
projectExecutableViewer.getControl().forceFocus(); |
956 | 467 |
} |
468 |
||
2163 | 469 |
if (debugRunProcessWizardData.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
|
470 |
remoteProgramViewer.getControl().forceFocus(); |
956 | 471 |
} |
472 |
||
2163 | 473 |
if (debugRunProcessWizardData.getExeSelection() == EExeSelection.ATTACH_TO_PROCESS) { |
956 | 474 |
attachToProcessRadioButton.forceFocus(); |
475 |
} |
|
476 |
||
477 |
handleProjectExecutableRadioSelected(); |
|
478 |
handleRemoteExecutableRadioSelected(); |
|
479 |
handleAttachToProcessRadioSelected(); |
|
480 |
} |
|
481 |
||
482 |
||
483 |
private IPath createSuggestedRemotePath(IPath exeSelectionPath) { |
|
484 |
String filename = exeSelectionPath.lastSegment(); |
|
969 | 485 |
return PathUtils.createPath("C:/sys/bin").append(filename); //$NON-NLS-1$ |
956 | 486 |
} |
487 |
||
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
488 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
489 |
/** |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
490 |
* 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
|
491 |
* {@link #createSuggestedRemotePath(IPath)}. |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
492 |
* @param path |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
493 |
* @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
|
494 |
*/ |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
495 |
private IPath getHostFileForRemoteLocation(IPath path) { |
2163 | 496 |
for (IPath exe : debugRunProcessWizardData.getExes()) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
497 |
// 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
|
498 |
// 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
|
499 |
// IPath remoteSuggested = createSuggestedRemotePath(exe); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
500 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
501 |
// 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
|
502 |
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
|
503 |
return exe; |
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 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
506 |
return null; |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
507 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
508 |
|
956 | 509 |
/** |
510 |
* Allow selecting an executable detected to be built by the program. |
|
511 |
* @param radioGroup |
|
512 |
*/ |
|
513 |
private void createProjectExecutableRadioButton(Composite radioGroup) { |
|
514 |
projectExecutableRadioButton = new Button(radioGroup, SWT.RADIO); |
|
515 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(projectExecutableRadioButton); |
|
969 | 516 |
projectExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchProjectExeLabel")); //$NON-NLS-1$ |
517 |
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
|
518 |
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
|
519 |
|
956 | 520 |
|
521 |
projectExecutableViewer = new ComboViewer(radioGroup, SWT.READ_ONLY); |
|
522 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(projectExecutableViewer.getControl()); |
|
969 | 523 |
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
|
524 |
projectExecutableViewer.getControl().setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchProjectExecutableSelectorTooltip")); //$NON-NLS-1$ |
956 | 525 |
|
526 |
projectExecutableViewer.setContentProvider(new ArrayContentProvider()); |
|
527 |
projectExecutableViewer.setLabelProvider(new LabelProvider() { |
|
528 |
@Override |
|
529 |
public String getText(Object element) { |
|
530 |
if (element instanceof IPath) |
|
531 |
return ((IPath) element).lastSegment(); |
|
532 |
return super.getText(element); |
|
533 |
} |
|
534 |
}); |
|
535 |
||
536 |
projectExecutableRadioButton.addSelectionListener(new SelectionAdapter() { |
|
537 |
@Override |
|
538 |
public void widgetSelected(SelectionEvent e) { |
|
539 |
handleProjectExecutableRadioSelected(); |
|
540 |
} |
|
541 |
||
542 |
}); |
|
543 |
||
544 |
projectExecutableViewer.addSelectionChangedListener(new ISelectionChangedListener() { |
|
545 |
||
546 |
public void selectionChanged(SelectionChangedEvent event) { |
|
547 |
Object sel = ((IStructuredSelection) event.getSelection()).getFirstElement(); |
|
548 |
if (sel instanceof IPath) { |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
549 |
if (projectExecutableRadioButton.getSelection()) { |
2163 | 550 |
debugRunProcessWizardData.setExeSelectionPath((IPath) sel); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
551 |
} |
956 | 552 |
|
553 |
// 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
|
554 |
if (remoteProgramViewer != null && !remoteExecutableRadioButton.getSelection()) { |
2163 | 555 |
IPath exeSelectionPath = createSuggestedRemotePath(debugRunProcessWizardData.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
|
556 |
// 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
|
557 |
remoteProgramViewer.setSelection(new StructuredSelection(exeSelectionPath)); |
956 | 558 |
} |
559 |
||
560 |
validate(); |
|
561 |
} |
|
562 |
} |
|
563 |
}); |
|
564 |
} |
|
565 |
||
566 |
private void handleProjectExecutableRadioSelected() { |
|
567 |
if (projectExecutableRadioButton.getSelection()) { |
|
568 |
projectExecutableViewer.getControl().setEnabled(true); |
|
2163 | 569 |
debugRunProcessWizardData.setExeSelection(EExeSelection.USE_PROJECT_EXECUTABLE); |
956 | 570 |
IPath selectedPath = (IPath) ((IStructuredSelection) projectExecutableViewer.getSelection()).getFirstElement(); |
571 |
if (selectedPath != null) { |
|
2163 | 572 |
debugRunProcessWizardData.setExeSelectionPath(selectedPath); |
956 | 573 |
} |
574 |
validate(); |
|
575 |
} else { |
|
576 |
projectExecutableViewer.getControl().setEnabled(false); |
|
577 |
// another button becomes active and sets the new launch process |
|
578 |
} |
|
579 |
} |
|
580 |
||
581 |
/** |
|
582 |
* Allow user to enter an executable path. |
|
583 |
* @param radioGroup |
|
584 |
*/ |
|
585 |
private void createRemoteExecutableRadioButton(Composite radioGroup) { |
|
586 |
remoteExecutableRadioButton = new Button(radioGroup, SWT.RADIO); |
|
587 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(remoteExecutableRadioButton); |
|
969 | 588 |
remoteExecutableRadioButton.setText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgLabel")); //$NON-NLS-1$ |
956 | 589 |
|
969 | 590 |
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
|
591 |
remoteExecutableRadioButton.setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgramRadioTooltip")); //$NON-NLS-1$ |
956 | 592 |
|
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
|
593 |
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
|
594 |
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
|
595 |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
596 |
projectGeneratedRemotePaths = new ArrayList<IPath>(); |
2163 | 597 |
for (IPath launchable : debugRunProcessWizardData.getLaunchableExes()) { |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
598 |
projectGeneratedRemotePaths.add(createSuggestedRemotePath(launchable)); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
599 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
600 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
601 |
// 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
|
602 |
remotePathEntries.addAll(0, projectGeneratedRemotePaths); |
956 | 603 |
|
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
|
604 |
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
|
605 |
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
|
606 |
@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
|
607 |
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
|
608 |
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
|
609 |
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
|
610 |
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
|
611 |
} |
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.setInput(remotePathEntries); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
614 |
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
|
615 |
|
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
|
616 |
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
|
617 |
remoteProgramViewer.getControl().setToolTipText(Messages.getString("DebugRunProcessDialog.LaunchRemoteProgramSelectorTooltip")); //$NON-NLS-1$ |
956 | 618 |
|
619 |
remoteExecutableRadioButton.addSelectionListener(new SelectionAdapter() { |
|
620 |
@Override |
|
621 |
public void widgetSelected(SelectionEvent e) { |
|
622 |
handleRemoteExecutableRadioSelected(); |
|
623 |
} |
|
624 |
||
625 |
}); |
|
626 |
||
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
|
627 |
remoteProgramViewer.getCombo().addModifyListener(new ModifyListener() { |
956 | 628 |
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
|
629 |
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
|
630 |
if (remoteExecutableRadioButton.getSelection()) { |
2163 | 631 |
debugRunProcessWizardData.setExeSelectionPath(path); |
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
632 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
633 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
634 |
if (!projectExecutableRadioButton.getSelection()) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
635 |
IPath projPath = getHostFileForRemoteLocation(path); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
636 |
if (projPath != null) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
637 |
projectExecutableViewer.setSelection(new StructuredSelection(projPath)); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
638 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
639 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
640 |
|
956 | 641 |
validate(); |
642 |
} |
|
643 |
}); |
|
1285
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
644 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
645 |
remoteProgramViewer.getCombo().addFocusListener(new FocusAdapter() { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
646 |
/* (non-Javadoc) |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
647 |
* @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
|
648 |
*/ |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
649 |
@Override |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
650 |
public void focusLost(FocusEvent e) { |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
651 |
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
|
652 |
|
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
653 |
// MRU behavior |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
654 |
remotePathEntries.remove(path); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
655 |
remotePathEntries.add(0, path); |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
656 |
} |
84caa86f9460
Merge PNP launch wizard changes from 2.6
Ed Swartz <ed.swartz@nokia.com>
parents:
1284
diff
changeset
|
657 |
}); |
956 | 658 |
} |
659 |
||
660 |
private void handleRemoteExecutableRadioSelected() { |
|
661 |
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
|
662 |
remoteProgramViewer.getControl().setEnabled(true); |
2163 | 663 |
debugRunProcessWizardData.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
|
664 |
IPath path = PathUtils.createPath(remoteProgramViewer.getCombo().getText()); |
2163 | 665 |
debugRunProcessWizardData.setExeSelectionPath(path); |
956 | 666 |
validate(); |
667 |
} 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
|
668 |
remoteProgramViewer.getControl().setEnabled(false); |
956 | 669 |
// another button becomes active and sets the new launch process |
670 |
} |
|
671 |
} |
|
672 |
||
673 |
/** |
|
674 |
* Allow user to attach to a process. |
|
675 |
* @param radioGroup |
|
676 |
*/ |
|
677 |
private void createAttachToProcessRadioButton(Composite radioGroup) { |
|
678 |
attachToProcessRadioButton = new Button(radioGroup, SWT.RADIO); |
|
679 |
GridDataFactory.fillDefaults().grab(false, false).applyTo(attachToProcessRadioButton); |
|
969 | 680 |
attachToProcessRadioButton.setText(Messages.getString("DebugRunProcessDialog.AttachLabel")); //$NON-NLS-1$ |
956 | 681 |
|
969 | 682 |
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
|
683 |
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
|
684 |
|
956 | 685 |
Label label = new Label(radioGroup, SWT.WRAP); |
686 |
GridDataFactory.fillDefaults().grab(false, false).align(SWT.LEFT, SWT.CENTER).applyTo(label); |
|
687 |
||
969 | 688 |
label.setText(Messages.getString("DebugRunProcessDialog.AttachAddlMsg")); //$NON-NLS-1$ |
956 | 689 |
|
690 |
attachToProcessRadioButton.addSelectionListener(new SelectionAdapter() { |
|
691 |
@Override |
|
692 |
public void widgetSelected(SelectionEvent e) { |
|
693 |
handleAttachToProcessRadioSelected(); |
|
694 |
} |
|
695 |
||
696 |
}); |
|
697 |
||
698 |
} |
|
699 |
||
700 |
private void handleAttachToProcessRadioSelected() { |
|
701 |
if (attachToProcessRadioButton.getSelection()) { |
|
2163 | 702 |
debugRunProcessWizardData.setExeSelection(EExeSelection.ATTACH_TO_PROCESS); |
703 |
debugRunProcessWizardData.setExeSelectionPath(null); |
|
956 | 704 |
validate(); |
705 |
} else { |
|
706 |
// another button becomes active and sets the new launch process |
|
707 |
} |
|
708 |
} |
|
709 |
||
710 |
@Override |
|
711 |
protected void validate() { |
|
712 |
IStatus status = Status.OK_STATUS; |
|
713 |
||
714 |
// check launch method |
|
2163 | 715 |
IPath exePath = debugRunProcessWizardData.getExeSelectionPath(); |
716 |
switch (debugRunProcessWizardData.getExeSelection()) { |
|
956 | 717 |
case USE_PROJECT_EXECUTABLE: |
718 |
if (exePath.isEmpty()) { |
|
969 | 719 |
status = error(Messages.getString("DebugRunProcessDialog.NoExesError")); //$NON-NLS-1$ |
956 | 720 |
} |
721 |
break; |
|
722 |
case USE_REMOTE_EXECUTABLE: |
|
723 |
if (exePath.isEmpty()) { |
|
969 | 724 |
status = error(Messages.getString("DebugRunProcessDialog.EnterPathError")); //$NON-NLS-1$ |
956 | 725 |
} else { |
726 |
String exePathString = exePath.toString(); |
|
727 |
char drive = exePathString.charAt(0); |
|
728 |
char colon = exePathString.length() < 2 ? 0x0 : exePathString.charAt(1); |
|
729 |
char root = exePathString.length() < 3 ? 0x0 : exePathString.charAt(2); |
|
730 |
char lastChar = exePathString.charAt(exePathString.length() - 1); |
|
731 |
if (!Character.isLetter(drive) || colon != ':' || (root != '\\' && root != '/') || |
|
732 |
lastChar == '\\' || lastChar == '/' || lastChar == ':') { |
|
969 | 733 |
status = error(Messages.getString("DebugRunProcessDialog.AbsolutePathError")); //$NON-NLS-1$ |
956 | 734 |
} else if (exePath.getFileExtension() == null) { |
969 | 735 |
status = warning(Messages.getString("DebugRunProcessDialog.FilePathError")); //$NON-NLS-1$ |
956 | 736 |
} |
737 |
} |
|
738 |
break; |
|
739 |
case ATTACH_TO_PROCESS: |
|
740 |
break; |
|
741 |
} |
|
742 |
||
743 |
// check SIS selection |
|
2163 | 744 |
if (debugRunProcessWizardData.isInstallPackage()) { |
956 | 745 |
if (sisEdit != null) { |
746 |
String text = sisEdit.getText().trim(); |
|
747 |
if (text.length() > 0) { |
|
748 |
// empty is allowed, but if they specify something, make sure |
|
749 |
// it exists |
|
750 |
File file = new File(text); |
|
751 |
if (!file.exists()) { |
|
969 | 752 |
status = error(Messages.getString("DebugRunProcessDialog.SISFileExistError"), text); //$NON-NLS-1$ |
956 | 753 |
} |
754 |
} |
|
755 |
} |
|
756 |
} |
|
757 |
||
758 |
updateStatus(status); |
|
759 |
} |
|
760 |
} |
|
761 |