Class TextConsole
- All Implemented Interfaces:
- IConsole
- Direct Known Subclasses:
- IOConsole
 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.
- Since:
- 3.1
- 
Constructor SummaryConstructorsConstructorDescriptionTextConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) Constructs a console with the given name, image descriptor, and lifecycle
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddHyperlink(IHyperlink hyperlink, int offset, int length) Adds a hyperlink to this console.voidaddPatternMatchListener(IPatternMatchListener listener) Adds the given pattern match listener to this console.voidClears the console.createPage(IConsoleView view) Creates and returns a new page for this console.protected voiddispose()Called when this console is removed from the console manager.getAttribute(String key) Returns the attribute associated with the specified key.Returns the background color to use for this console ornullfor the default background color.intReturns the current width of this console.Returns this console's document.getFont()Returns the font used by this console.getHyperlink(int offset) Returns the hyperlink at the given offset ornullif none.Returns all hyperlinks in this console.protected abstract IConsoleDocumentPartitionerReturns the console's document partitioner.getRegion(IHyperlink link) Returns the region associated with the given hyperlink.Returns a scheduling rule which can be used to prevent jobs from running while this console's pattern matcher is active.intReturns the tab width used in this console.protected voidinit()Called when this console is added to the console manager.booleanReturns the user preference for enabling auto scroll lock feature.voidCalled by this console's pattern matcher when matching is complete.voidThis console's partitioner should call this method when it is not expecting any new data to be appended to the document.voidRemoves the given pattern match listener from this console.voidsetAttribute(String key, Object value) Sets an attribute value.voidsetBackgrond(Color background) Deprecated.use setBackground(Color) insteadvoidsetBackground(Color background) Sets the background color used by this console.voidsetConsoleAutoScrollLock(boolean autoScrollLockPref) Sets the auto scroll lock preference.voidsetConsoleWidth(int width) Sets the width of this console in characters.voidSets the font used by this console.voidsetTabWidth(int newTabWidth) Sets the tab width used in this console.Methods inherited from class org.eclipse.ui.console.AbstractConsoleactivate, addPropertyChangeListener, destroy, firePropertyChange, getHelpContextId, getImageDescriptor, getName, getType, initialize, removePropertyChangeListener, setImageDescriptor, setName, setType
- 
Constructor Details- 
TextConsolepublic TextConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) Constructs a console with the given name, image descriptor, and lifecycle- Parameters:
- name- name to display for this console
- consoleType- 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 manager
 
 
- 
- 
Method Details- 
disposeprotected void dispose()Description copied from class:AbstractConsoleCalled when this console is removed from the console manager. Default implementation does nothing. Subclasses may override.Since 3.1, this methods is only called automatically if this console was created with an automatic lifecycle. - Overrides:
- disposein class- AbstractConsole
 
- 
createPageDescription copied from interface:IConsoleCreates 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
 
- 
getDocumentReturns this console's document.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. - Returns:
- this console's document
 
- 
getConsoleWidthpublic int getConsoleWidth()Returns the current width of this console. A value of zero of less indicates this console has no fixed width.- Returns:
- the current width of this console
 
- 
isConsoleAutoScrollLockpublic boolean isConsoleAutoScrollLock()Returns the user preference for enabling auto scroll lock feature.- Returns:
- auto scroll lock
- Since:
- 3.8
 
- 
setConsoleAutoScrollLockpublic void setConsoleAutoScrollLock(boolean autoScrollLockPref) Sets the auto scroll lock preference.- Parameters:
- autoScrollLockPref- enable auto scroll lock preference.
- Since:
- 3.8
 
- 
initprotected void init()Description copied from class:AbstractConsoleCalled when this console is added to the console manager. Default implementation does nothing. Subclasses may override.Since 3.1, this method is only called automatically if this console was created with an automatic lifecycle. - Overrides:
- initin class- AbstractConsole
 
- 
setConsoleWidthpublic void setConsoleWidth(int width) Sets the width of this console in characters. Any value greater than zero will cause this console to have a fixed width.- Parameters:
- width- the width to make this console. Values of 0 or less imply the console does not have any fixed width.
 
- 
setTabWidthpublic void setTabWidth(int newTabWidth) Sets the tab width used in this console.- Parameters:
- newTabWidth- the tab width
 
- 
getTabWidthpublic int getTabWidth()Returns the tab width used in this console.- Returns:
- tab width used in this console
 
- 
getFontReturns the font used by this console. Must be called in the UI thread.- Returns:
- font used by this console
 
- 
setFontSets the font used by this console. Specifynullto use the default text font.- Parameters:
- newFont- font, or- nullto indicate the default font
 
- 
setBackgrondDeprecated.use setBackground(Color) insteadSets the background color used by this console. Specifynullto use the default background color.- Parameters:
- background- background color or- nullfor default
- Since:
- 3.3
 
- 
setBackgroundSets the background color used by this console. Specifynullto use the default background color.- Parameters:
- background- background color or- nullfor default
- Since:
- 3.3
 
- 
getBackgroundReturns the background color to use for this console ornullfor the default background color.- Returns:
- background color or nullfor default
- Since:
- 3.3
 
- 
clearConsolepublic void clearConsole()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. 
- 
getPartitionerReturns the console's document partitioner.- Returns:
- The console's document partitioner
 
- 
getHyperlinksReturns all hyperlinks in this console.- Returns:
- all hyperlinks in this console
 
- 
getHyperlinkReturns the hyperlink at the given offset ornullif none.- Parameters:
- offset- offset for which a hyperlink is requested
- Returns:
- the hyperlink at the given offset or nullif none
 
- 
addPatternMatchListenerAdds the given pattern match listener to this console. The listener will be connected and receive match notifications. Has no effect if an identical listener has already been added.- Parameters:
- listener- the listener to add
 
- 
removePatternMatchListenerRemoves the given pattern match listener from this console. The listener will be disconnected and will no longer receive match notifications. Has no effect if the listener was not previously added.- Parameters:
- listener- the pattern match listener to remove
 
- 
getSchedulingRuleReturns a scheduling rule which can be used to prevent jobs from running while this console's pattern matcher is active.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. - Returns:
- a scheduling rule which can be used to prevent jobs from running while this console's pattern matcher is active
 
- 
partitionerFinishedpublic void partitionerFinished()This console's partitioner should call this method when it is not expecting any new data to be appended to the document.
- 
matcherFinishedpublic void matcherFinished()Called by this console's pattern matcher when matching is complete.Clients should not call this method. 
- 
addHyperlinkAdds a hyperlink to this console.- Parameters:
- hyperlink- the hyperlink to add
- offset- the offset in the console document at which the hyperlink should be added
- length- the length of the text which should be hyperlinked
- Throws:
- BadLocationException- if the specified location is not valid.
 
- 
getRegionReturns the region associated with the given hyperlink.- Parameters:
- link- hyperlink
- Returns:
- the region associated with the hyperlink or null if the hyperlink is not found.
 
- 
getAttributeReturns the attribute associated with the specified key.- Parameters:
- key- attribute key
- Returns:
- the attribute associated with the specified key
 
- 
setAttributeSets an attribute value. Intended for client data.- Parameters:
- key- attribute key
- value- attribute value
 
 
-