Search in sources :

Example 1 with IOConsoleInputStream

use of org.eclipse.ui.console.IOConsoleInputStream in project abstools by abstools.

the class ConsoleManager method newConsole.

/**
 * Create a new Console with the specified title and adds it to the console view
 * @param title The desired title of the console
 * @return The new Message Console
 */
public static MsgConsole newConsole(String title) {
    MsgConsole mc = new MsgConsole(title, null);
    addConsole((IConsole) mc);
    System.setOut(new PrintStream(mc.getOutputStream(MessageType.MESSAGE_INFO)));
    // try {
    IOConsoleInputStream str = mc.getInputStream();
    // str.reset();
    System.setIn(str);
    // defaultConsole = mc;
    return mc;
}
Also used : PrintStream(java.io.PrintStream) IOConsoleInputStream(org.eclipse.ui.console.IOConsoleInputStream)

Example 2 with IOConsoleInputStream

use of org.eclipse.ui.console.IOConsoleInputStream in project sts4 by spring-projects.

the class ConsoleUtil method getConsole.

public Console getConsole(String title) {
    final IOConsole console = new IOConsole(title, null);
    final IOConsoleInputStream in = console.getInputStream();
    final IOConsoleOutputStream out = console.newOutputStream();
    final IOConsoleOutputStream err = console.newOutputStream();
    in.setColor(getInputColor());
    out.setColor(getOutputColor());
    err.setColor(getErrorColor());
    add(console);
    return new Console(in, out, err);
}
Also used : IOConsoleOutputStream(org.eclipse.ui.console.IOConsoleOutputStream) IOConsoleInputStream(org.eclipse.ui.console.IOConsoleInputStream) IOConsole(org.eclipse.ui.console.IOConsole) IConsole(org.eclipse.ui.console.IConsole) IOConsole(org.eclipse.ui.console.IOConsole)

Example 3 with IOConsoleInputStream

use of org.eclipse.ui.console.IOConsoleInputStream in project core by jcryptool.

the class IOConsoleShell method readUserInput.

private void readUserInput() {
    IOConsoleInputStream in = stream;
    IOConsoleInputStreamWrapper wrapperStream = new IOConsoleInputStreamWrapper(in);
    BufferedReader bufReader = null;
    try {
        bufReader = new BufferedReader(new InputStreamReader(wrapperStream, IConstants.UTF8_ENCODING));
    } catch (UnsupportedEncodingException ex) {
        LogUtil.logError(CommandsUIPlugin.PLUGIN_ID, ex);
    }
    int charOut = 0;
    // $NON-NLS-1$
    String output = "";
    try {
        while ((charOut = bufReader.read()) != -1) {
            output = output.concat(String.valueOf(Character.valueOf((char) charOut)));
        }
    } catch (IOException e) {
        // $NON-NLS-1$
        if (!e.getMessage().equals("Input Stream Closed"))
            LogUtil.logError(CommandsUIPlugin.PLUGIN_ID, e);
    }
    String line = processRawInputString(output);
    addLine(line);
}
Also used : InputStreamReader(java.io.InputStreamReader) IOConsoleInputStream(org.eclipse.ui.console.IOConsoleInputStream) BufferedReader(java.io.BufferedReader) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException)

Aggregations

IOConsoleInputStream (org.eclipse.ui.console.IOConsoleInputStream)3 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 PrintStream (java.io.PrintStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 IConsole (org.eclipse.ui.console.IConsole)1 IOConsole (org.eclipse.ui.console.IOConsole)1 IOConsoleOutputStream (org.eclipse.ui.console.IOConsoleOutputStream)1