OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the 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.ui.console; | 15 package com.google.dart.tools.ui.console; |
16 | 16 |
17 import com.google.dart.tools.debug.ui.launch.OpenObservatoryAction; | 17 import com.google.dart.tools.debug.ui.launch.OpenObservatoryAction; |
18 import com.google.dart.tools.debug.ui.launch.StopPubServeAction; | 18 import com.google.dart.tools.debug.ui.launch.StopPubServeAction; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 IProcess process = getProcess(); | 191 IProcess process = getProcess(); |
192 | 192 |
193 if (process != null) { | 193 if (process != null) { |
194 setEnabled(!process.isTerminated()); | 194 setEnabled(!process.isTerminated()); |
195 } else { | 195 } else { |
196 setEnabled(false); | 196 setEnabled(false); |
197 } | 197 } |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 private static final String NEW_LINE = System.getProperty("line.separator"); | |
202 | |
203 public static final String VIEW_ID = "com.google.dart.tools.ui.console"; | 201 public static final String VIEW_ID = "com.google.dart.tools.ui.console"; |
204 | 202 |
205 private Composite parent; | 203 private Composite parent; |
206 private IConsole console; | 204 private IConsole console; |
207 private Object consoleLock = new Object(); | 205 private Object consoleLock = new Object(); |
208 | 206 |
209 private IPageBookViewPage page; | 207 private IPageBookViewPage page; |
210 | 208 |
211 private PageSite pageSite; | 209 private PageSite pageSite; |
212 | 210 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 updateContentDescription(); | 310 updateContentDescription(); |
313 | 311 |
314 updateIcon(); | 312 updateIcon(); |
315 | 313 |
316 terminateAction.update(); | 314 terminateAction.update(); |
317 propertiesAction.setEnabled(getProcess() != null); | 315 propertiesAction.setEnabled(getProcess() != null); |
318 | 316 |
319 // Show cmdline used to launch process | 317 // Show cmdline used to launch process |
320 if (console instanceof ProcessConsole) { | 318 if (console instanceof ProcessConsole) { |
321 IProcess process = ((ProcessConsole) console).getProcess(); | 319 IProcess process = ((ProcessConsole) console).getProcess(); |
322 String cmdline = process.getAttribute(IProcess.ATTR_CMDLINE); | |
323 if (cmdline != null) { | |
324 StyledText control = (StyledText) page.getControl(); | |
325 if (control != null && !control.isDisposed()) { | |
326 control.append(cmdline); | |
327 control.append(NEW_LINE); | |
328 } | |
329 } | |
330 | |
331 openObservatoryAction.updateEnablement(process.getLaunch()); | 320 openObservatoryAction.updateEnablement(process.getLaunch()); |
332 | |
333 } | 321 } |
334 } | 322 } |
335 | 323 |
336 @Override | 324 @Override |
337 public void dispose() { | 325 public void dispose() { |
338 JFaceResources.getFontRegistry().removeListener(fontPropertyChangeListener); | 326 JFaceResources.getFontRegistry().removeListener(fontPropertyChangeListener); |
339 | 327 |
340 display = null; | 328 display = null; |
341 | 329 |
342 DartConsoleManager.getManager().consoleViewClosed(this); | 330 DartConsoleManager.getManager().consoleViewClosed(this); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } else { | 485 } else { |
498 return null; | 486 return null; |
499 } | 487 } |
500 } | 488 } |
501 } | 489 } |
502 | 490 |
503 private void updateContentDescription() { | 491 private void updateContentDescription() { |
504 if (console instanceof ProcessConsole) { | 492 if (console instanceof ProcessConsole) { |
505 IProcess process = ((ProcessConsole) console).getProcess(); | 493 IProcess process = ((ProcessConsole) console).getProcess(); |
506 | 494 |
507 String name = ""; | |
508 String configName = process.getLaunch().getLaunchConfiguration().getName()
; | 495 String configName = process.getLaunch().getLaunchConfiguration().getName()
; |
| 496 String name = "<" + configName + "> "; |
509 | 497 |
510 if (process.isTerminated()) { | 498 if (process.isTerminated()) { |
511 try { | 499 try { |
512 name = "<" + configName + "> exit code=" + process.getExitValue(); | 500 name = name + " exit code = " + process.getExitValue(); |
513 } catch (DebugException ex) { | 501 } catch (DebugException ex) { |
514 // ignore | 502 // ignore |
515 } | 503 } |
516 | |
517 bringToFront(); | 504 bringToFront(); |
518 } | 505 } |
519 | 506 |
520 setContentDescription(name); | 507 setContentDescription(name); |
| 508 setPartName(configName); |
521 } else { | 509 } else { |
522 setContentDescription(""); | 510 setContentDescription(""); |
523 } | |
524 | |
525 if (console instanceof ProcessConsole) { | |
526 IProcess process = ((ProcessConsole) console).getProcess(); | |
527 | |
528 setPartName(process.getLaunch().getLaunchConfiguration().getName()); | |
529 } else { | |
530 setPartName("Tools Output"); | 511 setPartName("Tools Output"); |
531 } | 512 } |
532 } | 513 } |
533 | 514 |
534 private void updateFont() { | 515 private void updateFont() { |
535 Display.getDefault().asyncExec(new Runnable() { | 516 Display.getDefault().asyncExec(new Runnable() { |
536 @Override | 517 @Override |
537 public void run() { | 518 public void run() { |
538 Font newFont = JFaceResources.getFont(FontPreferencePage.VIEW_BASE_FONT_
KEY); | 519 Font newFont = JFaceResources.getFont(FontPreferencePage.VIEW_BASE_FONT_
KEY); |
539 if (page != null && page.getControl() != null) { | 520 if (page != null && page.getControl() != null) { |
(...skipping 28 matching lines...) Expand all Loading... |
568 } else { | 549 } else { |
569 toolbar.add(openObservatoryAction); | 550 toolbar.add(openObservatoryAction); |
570 } | 551 } |
571 | 552 |
572 toolbar.add(terminateAction); | 553 toolbar.add(terminateAction); |
573 toolbar.add(new Separator("outputGroup")); | 554 toolbar.add(new Separator("outputGroup")); |
574 getViewSite().getActionBars().updateActionBars(); | 555 getViewSite().getActionBars().updateActionBars(); |
575 } | 556 } |
576 | 557 |
577 } | 558 } |
OLD | NEW |