📄 moduledebugconsoleimpl.java
字号:
/****************************************************************************** * * Copyright (c) 1999-2003 AppGate Network Security AB. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code as * defined in and that are subject to the MindTerm Public Source License, * Version 2.0, (the 'License'). You may not use this file except in compliance * with the License. * * You should have received a copy of the MindTerm Public Source License * along with this software; see the file LICENSE. If not, write to * AppGate Network Security AB, Otterhallegatan 2, SE-41118 Goteborg, SWEDEN * *****************************************************************************/package com.mindbright.application;import java.io.OutputStream;import java.io.PrintStream;import java.io.IOException;import java.awt.Frame;import com.mindbright.terminal.Terminal;import com.mindbright.terminal.TerminalWin;import com.mindbright.terminal.TerminalFrameTitle;public class ModuleDebugConsoleImpl extends ModuleBaseTerminal { private TerminalWin terminal; private PrintStream outOrig; private PrintStream errOrig; private volatile boolean isRunning; final class DebugOutStream extends OutputStream { public void write(int b) throws IOException { terminal.write((char)b); } public void write(byte b[], int off, int len) throws IOException { terminal.write(b, off, len); } } protected void runTerminal(MindTermApp mindterm, TerminalWin terminal, Frame frame, TerminalFrameTitle frameTitle) { isRunning = true; this.terminal = terminal; outOrig = System.out; errOrig = System.err; terminal.setOption(Terminal.OPT_AUTO_LF, true); PrintStream debugOut = new PrintStream(new DebugOutStream()); try { System.setOut(debugOut); System.setErr(debugOut); } catch (Throwable t) { terminal.write("\n\rError, couldn't redirect STDIO: " + t.getMessage()); } synchronized(this) { try { this.wait(); } catch (InterruptedException e) { } } } protected boolean closeOnDisconnect() { return false; } protected String getTitle() { return mindterm.getAppName() + " - " + "Debug Console"; } protected void doClose() { System.setOut(outOrig); System.setErr(outOrig); this.terminal = null; synchronized(this) { this.notifyAll(); } } public boolean isAvailable(MindTermApp mindterm) { return true; } protected ModuleBaseTerminal newInstance() { return this; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -