1 package net.sourceforge.phpeclipse.externaltools;
3 import java.io.IOException;
4 import java.io.InputStream;
6 //import org.eclipse.swt.graphics.Color;
7 import org.eclipse.ui.console.ConsolePlugin;
8 import org.eclipse.ui.console.IConsole;
9 import org.eclipse.ui.console.MessageConsole;
10 import org.eclipse.ui.console.MessageConsoleStream;
12 public class PHPConsole {
13 private MessageConsole myConsole;
15 private MessageConsoleStream stream;
17 //private boolean hasMessages;
20 //hasMessages = false;
21 myConsole = new MessageConsole("PHPeclipse Console", null);
22 ConsolePlugin.getDefault().getConsoleManager().addConsoles(
23 new IConsole[] { myConsole });
24 ConsolePlugin.getDefault().getConsoleManager().showConsoleView(
26 // layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM,
27 // .5f,IPageLayout.ID_EDITOR_AREA);
28 stream = myConsole.newMessageStream();
34 // public Color getColor() {
35 // return stream.getColor();
41 public MessageConsole getConsole() {
42 return stream.getConsole();
48 * @see java.lang.Object#hashCode()
50 public int hashCode() {
51 return stream.hashCode();
57 public void print(String message) {
59 stream.print(message);
65 // public void println() {
66 // //hasMessages = true;
73 public void println(String message) {
75 stream.println(message);
81 // public void setColor(Color color) {
82 // stream.setColor(color);
85 // public void reportError(String title, String message) {
87 // WikiEditorPlugin.getDefault().reportError(title, message);
91 // public void reportError() {
92 // reportError("Problems listed", "Open console view for problems log!");
95 * Creates a string buffer from the given input stream
97 public static String getStringFromStream(InputStream stream)
99 StringBuffer buffer = new StringBuffer();
100 byte[] b = new byte[100];
102 while (finished != -1) {
103 finished = stream.read(b);
104 if (finished != -1) {
105 String current = new String(b, 0, finished);
106 buffer.append(current);
109 return buffer.toString();