# Interface IConsole

public interface IConsole
A console that displays output and writes input to a process. Implementors of `IConsoleColorProvider` should connect streams to a console document when connected to.

Since:
  2.1
See Also:
  - `IConsoleColorProvider`
Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

## Method Summary

Modifier and Type
Method
Description
`void`
`addLink(IConsoleHyperlink link, int offset, int length)`
Deprecated.
replaced with addLink(IHyperlink link, int offset, int length)
`void`
`addLink(IHyperlink link, int offset, int length)`
Adds the given hyperlink to this console.
`void`
`addPatternMatchListener(IPatternMatchListener matchListener)`
Adds the given pattern match listener to this console.
`void`
`connect(IStreamMonitor streamMonitor, String streamIdentifer)`
Connects this console to the given stream monitor, uniquely identified by the given identifier.
`void`
`connect(IStreamsProxy streamsProxy)`
Connects this console to the given streams proxy.
`IDocument`
`getDocument()`
Returns the document associated with this console.
`IProcess`
`getProcess()`
Returns the process associated with this console.
`IRegion`
`getRegion(IConsoleHyperlink link)`
Deprecated.
replaced with getRegion(IHyperlink link) instead
`IRegion`
`getRegion(IHyperlink link)`
Returns the region of text associated with the given hyperlink, or `null` if the given hyperlink is not contained in this console.
`IOConsoleOutputStream`
`getStream(String streamIdentifier)`
Returns the stream associated with the specified stream identifier.
`void`
`removePatternMatchListener(IPatternMatchListener matchListener)`
Removes the given pattern match listener from this console.

## Method Details

### connect

void connect(IStreamsProxy streamsProxy)
Connects this console to the given streams proxy. This associates the standard in, out, and error streams with the console. Keyboard input will be written to the given proxy.

Parameters:
  `streamsProxy` - the proxy to connect this console to

### connect

void connect(IStreamMonitor streamMonitor, String streamIdentifer)
Connects this console to the given stream monitor, uniquely identified by the given identifier. This allows for more than the standard (in, out, error) streams to be connected to the console.

Parameters:
  `streamMonitor` - the monitor to connect this console to
  `streamIdentifer` - the stream identifier to connect this console to

### addLink

@Deprecated void addLink(IConsoleHyperlink link, int offset, int length)
Deprecated.
replaced with addLink(IHyperlink link, int offset, int length)
Adds the given hyperlink to this console. The link will be notified when entered, exited, and activated.

If the link's region (offset/length) is within the console's document current bounds, it is added immediately. Otherwise, the link is added when the console's document grows to contain the link's region.

Parameters:
  `link` - the hyperlink to add
  `offset` - the character offset within the console document where the text associated with the hyperlink begins
  `length` - the length of the associated hyperlink text

### addLink

void addLink(IHyperlink link, int offset, int length)
Adds the given hyperlink to this console. The link will be notified when entered, exited, and activated.

If the link's region (offset/length) is within the console's document current bounds, it is added immediately. Otherwise, the link is added when the console's document grows to contain the link's region.

Parameters:
  `link` - the hyperlink to add
  `offset` - the character offset within the console document where the text associated with the hyperlink begins
  `length` - the length of the associated hyperlink text
Since:
  3.1

### getRegion

@Deprecated IRegion getRegion(IConsoleHyperlink link)
Deprecated.
replaced with getRegion(IHyperlink link) instead
Returns the region of text associated with the given hyperlink, or `null` if the given hyperlink is not contained in this console.

Parameters:
  `link` - a console hyperlink
Returns:
  region of text associated with the hyperlink, or `null`

### getRegion

IRegion getRegion(IHyperlink link)
Returns the region of text associated with the given hyperlink, or `null` if the given hyperlink is not contained in this console.

Parameters:
  `link` - a console hyperlink
Returns:
  region of text associated with the hyperlink, or `null`
Since:
  3.1

### getDocument

IDocument getDocument()
Returns the document associated with this console.

Returns:
  document

### getProcess

IProcess getProcess()
Returns the process associated with this console.

Returns:
  the process associated with this console

### addPatternMatchListener

void addPatternMatchListener(IPatternMatchListener matchListener)
Adds the given pattern match listener to this console. The listener will be connected and receive match notifications.

Parameters:
  `matchListener` - the listener to add
Since:
  3.1

### removePatternMatchListener

void removePatternMatchListener(IPatternMatchListener matchListener)
Removes the given pattern match listener from this console. The listener will be disconnected and will no longer receive match notifications.

Parameters:
  `matchListener` - the pattern match listener to remove.
Since:
  3.1

### getStream

IOConsoleOutputStream getStream(String streamIdentifier)
Returns the stream associated with the specified stream identifier.

Parameters:
  `streamIdentifier` - Uniquely identifies the required stream
Returns:
  The stream or `null` if none found with matching streamIdentifier
Since:
  3.1