Alternating colors of a single console stream. [message #1042578] |
Tue, 16 April 2013 11:53  |
Eclipse User |
|
|
|
Hi all,
I've created a console view which displays profiling information; each printed line containing detailed metrics. What I'm attempting to do is set the color of each line printed in the console based on the metrics (e.g. set the color of a particular line to green to show performance gain). I started with a MessageConsole, but using setColor on the MessageConsoleStream updates the whole stream, as it should.
At the moment I'm looking at consoleColorProviders extension point, but first want to make sure that this is the right approach or whether there is a better way to achieve what I described above.
|
|
|
|
Re: Alternating colors of a single console stream. [message #1092263 is a reply to message #1043283] |
Thu, 22 August 2013 10:33  |
Eclipse User |
|
|
|
Hi,
I faced some problems when trying to alternate the colours of a single MessageConsoleStream, so what I did to fix that was to create one MessageConsoleStream per colour:
MessageConsole msgConsole = new MessageConsole("foo", null);
MessageConsoleStream consoleStreamDefault = msgConsole.newMessageStream();
consoleStreamDefault.setColor(null);
MessageConsoleStream consoleStreamRed = msgConsole.newMessageStream();
consoleStreamRed.setColor(new Color(null, new RGB(255, 0, 0)));
...
a switch allows then to select the appropriate MessageConsoleStream for each single message to write.
Hope that helps,
Bernard.
|
|
|
Powered by
FUDForum. Page generated in 1.06501 seconds