OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Dart project authors. | 2 * Copyright 2013 Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 | 14 |
15 package com.google.dart.tools.debug.ui.internal.dialogs; | 15 package com.google.dart.tools.debug.ui.internal.dialogs; |
16 | 16 |
17 import com.google.dart.tools.core.mobile.AndroidDebugBridge; | |
18 import com.google.dart.tools.debug.core.configs.DartServerLaunchConfigurationDel
egate; | 17 import com.google.dart.tools.debug.core.configs.DartServerLaunchConfigurationDel
egate; |
19 import com.google.dart.tools.debug.core.configs.DartiumLaunchConfigurationDelega
te; | 18 import com.google.dart.tools.debug.core.configs.DartiumLaunchConfigurationDelega
te; |
20 import com.google.dart.tools.debug.core.util.IRemoteConnectionDelegate; | 19 import com.google.dart.tools.debug.core.util.IRemoteConnectionDelegate; |
21 import com.google.dart.tools.debug.core.webkit.ChromiumTabInfo; | 20 import com.google.dart.tools.debug.core.webkit.ChromiumTabInfo; |
22 import com.google.dart.tools.debug.core.webkit.DefaultChromiumTabChooser; | 21 import com.google.dart.tools.debug.core.webkit.DefaultChromiumTabChooser; |
23 import com.google.dart.tools.debug.core.webkit.IChromiumTabChooser; | 22 import com.google.dart.tools.debug.core.webkit.IChromiumTabChooser; |
24 import com.google.dart.tools.debug.ui.internal.DartDebugUIPlugin; | 23 import com.google.dart.tools.debug.ui.internal.DartDebugUIPlugin; |
25 import com.google.dart.tools.debug.ui.internal.view.DebuggerView; | 24 import com.google.dart.tools.debug.ui.internal.view.DebuggerView; |
26 import com.google.dart.tools.ui.DartToolsPlugin; | 25 import com.google.dart.tools.ui.DartToolsPlugin; |
27 | 26 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 129 |
131 this.connectionDelegate = connectionDelegate; | 130 this.connectionDelegate = connectionDelegate; |
132 this.host = host; | 131 this.host = host; |
133 this.port = port; | 132 this.port = port; |
134 this.usePubServe = usePubServe; | 133 this.usePubServe = usePubServe; |
135 } | 134 } |
136 | 135 |
137 @Override | 136 @Override |
138 protected IStatus run(IProgressMonitor monitor) { | 137 protected IStatus run(IProgressMonitor monitor) { |
139 try { | 138 try { |
140 // TODO(keertip): add forwarding for chrome | 139 |
141 AndroidDebugBridge.getAndroidDebugBridge().setupPortForwarding(Integer.t
oString(port)); | |
142 connectionDelegate.performRemoteConnection(host, port, monitor, usePubSe
rve); | 140 connectionDelegate.performRemoteConnection(host, port, monitor, usePubSe
rve); |
143 | 141 |
144 // Show the debugger view. | 142 // Show the debugger view. |
145 Display.getDefault().asyncExec(new Runnable() { | 143 Display.getDefault().asyncExec(new Runnable() { |
146 @Override | 144 @Override |
147 public void run() { | 145 public void run() { |
148 DartToolsPlugin.showView(DebuggerView.ID); | 146 DartToolsPlugin.showView(DebuggerView.ID); |
149 } | 147 } |
150 }); | 148 }); |
151 } catch (CoreException ce) { | 149 } catch (CoreException ce) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 private Combo exceptionsCombo; | 252 private Combo exceptionsCombo; |
255 | 253 |
256 private Text hostText; | 254 private Text hostText; |
257 | 255 |
258 private Text portText; | 256 private Text portText; |
259 | 257 |
260 private Text instructionsLabel; | 258 private Text instructionsLabel; |
261 | 259 |
262 private Button usePubServeButton; | 260 private Button usePubServeButton; |
263 | 261 |
| 262 private Group pubGroup; |
| 263 |
264 /** | 264 /** |
265 * Create a new RemoteConnectionDialog with the given shell as its parent. | 265 * Create a new RemoteConnectionDialog with the given shell as its parent. |
266 * | 266 * |
267 * @param shell | 267 * @param shell |
268 */ | 268 */ |
269 public RemoteConnectionDialog(Shell shell) { | 269 public RemoteConnectionDialog(Shell shell) { |
270 super(shell); | 270 super(shell); |
271 } | 271 } |
272 | 272 |
273 @Override | 273 @Override |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 hostText = new Text(group, SWT.SINGLE | SWT.BORDER); | 353 hostText = new Text(group, SWT.SINGLE | SWT.BORDER); |
354 GridDataFactory.fillDefaults().grab(true, false).applyTo(hostText); | 354 GridDataFactory.fillDefaults().grab(true, false).applyTo(hostText); |
355 | 355 |
356 label = new Label(group, SWT.NONE); | 356 label = new Label(group, SWT.NONE); |
357 label.setText("Port:"); | 357 label.setText("Port:"); |
358 | 358 |
359 portText = new Text(group, SWT.SINGLE | SWT.BORDER); | 359 portText = new Text(group, SWT.SINGLE | SWT.BORDER); |
360 GridDataFactory.fillDefaults().grab(true, false).applyTo(portText); | 360 GridDataFactory.fillDefaults().grab(true, false).applyTo(portText); |
361 | 361 |
362 label = new Label(parent, SWT.NONE); | 362 label = new Label(parent, SWT.NONE); |
363 // pub setttings | |
364 group = new Group(parent, SWT.NONE); | |
365 group.setText("Pub settings"); | |
366 GridDataFactory.fillDefaults().grab(true, false).applyTo(group); | |
367 GridLayoutFactory.fillDefaults().margins(12, 6).applyTo(group); | |
368 | |
369 usePubServeButton = new Button(group, SWT.CHECK); | |
370 usePubServeButton.setText("Using pub to serve the application"); | |
371 usePubServeButton.setSelection(true); | |
372 GridDataFactory.fillDefaults().grab(true, false).applyTo(usePubServeButton); | |
373 | |
374 // spacer | |
375 label = new Label(parent, SWT.NONE); | |
376 | 363 |
377 instructionsLabel = new Text(parent, SWT.WRAP | SWT.READ_ONLY); | 364 instructionsLabel = new Text(parent, SWT.WRAP | SWT.READ_ONLY); |
378 instructionsLabel.setBackground(parent.getBackground()); | 365 instructionsLabel.setBackground(parent.getBackground()); |
379 GridDataFactory.fillDefaults().grab(true, false).hint(100, -1).applyTo(instr
uctionsLabel); | 366 GridDataFactory.fillDefaults().grab(true, false).hint(100, -1).applyTo(instr
uctionsLabel); |
380 | 367 |
| 368 // spacer |
| 369 label = new Label(parent, SWT.NONE); |
| 370 |
| 371 label = new Label(parent, SWT.NONE); |
| 372 label = new Label(parent, SWT.NONE); |
| 373 |
| 374 pubGroup = new Group(parent, SWT.NONE); |
| 375 pubGroup.setText("Pub settings"); |
| 376 GridDataFactory.fillDefaults().grab(true, false).applyTo(pubGroup); |
| 377 GridLayoutFactory.fillDefaults().margins(12, 6).applyTo(pubGroup); |
| 378 |
| 379 usePubServeButton = new Button(pubGroup, SWT.CHECK); |
| 380 usePubServeButton.setText("Using pub to serve the application"); |
| 381 usePubServeButton.setSelection(true); |
| 382 GridDataFactory.fillDefaults().grab(true, false).applyTo(usePubServeButton); |
| 383 |
381 try { | 384 try { |
382 exceptionsCombo.select(getDialogSettings().getInt("selected")); | 385 exceptionsCombo.select(getDialogSettings().getInt("selected")); |
383 } catch (NumberFormatException nfe) { | 386 } catch (NumberFormatException nfe) { |
384 exceptionsCombo.select(0); | 387 exceptionsCombo.select(0); |
385 } | 388 } |
386 | 389 |
387 handleComboChanged(); | 390 handleComboChanged(); |
388 } | 391 } |
389 | 392 |
390 private String[] getConnectionLabels() { | 393 private String[] getConnectionLabels() { |
(...skipping 29 matching lines...) Expand all Loading... |
420 | 423 |
421 private void handleComboChanged() { | 424 private void handleComboChanged() { |
422 ConnectionType connection = getConnectionType(); | 425 ConnectionType connection = getConnectionType(); |
423 | 426 |
424 setMessage(connection.message); | 427 setMessage(connection.message); |
425 instructionsLabel.setText(connection.helpMessage); | 428 instructionsLabel.setText(connection.helpMessage); |
426 | 429 |
427 IDialogSettings settings = getDialogSettings(); | 430 IDialogSettings settings = getDialogSettings(); |
428 hostText.setText(notNull(settings.get(connection.name() + ".host"))); | 431 hostText.setText(notNull(settings.get(connection.name() + ".host"))); |
429 portText.setText(notNull(settings.get(connection.name() + ".port"))); | 432 portText.setText(notNull(settings.get(connection.name() + ".port"))); |
| 433 |
| 434 pubGroup.setVisible(connection == ConnectionType.CHROME); |
430 } | 435 } |
431 | 436 |
432 private String notNull(String str) { | 437 private String notNull(String str) { |
433 return str == null ? "" : str; | 438 return str == null ? "" : str; |
434 } | 439 } |
435 | 440 |
436 } | 441 } |
OLD | NEW |