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