mirror of
https://github.com/peterdell/wudsn-ide.git
synced 2024-06-03 06:29:35 +00:00
103 lines
2.9 KiB
Java
103 lines
2.9 KiB
Java
/**
|
|
* Copyright (C) 2009 - 2019 <a href="https://www.wudsn.com" target="_top">Peter Dell</a>
|
|
*
|
|
* This file is part of WUDSN IDE.
|
|
*
|
|
* WUDSN IDE is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* WUDSN IDE is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with WUDSN IDE. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package com.wudsn.ide.asm.compiler;
|
|
|
|
import java.io.PrintStream;
|
|
|
|
import org.eclipse.ui.console.ConsolePlugin;
|
|
import org.eclipse.ui.console.IConsole;
|
|
import org.eclipse.ui.console.IConsoleManager;
|
|
import org.eclipse.ui.console.IConsoleView;
|
|
import org.eclipse.ui.console.MessageConsole;
|
|
import org.eclipse.ui.console.MessageConsoleStream;
|
|
|
|
import com.wudsn.ide.asm.Texts;
|
|
|
|
/**
|
|
* The console to show the user the output from the compiler.
|
|
*
|
|
* @author Peter Dell
|
|
* @author Daniel Mitte
|
|
*/
|
|
public final class CompilerConsole {
|
|
|
|
private IConsoleManager consoleManager;
|
|
public MessageConsole console;
|
|
|
|
private MessageConsoleStream messageStream;
|
|
private PrintStream printStream;
|
|
|
|
/**
|
|
* Create a new console-window.
|
|
*
|
|
*/
|
|
public CompilerConsole() {
|
|
consoleManager = ConsolePlugin.getDefault().getConsoleManager();
|
|
console = new MessageConsole(Texts.COMPILER_CONSOLE_TITLE, null);
|
|
consoleManager.addConsoles(new IConsole[] { console });
|
|
|
|
messageStream = console.newMessageStream();
|
|
messageStream.setActivateOnWrite(false);
|
|
messageStream.print("");
|
|
printStream = new PrintStream(messageStream);
|
|
}
|
|
|
|
/**
|
|
* Brings this console view instance to front in the console view editor
|
|
* part.
|
|
*
|
|
* @param consoleView
|
|
* The console view editor part, not <code>null</code>.
|
|
*/
|
|
|
|
public void display(IConsoleView consoleView) {
|
|
if (consoleView == null) {
|
|
throw new IllegalArgumentException(
|
|
"Parameter 'consoleView' must not be null.");
|
|
}
|
|
consoleView.display(console);
|
|
|
|
}
|
|
|
|
/**
|
|
* Add a line to console.
|
|
*
|
|
* @param message
|
|
* The message to print, not <code>null</code>.
|
|
*/
|
|
public void println(String message) {
|
|
if (message == null) {
|
|
throw new IllegalArgumentException(
|
|
"Parameter 'message' must not be null.");
|
|
}
|
|
messageStream.println(message);
|
|
}
|
|
|
|
/**
|
|
* Gets a print messageStream to write to this console.
|
|
*
|
|
* @return The print messageStream, not <code>null</code>.
|
|
*/
|
|
public PrintStream getPrintStream() {
|
|
return printStream;
|
|
}
|
|
|
|
}
|