Eclipse Platform
Release 3.0

org.eclipse.ui.console
Class MessageConsole

java.lang.Object
  extended byorg.eclipse.ui.console.AbstractConsole
      extended byorg.eclipse.ui.console.MessageConsole
All Implemented Interfaces:
IConsole

public class MessageConsole
extends AbstractConsole

A console that displays messages. A message console may have one or more streams connected to it (MessageConsoleStream). Text written to streams is buffered and processed in a background thread.

Clients may instantiate this class.

Since:
3.0

Field Summary
static int DEFAULT_TAB_SIZE
          The default tab size
static String P_FONT
          Property constant indicating the font of this console has changed.
static String P_STREAM_COLOR
          Property constant indicating the color of a stream has changed.
static String P_TAB_SIZE
          Property constant indicating tab size has changed
 
Constructor Summary
MessageConsole(String name, ImageDescriptor imageDescriptor)
          Constructs a new message console.
 
Method Summary
protected  void appendToDocument(String text, MessageConsoleStream stream)
          Appends the given message to this console, from the specified stream.
 IPageBookViewPage createPage(IConsoleView view)
          Creates and returns a new page for this console.
protected  void dispose()
          Called when this console is removed from the console manager.
 IDocument getDocument()
          Returns the document this console writes to.
 Font getFont()
          Returns the font for this console
 int getHighWaterMark()
          Returns the maximum number of characters that the console will display at once.
 int getLowWaterMark()
          Returns the number of characters that will remain in this console when its high water mark is exceeded.
 int getTabWidth()
          Returns the tab width.
 MessageConsoleStream newMessageStream()
          Returns a new message stream connected to this console.
 void setFont(Font font)
          Sets the font used by this console
 void setTabWidth(int tabWidth)
          Sets the tab width.
 void setWaterMarks(int low, int high)
          Sets the text buffer size for this console.
 
Methods inherited from class org.eclipse.ui.console.AbstractConsole
addPropertyChangeListener, firePropertyChange, getImageDescriptor, getName, init, removePropertyChangeListener, setImageDescriptor, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P_FONT

public static final String P_FONT
Property constant indicating the font of this console has changed.


P_STREAM_COLOR

public static final String P_STREAM_COLOR
Property constant indicating the color of a stream has changed.


P_TAB_SIZE

public static final String P_TAB_SIZE
Property constant indicating tab size has changed


DEFAULT_TAB_SIZE

public static final int DEFAULT_TAB_SIZE
The default tab size

See Also:
Constant Field Values
Constructor Detail

MessageConsole

public MessageConsole(String name,
                      ImageDescriptor imageDescriptor)
Constructs a new message console.

Parameters:
name - console name
imageDescriptor - console image descriptor or null if none
Method Detail

getHighWaterMark

public int getHighWaterMark()
Returns the maximum number of characters that the console will display at once. This is analagous to the size of the text buffer this console maintains.

Returns:
the maximum number of characters that the console will display

setWaterMarks

public void setWaterMarks(int low,
                          int high)
Sets the text buffer size for this console. The high water mark indicates the maximum number of characters stored in the buffer. The low water mark indicates the number of characters remaining in the buffer when the high water mark is exceeded.

Parameters:
low - the number of characters remaining in the buffer when the high water mark is exceeded
high - the maximum number of characters this console will cache in its text buffer
Throws:
IllegalArgumentException - if low >= high

getLowWaterMark

public int getLowWaterMark()
Returns the number of characters that will remain in this console when its high water mark is exceeded.

Returns:
the number of characters that will remain in this console when its high water mark is exceeded

dispose

protected void dispose()
Description copied from class: AbstractConsole
Called when this console is removed from the console manager. Default implementation does nothing. Subclasses may override.

Overrides:
dispose in class AbstractConsole

createPage

public IPageBookViewPage createPage(IConsoleView view)
Description copied from interface: IConsole
Creates and returns a new page for this console. The page is displayed for this console in the console given view.

Parameters:
view - the view in which the page is to be created
Returns:
a page book view page representation of this console

setFont

public void setFont(Font font)
Sets the font used by this console

Parameters:
font - font

getFont

public Font getFont()
Returns the font for this console

Returns:
font for this console

newMessageStream

public MessageConsoleStream newMessageStream()
Returns a new message stream connected to this console.

Returns:
a new message stream connected to this console

appendToDocument

protected void appendToDocument(String text,
                                MessageConsoleStream stream)
Appends the given message to this console, from the specified stream.

Parameters:
text - message
stream - stream the message belongs to

getDocument

public IDocument getDocument()
Returns the document this console writes to.

Returns:
the document this console wites to

setTabWidth

public void setTabWidth(int tabWidth)
Sets the tab width.


getTabWidth

public int getTabWidth()
Returns the tab width.

Returns:
tab width

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.