public abstract class TextConsole extends AbstractConsole
Pattern match listeners can be registered with a console programmatically
or via the org.eclipse.ui.console.consolePatternMatchListeners
extension point.
Clients may subclass this class. Subclasses must provide a document partitioner.
Constructor and Description |
---|
TextConsole(String name,
String consoleType,
ImageDescriptor imageDescriptor,
boolean autoLifecycle)
Constructs a console with the given name, image descriptor, and lifecycle
|
Modifier and Type | Method and Description |
---|---|
void |
addHyperlink(IHyperlink hyperlink,
int offset,
int length)
Adds a hyperlink to this console.
|
void |
addPatternMatchListener(IPatternMatchListener listener)
Adds the given pattern match listener to this console.
|
void |
clearConsole()
Clears the console.
|
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.
|
Object |
getAttribute(String key)
Returns the attribute associated with the specified key.
|
Color |
getBackground()
Returns the background color to use for this console or
null for the
default background color. |
int |
getConsoleWidth()
Returns the current width of this console.
|
IDocument |
getDocument()
Returns this console's document.
|
Font |
getFont()
Returns the font used by this console.
|
IHyperlink |
getHyperlink(int offset)
Returns the hyperlink at the given offset of
null if none. |
IHyperlink[] |
getHyperlinks()
Returns all hyperlinks in this console.
|
protected abstract IConsoleDocumentPartitioner |
getPartitioner()
Returns the console's document partitioner.
|
IRegion |
getRegion(IHyperlink link)
Returns the region associated with the given hyperlink.
|
ISchedulingRule |
getSchedulingRule()
Returns a scheduling rule which can be used to prevent jobs from running
while this console's pattern matcher is active.
|
int |
getTabWidth()
Returns the tab width used in this console.
|
protected void |
init()
Called when this console is added to the console manager.
|
boolean |
isConsoleAutoScrollLock()
Returns the user preference for enabling auto scroll lock feature.
|
void |
matcherFinished()
Called by this console's pattern matcher when matching is complete.
|
void |
partitionerFinished()
This console's partitioner should call this method when it is not expecting any new data
to be appended to the document.
|
void |
removePatternMatchListener(IPatternMatchListener listener)
Removes the given pattern match listener from this console.
|
void |
setAttribute(String key,
Object value)
Sets an attribute value.
|
void |
setBackgrond(Color background)
Deprecated.
use setBackground(Color) instead
|
void |
setBackground(Color background)
Sets the background color used by this console.
|
void |
setConsoleAutoScrollLock(boolean autoScrollLockPref)
Sets the auto scroll lock preference.
|
void |
setConsoleWidth(int width)
Sets the width of this console in characters.
|
void |
setFont(Font newFont)
Sets the font used by this console.
|
void |
setTabWidth(int newTabWidth)
Sets the tab width used in this console.
|
activate, addPropertyChangeListener, destroy, firePropertyChange, getHelpContextId, getImageDescriptor, getName, getType, initialize, removePropertyChangeListener, setImageDescriptor, setName, setType
public TextConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle)
name
- name to display for this consoleconsoleType
- console type identifier or null
imageDescriptor
- image to display for this console or null
autoLifecycle
- whether lifecycle methods should be called automatically
when this console is added/removed from the console managerprotected void dispose()
AbstractConsole
Since 3.1, this methods is only called automatically if this console was created with an automatic lifecycle.
dispose
in class AbstractConsole
public IPageBookViewPage createPage(IConsoleView view)
IConsole
view
- the view in which the page is to be createdpublic IDocument getDocument()
Note that a console may or may not support direct manipulation of its document. For example, an I/O console document and its partitions are produced from the streams connected to it, and clients are not intended to modify the document's contents.
public int getConsoleWidth()
public boolean isConsoleAutoScrollLock()
public void setConsoleAutoScrollLock(boolean autoScrollLockPref)
autoScrollLockPref
- enable auto scroll lock preference.protected void init()
AbstractConsole
Since 3.1, this method is only called automatically if this console was created with an automatic lifecycle.
init
in class AbstractConsole
public void setConsoleWidth(int width)
width
- the width to make this console. Values of 0 or less imply
the console does not have any fixed width.public void setTabWidth(int newTabWidth)
newTabWidth
- the tab widthpublic int getTabWidth()
public Font getFont()
public void setFont(Font newFont)
null
to use
the default text font.newFont
- font, or null
to indicate the default font@Deprecated public void setBackgrond(Color background)
null
to use
the default background color.background
- background color or null
for defaultpublic void setBackground(Color background)
null
to use
the default background color.background
- background color or null
for defaultpublic Color getBackground()
null
for the
default background color.null
for defaultpublic void clearConsole()
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.
protected abstract IConsoleDocumentPartitioner getPartitioner()
public IHyperlink[] getHyperlinks()
public IHyperlink getHyperlink(int offset)
null
if none.offset
- offset for which a hyperlink is requestednull
if nonepublic void addPatternMatchListener(IPatternMatchListener listener)
listener
- the listener to addpublic void removePatternMatchListener(IPatternMatchListener listener)
listener
- the pattern match listener to removepublic ISchedulingRule getSchedulingRule()
Although this scheduling rule prevents jobs from running at the same time as pattern matching jobs for this console, it does not enforce any ordering of jobs. Since 3.2, pattern matching jobs belong to the job family identified by the console object that matching is occurring on. To ensure a job runs after all scheduled pattern matching is complete, clients must join on this console's job family.
public void partitionerFinished()
public void matcherFinished()
Clients should not call this method.
public void addHyperlink(IHyperlink hyperlink, int offset, int length) throws BadLocationException
hyperlink
- the hyperlink to addoffset
- the offset in the console document at which the hyperlink should be addedlength
- the length of the text which should be hyperlinkedBadLocationException
- if the specified location is not valid.public IRegion getRegion(IHyperlink link)
link
- hyperlinkpublic Object getAttribute(String key)
key
- attribute key
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.