Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.console
Class TextConsole


java.lang.Object
  extended by 

org.eclipse.ui.console.AbstractConsole
      extended by 
org.eclipse.ui.console.TextConsole
All Implemented Interfaces:
IConsole
Direct Known Subclasses:
IOConsole

public abstract class TextConsole
extends AbstractConsole

An abstract text console that supports regular expression matching and hyperlinks.

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 Summary
TextConsole ( String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle)
          Constructs a console with the given name, image descriptor, and lifecycle
 
Method Summary
 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.
 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 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.
 
Methods inherited from class org.eclipse.ui.console. AbstractConsole
activate, addPropertyChangeListener, destroy, firePropertyChange, getHelpContextId, getImageDescriptor, getName, getType, init, initialize, removePropertyChangeListener, setImageDescriptor, setName, setType
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextConsole

public 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 Detail

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.

Since 3.1, this methods is only called automatically if this console was created with an automatic lifecycle.

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

getDocument

public 
IDocument getDocument()
Returns 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

getConsoleWidth

public 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

setConsoleWidth

public 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.

setTabWidth

public void setTabWidth(int newTabWidth)
Sets the tab width used in this console.

Parameters:
newTabWidth - the tab width

getTabWidth

public int getTabWidth()
Returns the tab width used in this console.

Returns:
tab width used in this console

getFont

public 
Font getFont()
Returns the font used by this console. Must be called in the UI thread.

Returns:
font used by this console

setFont

public void setFont(
Font newFont)
Sets the font used by this console. Specify null to use the default text font.

Parameters:
newFont - font, or null to indicate the default font

setBackgrond

public void setBackgrond(
Color background)
Deprecated. use setBackground(Color) instead

Sets the background color used by this console. Specify null to use the default background color.

Parameters:
background - background color or null for default
Since:
3.3

setBackground

public void setBackground(
Color background)
Sets the background color used by this console. Specify null to use the default background color.

Parameters:
background - background color or null for default
Since:
3.3

getBackground

public 
Color getBackground()
Returns the background color to use for this console or null for the default background color.

Returns:
background color or null for default
Since:
3.3

clearConsole

public 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.


getPartitioner

protected abstract 
IConsoleDocumentPartitioner getPartitioner()
Returns the console's document partitioner.

Returns:
The console's document partitioner

getHyperlinks

public 
IHyperlink[] getHyperlinks()
Returns all hyperlinks in this console.

Returns:
all hyperlinks in this console

getHyperlink

public 
IHyperlink getHyperlink(int offset)
Returns the hyperlink at the given offset of null if none.

Parameters:
offset - offset for which a hyperlink is requested
Returns:
the hyperlink at the given offset of null if none

addPatternMatchListener

public void addPatternMatchListener(
IPatternMatchListener listener)
Adds 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

removePatternMatchListener

public void removePatternMatchListener(
IPatternMatchListener listener)
Removes 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

getSchedulingRule

public 
ISchedulingRule getSchedulingRule()
Returns 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

partitionerFinished

public void partitionerFinished()
This console's partitioner should call this method when it is not expecting any new data to be appended to the document.


matcherFinished

public void matcherFinished()
Called by this console's pattern matcher when matching is complete.

Clients should not call this method.


addHyperlink

public void addHyperlink(
IHyperlink hyperlink,
                         int offset,
                         int length)
                  throws 
BadLocationException
Adds 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.

getRegion

public 
IRegion getRegion(
IHyperlink link)
Returns 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.

getAttribute

public 
Object getAttribute(
String key)
Returns the attribute associated with the specified key.

Parameters:
key - attribute key
Returns:
the attribute associated with the specified key

setAttribute

public void setAttribute(
String key,
                         
Object value)
Sets an attribute value. Intended for client data.

Parameters:
key - attribute key
value - attribute value

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire