| 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.core.DartDebugCorePlugin; |
| 18 import com.google.dart.tools.debug.core.DartLaunchConfigWrapper; |
| 17 import com.google.dart.tools.debug.ui.launch.OpenObservatoryAction; | 19 import com.google.dart.tools.debug.ui.launch.OpenObservatoryAction; |
| 18 import com.google.dart.tools.debug.ui.launch.StopPubServeAction; | 20 import com.google.dart.tools.debug.ui.launch.StopPubServeAction; |
| 19 import com.google.dart.tools.deploy.Activator; | 21 import com.google.dart.tools.deploy.Activator; |
| 20 import com.google.dart.tools.ui.DartToolsPlugin; | 22 import com.google.dart.tools.ui.DartToolsPlugin; |
| 21 import com.google.dart.tools.ui.actions.InstrumentedAction; | 23 import com.google.dart.tools.ui.actions.InstrumentedAction; |
| 22 import com.google.dart.tools.ui.instrumentation.UIInstrumentationBuilder; | 24 import com.google.dart.tools.ui.instrumentation.UIInstrumentationBuilder; |
| 23 import com.google.dart.tools.ui.internal.preferences.FontPreferencePage; | 25 import com.google.dart.tools.ui.internal.preferences.FontPreferencePage; |
| 24 import com.google.dart.tools.ui.internal.util.SWTUtil; | 26 import com.google.dart.tools.ui.internal.util.SWTUtil; |
| 25 | 27 |
| 28 import org.eclipse.core.runtime.CoreException; |
| 26 import org.eclipse.debug.core.DebugException; | 29 import org.eclipse.debug.core.DebugException; |
| 27 import org.eclipse.debug.core.DebugPlugin; | 30 import org.eclipse.debug.core.DebugPlugin; |
| 28 import org.eclipse.debug.core.ILaunch; | 31 import org.eclipse.debug.core.ILaunch; |
| 32 import org.eclipse.debug.core.ILaunchConfiguration; |
| 29 import org.eclipse.debug.core.ILaunchesListener2; | 33 import org.eclipse.debug.core.ILaunchesListener2; |
| 30 import org.eclipse.debug.core.model.IProcess; | 34 import org.eclipse.debug.core.model.IProcess; |
| 31 import org.eclipse.debug.internal.ui.views.console.ProcessConsole; | 35 import org.eclipse.debug.internal.ui.views.console.ProcessConsole; |
| 36 import org.eclipse.debug.ui.IDebugUIConstants; |
| 32 import org.eclipse.jface.action.Action; | 37 import org.eclipse.jface.action.Action; |
| 33 import org.eclipse.jface.action.IAction; | 38 import org.eclipse.jface.action.IAction; |
| 34 import org.eclipse.jface.action.IToolBarManager; | 39 import org.eclipse.jface.action.IToolBarManager; |
| 35 import org.eclipse.jface.action.Separator; | 40 import org.eclipse.jface.action.Separator; |
| 36 import org.eclipse.jface.preference.IPreferenceStore; | 41 import org.eclipse.jface.preference.IPreferenceStore; |
| 37 import org.eclipse.jface.preference.PreferenceDialog; | 42 import org.eclipse.jface.preference.PreferenceDialog; |
| 38 import org.eclipse.jface.resource.JFaceResources; | 43 import org.eclipse.jface.resource.JFaceResources; |
| 39 import org.eclipse.jface.util.IPropertyChangeListener; | 44 import org.eclipse.jface.util.IPropertyChangeListener; |
| 40 import org.eclipse.jface.util.PropertyChangeEvent; | 45 import org.eclipse.jface.util.PropertyChangeEvent; |
| 41 import org.eclipse.swt.custom.StyledText; | 46 import org.eclipse.swt.custom.StyledText; |
| 42 import org.eclipse.swt.graphics.Font; | 47 import org.eclipse.swt.graphics.Font; |
| 43 import org.eclipse.swt.widgets.Composite; | 48 import org.eclipse.swt.widgets.Composite; |
| 44 import org.eclipse.swt.widgets.Display; | 49 import org.eclipse.swt.widgets.Display; |
| 45 import org.eclipse.swt.widgets.Event; | 50 import org.eclipse.swt.widgets.Event; |
| 46 import org.eclipse.ui.PartInitException; | 51 import org.eclipse.ui.PartInitException; |
| 47 import org.eclipse.ui.console.IConsole; | 52 import org.eclipse.ui.console.IConsole; |
| 48 import org.eclipse.ui.console.IConsoleView; | 53 import org.eclipse.ui.console.IConsoleView; |
| 49 import org.eclipse.ui.console.IOConsole; | 54 import org.eclipse.ui.console.IOConsole; |
| 55 import org.eclipse.ui.console.IOConsoleOutputStream; |
| 50 import org.eclipse.ui.console.MessageConsole; | 56 import org.eclipse.ui.console.MessageConsole; |
| 51 import org.eclipse.ui.console.TextConsole; | 57 import org.eclipse.ui.console.TextConsole; |
| 52 import org.eclipse.ui.dialogs.PreferencesUtil; | 58 import org.eclipse.ui.dialogs.PreferencesUtil; |
| 53 import org.eclipse.ui.internal.console.IOConsolePage; | 59 import org.eclipse.ui.internal.console.IOConsolePage; |
| 54 import org.eclipse.ui.part.IPageBookViewPage; | 60 import org.eclipse.ui.part.IPageBookViewPage; |
| 55 import org.eclipse.ui.part.PageSite; | 61 import org.eclipse.ui.part.PageSite; |
| 56 import org.eclipse.ui.part.ViewPart; | 62 import org.eclipse.ui.part.ViewPart; |
| 57 import org.eclipse.ui.progress.IWorkbenchSiteProgressService; | 63 import org.eclipse.ui.progress.IWorkbenchSiteProgressService; |
| 58 | 64 |
| 65 import java.io.IOException; |
| 66 |
| 59 /** | 67 /** |
| 60 * An Eclipse view class that displays one and only one IConsole. This is differ
ent from the normal | 68 * An Eclipse view class that displays one and only one IConsole. This is differ
ent from the normal |
| 61 * ConsoleView which displays n consoles. | 69 * ConsoleView which displays n consoles. |
| 62 */ | 70 */ |
| 63 @SuppressWarnings("restriction") | 71 @SuppressWarnings("restriction") |
| 64 public class DartConsoleView extends ViewPart implements IConsoleView, IProperty
ChangeListener { | 72 public class DartConsoleView extends ViewPart implements IConsoleView, IProperty
ChangeListener { |
| 65 | 73 |
| 66 private class ClearAction extends InstrumentedAction { | 74 private class ClearAction extends InstrumentedAction { |
| 67 public ClearAction() { | 75 public ClearAction() { |
| 68 super("Clear", Activator.getImageDescriptor("icons/full/eview16/rem_co.gif
")); | 76 super("Clear", Activator.getImageDescriptor("icons/full/eview16/rem_co.gif
")); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 319 |
| 312 updateIcon(); | 320 updateIcon(); |
| 313 | 321 |
| 314 terminateAction.update(); | 322 terminateAction.update(); |
| 315 propertiesAction.setEnabled(getProcess() != null); | 323 propertiesAction.setEnabled(getProcess() != null); |
| 316 | 324 |
| 317 // Show cmdline used to launch process | 325 // Show cmdline used to launch process |
| 318 if (console instanceof ProcessConsole) { | 326 if (console instanceof ProcessConsole) { |
| 319 IProcess process = ((ProcessConsole) console).getProcess(); | 327 IProcess process = ((ProcessConsole) console).getProcess(); |
| 320 openObservatoryAction.updateEnablement(process.getLaunch()); | 328 openObservatoryAction.updateEnablement(process.getLaunch()); |
| 329 showPauseOnStartMessage(process.getLaunch().getLaunchConfiguration()); |
| 321 } | 330 } |
| 322 } | 331 } |
| 323 | 332 |
| 324 @Override | 333 @Override |
| 325 public void dispose() { | 334 public void dispose() { |
| 326 JFaceResources.getFontRegistry().removeListener(fontPropertyChangeListener); | 335 JFaceResources.getFontRegistry().removeListener(fontPropertyChangeListener); |
| 327 | 336 |
| 328 display = null; | 337 display = null; |
| 329 | 338 |
| 330 DartConsoleManager.getManager().consoleViewClosed(this); | 339 DartConsoleManager.getManager().consoleViewClosed(this); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 private IProcess getProcess() { | 490 private IProcess getProcess() { |
| 482 synchronized (consoleLock) { | 491 synchronized (consoleLock) { |
| 483 if (console instanceof ProcessConsole) { | 492 if (console instanceof ProcessConsole) { |
| 484 return ((ProcessConsole) console).getProcess(); | 493 return ((ProcessConsole) console).getProcess(); |
| 485 } else { | 494 } else { |
| 486 return null; | 495 return null; |
| 487 } | 496 } |
| 488 } | 497 } |
| 489 } | 498 } |
| 490 | 499 |
| 500 private void showPauseOnStartMessage(ILaunchConfiguration config) { |
| 501 try { |
| 502 if (config.getType().getIdentifier().equals(DartDebugCorePlugin.SERVER_LAU
NCH_CONFIG_ID)) { |
| 503 DartLaunchConfigWrapper wrapper = new DartLaunchConfigWrapper(config); |
| 504 if (wrapper.getPauseIsolateOnStart()) { |
| 505 IOConsoleOutputStream stream = ((ProcessConsole) getConsole()).getStre
am(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM); |
| 506 try { |
| 507 stream.write("Isolate paused on start. Click on the \"Open Observat
ory\" button " |
| 508 + "in the Toolbar \nto open Observatory and continue isolate exe
cution.\n\n"); |
| 509 } catch (IOException e) { |
| 510 // do nothing |
| 511 } |
| 512 } |
| 513 } |
| 514 } catch (CoreException e) { |
| 515 // do nothing |
| 516 } |
| 517 } |
| 518 |
| 491 private void updateContentDescription() { | 519 private void updateContentDescription() { |
| 492 if (console instanceof ProcessConsole) { | 520 if (console instanceof ProcessConsole) { |
| 493 IProcess process = ((ProcessConsole) console).getProcess(); | 521 IProcess process = ((ProcessConsole) console).getProcess(); |
| 494 | 522 |
| 495 String configName = process.getLaunch().getLaunchConfiguration().getName()
; | 523 String configName = process.getLaunch().getLaunchConfiguration().getName()
; |
| 496 String name = "<" + configName + "> "; | 524 String name = "<" + configName + "> "; |
| 497 | 525 |
| 498 if (process.isTerminated()) { | 526 if (process.isTerminated()) { |
| 499 try { | 527 try { |
| 500 name = name + " exit code = " + process.getExitValue(); | 528 name = name + " exit code = " + process.getExitValue(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 } else { | 577 } else { |
| 550 toolbar.add(openObservatoryAction); | 578 toolbar.add(openObservatoryAction); |
| 551 } | 579 } |
| 552 | 580 |
| 553 toolbar.add(terminateAction); | 581 toolbar.add(terminateAction); |
| 554 toolbar.add(new Separator("outputGroup")); | 582 toolbar.add(new Separator("outputGroup")); |
| 555 getViewSite().getActionBars().updateActionBars(); | 583 getViewSite().getActionBars().updateActionBars(); |
| 556 } | 584 } |
| 557 | 585 |
| 558 } | 586 } |
| OLD | NEW |