Sharing the Console
Author: Darin Wright, October 22, 2002.
This document proposes support for an enhanced debug console.
Background
Currently, the implementation of the console is private. When a launch is registered,
a document is created for all associated processes. The document polls the streams
associated with the process - standard error and out - appending to the document
as the streams are written. As well, input is read from the keyboard and sent
to standard in. The user may choose color preferences for the different streams
- out, err, in.
Goals
Following are a list of goals motivating an open console API:
- Allow other clients to use the same console as the debugger, with custom/enhanced
function
- Allow clients to annotate a console document with hyper links. For example,
the Java debugger would annotate stack traces with links to the associated
classes. An Ant client would annotate build output with task links, and perhaps
create problems/links for errors encountered in a "javac" task.
- Allow clients to color a document in a custom manner, or extend the default
coloring policy.
Proposed Implementation
The debug plug-in will provide a default document provider that creates console
documents for processes. The default console document will listen to the output
streams of its associated process, which will update the document. A default
partitioner will be used to partition the document into colored partitions representing
standard out, in, and error. The partitions will be implemented as "color
partitions" rather than standard in, out, etc., such that other partitioners
can easily add more colors to a document. A default implementation of a color
partition will be provided.
By default a console document will have an annotation model that understands
"hyper link" annotations. Cleints that need to annotate console documents
must register as document listeners to the appropriate document. The debug UI
will provide notification of console document creation and removal. This will
allow clients to register as document listeners where applicable. The console
view will render hyper links via underlining, color, or bold (depending on user
preference), and the cursor will change to a "hand" when the user
moves over a link. As well, the links can be configured to draw dynamically
as the user moves the mouse over a valid link, rather than having links drawn
all the time which could cause clutter. An implementation of a hyper-link annotation
will be provided that opens an editor on a file when followed.
To override the type of document created (and thus, partitioner), clients may
specify a custom document provider. Document providers can be registered for
launch configuration types via an extension point. Thus, an Ant client could
provide a custom document provider that creates a document/partitioner that
renders with more colors, and reads its output from an Ant Logger.