1 11 package org.eclipse.debug.ui.console; 12 13 14 import org.eclipse.debug.core.model.IProcess; 15 import org.eclipse.debug.core.model.IStreamsProxy; 16 import org.eclipse.debug.internal.ui.DebugUIPlugin; 17 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; 18 import org.eclipse.debug.ui.IDebugUIConstants; 19 import org.eclipse.swt.graphics.Color; 20 21 29 public class ConsoleColorProvider implements IConsoleColorProvider { 30 31 private IProcess fProcess; 32 private IConsole fConsole; 33 34 37 public void connect(IProcess process, IConsole console) { 38 fProcess = process; 39 fConsole = console; 40 IStreamsProxy streamsProxy = fProcess.getStreamsProxy(); 41 if (streamsProxy != null) { 42 fConsole.connect(streamsProxy); 43 } 44 } 45 46 49 public void disconnect() { 50 fConsole = null; 51 fProcess = null; 52 } 53 54 57 public boolean isReadOnly() { 58 return fProcess == null || fProcess.isTerminated(); 59 } 60 61 64 public Color getColor(String streamIdentifer) { 65 if (IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM.equals(streamIdentifer)) { 66 return DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR); 67 } 68 if (IDebugUIConstants.ID_STANDARD_ERROR_STREAM.equals(streamIdentifer)) { 69 return DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR); 70 } 71 if (IDebugUIConstants.ID_STANDARD_INPUT_STREAM.equals(streamIdentifer)) { 72 return DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR); 73 } 74 return null; 75 } 76 77 84 protected IProcess getProcess() { 85 return fProcess; 86 } 87 88 95 protected IConsole getConsole() { 96 return fConsole; 97 } 98 } 99 | Popular Tags |