Console enhancements [message #227441] |
Wed, 28 January 2009 19:49  |
Eclipse User |
|
|
|
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?
Thanks,
Rochelle
|
|
|
Re: Console enhancements [message #227975 is a reply to message #227441] |
Tue, 17 February 2009 17:32  |
Eclipse User |
|
|
|
Hello,
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
extension point.
Java stacktrace and system.err is doing exactly that. See
org.eclipse.jdt.debug.ui/plugin.xml [1] 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
kick in.
Unfortunately JavaConsoleTracker is .internal. but maybe that won't hold
you back.
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!
[1]
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.deb ug.ui/plugin.xml?view=markup
(Search for consolePatternMatchListeners)
regs,
Ahti
--
Ahti Kitsik
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.25141 seconds