Class IOConsole
- All Implemented Interfaces:
IConsole
- Direct Known Subclasses:
MessageConsole
Clients may instantiate and subclass this class.
- Since:
- 3.1
-
Constructor Summary
ConstructorsConstructorDescriptionIOConsole
(String name, String consoleType, ImageDescriptor imageDescriptor) Constructs a console with the given name, type, and image with the workbench's default encoding.IOConsole
(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) Constructs a console with the given name, type, image, and lifecycle, with the workbench's default encoding.IOConsole
(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle) Constructs a console with the given name, type, image, encoding and lifecycle.IOConsole
(String name, String consoleType, ImageDescriptor imageDescriptor, Charset charset, boolean autoLifecycle) Constructs a console with the given name, type, image, encoding and lifecycle.IOConsole
(String name, ImageDescriptor imageDescriptor) Constructs a console with the given name and image. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the console.createPage
(IConsoleView view) Creates and returns a new page for this console.protected void
dispose()
Disposes this console.Returns the Charset for this console.Returns the encoding for this console.int
Returns the maximum number of characters that the console will display at once.Returns the input stream connected to the keyboard.int
Returns the number of characters that will remain in this console when its high water mark is exceeded.protected IConsoleDocumentPartitioner
Returns this console's document partitioner.boolean
Check if carriage returns (\r
) in console output are interpreted as control characters.boolean
Check if console currently interprets ASCII control characters.Creates and returns a new output stream which may be used to write to this console.void
setCarriageReturnAsControlCharacter
(boolean carriageReturnAsControlCharacter) If control characters in console output are interpreted by this console carriage returns (\r
) are either ignored (false
) and usually handled as line break by connected console document or iftrue
interpreted with there control character meaning.void
setHandleControlCharacters
(boolean handleControlCharacters) Enable or disable interpretation of ASCII control characters like backspace (\b
).void
setInputStream
(InputStream inputStream) Sets the new input stream.void
setWaterMarks
(int low, int high) Sets the text buffer size for this console.Methods inherited from class org.eclipse.ui.console.TextConsole
addHyperlink, addPatternMatchListener, getAttribute, getBackground, getConsoleWidth, getDocument, getFont, getHyperlink, getHyperlinks, getRegion, getSchedulingRule, getTabWidth, init, isConsoleAutoScrollLock, matcherFinished, partitionerFinished, removePatternMatchListener, setAttribute, setBackgrond, setBackground, setConsoleAutoScrollLock, setConsoleWidth, setFont, setTabWidth
Methods inherited from class org.eclipse.ui.console.AbstractConsole
activate, addPropertyChangeListener, destroy, firePropertyChange, getHelpContextId, getImageDescriptor, getName, getType, initialize, removePropertyChangeListener, setImageDescriptor, setName, setType
-
Constructor Details
-
IOConsole
public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) Constructs a console with the given name, type, image, and lifecycle, with the workbench's default encoding.- Parameters:
name
- name to display for this consoleconsoleType
- console type identifier ornull
imageDescriptor
- image to display for this console ornull
autoLifecycle
- whether lifecycle methods should be called automatically when this console is added/removed from the console manager
-
IOConsole
public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle) Constructs a console with the given name, type, image, encoding and lifecycle.- Parameters:
name
- name to display for this consoleconsoleType
- console type identifier ornull
imageDescriptor
- image to display for this console ornull
encoding
- the encoding that should be used to render the text, ornull
if the system default encoding should be usedautoLifecycle
- whether lifecycle methods should be called automatically when this console is added/removed from the console manager
-
IOConsole
public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, Charset charset, boolean autoLifecycle) Constructs a console with the given name, type, image, encoding and lifecycle.- Parameters:
name
- name to display for this consoleconsoleType
- console type identifier ornull
imageDescriptor
- image to display for this console ornull
charset
- the encoding that should be used to render the text, must not benull
autoLifecycle
- whether lifecycle methods should be called automatically when this console is added/removed from the console manager- Since:
- 3.7
-
IOConsole
Constructs a console with the given name, type, and image with the workbench's default encoding. Lifecycle methods will be called when this console is added/removed from the console manager.- Parameters:
name
- name to display for this consoleconsoleType
- console type identifier ornull
imageDescriptor
- image to display for this console ornull
-
IOConsole
Constructs a console with the given name and image. Lifecycle methods will be called when this console is added/removed from the console manager. This console will have an unspecified (null
) type.- Parameters:
name
- name to display for this consoleimageDescriptor
- image to display for this console ornull
-
-
Method Details
-
createPage
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.- Specified by:
createPage
in interfaceIConsole
- Overrides:
createPage
in classTextConsole
- Parameters:
view
- the view in which the page is to be created- Returns:
- a page book view page representation of this console
-
newOutputStream
Creates and returns a new output stream which may be used to write to this console. A console may be connected to more than one output stream at once. Clients are responsible for closing any output streams created on this console.Clients should avoid writing large amounts of output to this stream in the UI thread. The console needs to process the output in the UI thread and if the client hogs the UI thread writing output to the console, the console will not be able to process the output.
- Returns:
- a new output stream connected to this console
-
getInputStream
Returns the input stream connected to the keyboard.Note: It returns the stream connected to keyboard. There is no guarantee to get the stream last set with
setInputStream(InputStream)
. The return value might benull
if the current input stream is not connected to the keyboard.- Returns:
- the input stream connected to the keyboard.
-
setInputStream
Sets the new input stream.- Parameters:
inputStream
- the input stream- Since:
- 3.6
-
getPartitioner
Returns this console's document partitioner.- Specified by:
getPartitioner
in classTextConsole
- Returns:
- this console's document partitioner
-
getHighWaterMark
public int getHighWaterMark()Returns the maximum number of characters that the console will display at once. This is analogous to the size of the text buffer this console maintains.- Returns:
- the maximum number of characters that the console will display
-
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
-
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 (if -1 the console does not limit output)high
- the maximum number of characters this console will cache in its text buffer (if -1 the console does not limit output)- Throws:
IllegalArgumentException
- if low >= high & low != -1
-
clearConsole
public void clearConsole()Description copied from class:TextConsole
Clears the console.Since a console may or may not support direct manipulation of its document's contents, this method should be called to clear a text console's document. The default implementation sets this console's document content to the empty string directly. Subclasses should override as required.
- Overrides:
clearConsole
in classTextConsole
-
dispose
protected void dispose()Disposes this console.- Overrides:
dispose
in classTextConsole
-
getEncoding
Returns the encoding for this console.- Returns:
- the encoding set for this console
- Since:
- 3.3
-
getCharset
Returns the Charset for this console.- Returns:
- the Charset for this console
- Since:
- 3.7
-
isHandleControlCharacters
public boolean isHandleControlCharacters()Check if console currently interprets ASCII control characters.- Returns:
true
if console interprets ASCII control characters- Since:
- 3.9
-
setHandleControlCharacters
public void setHandleControlCharacters(boolean handleControlCharacters) Enable or disable interpretation of ASCII control characters like backspace (\b
).- Parameters:
handleControlCharacters
- interpret control characters iftrue
- Since:
- 3.9
-
isCarriageReturnAsControlCharacter
public boolean isCarriageReturnAsControlCharacter()Check if carriage returns (\r
) in console output are interpreted as control characters. They are also not interpreted if general control character handling is disabled.- Returns:
- if
true
carriage returns are interpreted as control characters. - Since:
- 3.9
- See Also:
-
setCarriageReturnAsControlCharacter
public void setCarriageReturnAsControlCharacter(boolean carriageReturnAsControlCharacter) If control characters in console output are interpreted by this console carriage returns (\r
) are either ignored (false
) and usually handled as line break by connected console document or iftrue
interpreted with there control character meaning.Note: this option has no effect if control character interpretation is disabled in general.
- Parameters:
carriageReturnAsControlCharacter
- setfalse
to exclude carriage return from control character interpretation- Since:
- 3.9
- See Also:
-