Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Hooking into the console's Document
Hooking into the console's Document [message #518979] Fri, 05 March 2010 10:50
Marian Schedenig is currently offline Marian SchedenigFriend
Messages: 25
Registered: July 2009
Junior Member
Hi!

Styling individual lines in the console is quite simple; I just register an
IConsolePageParticipant, get the StyledText instance from the view page and
add a line style listener.

What I now want to do is *filter* lines, i.e. decide on a line by line basis
whether a line should be displayed or omitted completely. That doesn't seem
to be so easy.

It looks like one way to do this is to switch the StyledText's original
StyledTextContent with my own which takes its data from the original content
and filters it.

But it seems to me that a better solution would be to switch either the
Document or the document adapter used by the console's text viewer. From
what I understand, these are used earlier in the chain, so filtering lines
there would save work (and time) on the StyledTextContent side.

Only I'm not sure how to do this. The only way to change the document
adapter (which can't be set from outside as far as I can see) seems to be to
subclass TextViewer and override the createDocumentAdapter method. Clearly,
this is not an option since I'm trying to hook into an existing TextViewer.
And when I try to replace the TextConsoleViewer's Document with one of my
own (a very simple test instance for now - new
Document("This\nis\na\ntest.")), the console stops working and just throws
exceptions.

Is there any sane way to hook into the Document part of the data chain? Or
should I stick to my original idea and handle everything on the
StyledTextContent side? Or have I missed a much simpler solution?

Thanks,
Marian.
Previous Topic:Adding a pulldown button to a view
Next Topic:Missing required bundle org.junit_[3.8.1,3.9.0) when launching Plug-in unit tests
Goto Forum:
  


Current Time: Thu Apr 25 08:30:12 GMT 2024

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

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

Back to the top