Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Console enhancements
Console enhancements [message #227441] Thu, 29 January 2009 00:49 Go to next message
No real name is currently offline No real name
Messages: 13
Registered: July 2009
Junior Member
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 22:32 Go to previous message
Ahti Kitsik is currently offline Ahti Kitsik
Messages: 1
Registered: July 2009
Junior Member
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
Previous Topic:Changing focus/cursor position with hyperlink in an XML Editor
Next Topic:[XSLTools] XSLT 2.0 processor in Eclipse?
Goto Forum:
  


Current Time: Fri Oct 24 13:37:00 GMT 2014

Powered by FUDForum. Page generated in 0.03283 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software