|Console enhancements [message #227441]
||Wed, 28 January 2009 19:49
| No real name
Registered: July 2009
I have implemented a console page participant extension point for my |
plugin. My goals are to show our server's log file in a console page,
with nice coloring and stack trace linking. I am using a
LineStyleListener attached in the page participant to set up coloring in
my log file for all except the stack traces.
So far, I have got it mostly working, but have these questions:
1) I was using a MessageConsole directly, but had to subclass it (even
though javadoc says not to do so) in order to restrict enablement of the
page participant to my console only. Is there a better way to do this?
2) I found JavaStackTraceConsole which nicely handles coloring and linking
to source for stack traces, but that is kind of a sibling in the hierarchy
to MessageConsole. How can I have a MessageConsole with the additional
stack trace functionality of JavaStackTraceConsole?
|Re: Console enhancements [message #227975 is a reply to message #227441]
||Tue, 17 February 2009 17:32
| Ahti Kitsik
Registered: July 2009
Rochelle Raccah wrote:
> 1) I was using a MessageConsole directly, but had to subclass it (even
> though javadoc says not to do so) in order to restrict enablement of the
> page participant to my console only. Is there a better way to do this?
I believe IOConsole would be good enough for you and subclassing that
should be okey.
> 2) I found JavaStackTraceConsole which nicely handles coloring and linking
> to source for stack traces, but that is kind of a sibling in the hierarchy
> to MessageConsole. How can I have a MessageConsole with the additional
> stack trace functionality of JavaStackTraceConsole?
As i understand, you don't need any special subclassing to achieve this
kind of formatting.
The way Eclipse Console works with formatting and linking is that you can
attach Pattern Match Listeners using consolePatternMatchListeners
Java stacktrace and system.err is doing exactly that. See
org.eclipse.jdt.debug.ui/plugin.xml  for example how
JavaExceptionConsoleTracker and JavaConsoleTracker pattern match listeners
are attached to any console that match the enablement criteria.
To get stacktraces linked you would have to attach
JavaConsoleTracker(implements IPatternMatchListenerDelegate) and
JavaExceptionConsoleTracker to your console so PatternMatchListener can
Unfortunately JavaConsoleTracker is .internal. but maybe that won't hold
Atm I don't see a more API-friendly way for this.
PS. I have not tried this myself so could be wrong with something!
(Search for consolePatternMatchListeners)
Founder & Chief Coder @ Codehoop
Eclipse RCP development, Open Source consulting
Read more: http://www.codehoop.com
My blog: http://ahtik.com/blog
Powered by FUDForum
. Page generated in 0.01814 seconds