This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 52777 - output2: more generic support for colors
Summary: output2: more generic support for colors
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Output Window (show other bugs)
Version: 4.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: t_h
URL:
Keywords: UI
Depends on: 157911 159955
Blocks: 70469 124366
  Show dependency tree
 
Reported: 2004-12-22 22:02 UTC by Rich Unger
Modified: 2009-03-10 02:29 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Patch to support colored output (13.58 KB, patch)
2005-08-31 08:52 UTC, _ tboudreau
Details | Diff
Second diff - last one had an undeleted println() or two (16.10 KB, patch)
2005-08-31 08:59 UTC, _ tboudreau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Unger 2004-12-22 22:02:25 UTC
I was just looking through the output2 code, with
the hopes of being able to write text of different
colors.  I see that there is a hard-coded
distinction between 3 colors: one for links
(blue), one for isErr()==true (brown), and the
normal black.

It would be nice if there were some way for module
developers to extend this, either by specifying
the color directly in OutputWriter.println(), or
perhaps by specifying a color reference like
"nb.output.foreground".  (How are these
configured, anyway?)
Comment 1 Rich Unger 2005-04-11 23:43:36 UTC
Or, if an API change is too much to ask, how about the ability to say, "this
line is this color", and if I want that ability, I have to declare a dependency
on the implementing module.  (After all, right now I'm declaring a dependency on
core/term to get this.)

In the long run, though, I still think it's a good API addition, and the
underlying implementation is certainly capable of it.
Comment 2 Milos Kleint 2005-04-18 13:17:09 UTC
are we talking about SPI to plug custom colors for hyperlinks or an API that
lets UI users of the output2 module to write lines in multiple colors?

spi is ok with me, preferably through the UImanager configurations.

I'd rather not add a new method to OutputWriter that would allow custom colors
for any line. Currently color is only used to distinguish stdout from stderr and
to mark hyperlink lines. Having custom coloring on would mean that multiple
parts of the IDe will choose their coloring differently, thus creating UI
inconsistency in the output window.
Comment 3 Rich Unger 2005-04-18 19:01:53 UTC
I wasn't talking about hyperlinks.  I understand your concern about module
writers creating something that looks inconsistent, color-wise, with the rest of
the IDE, but as of now there's NO way for me to write out lines in different
colors, short of using the ansi terminal module (which is what I'm doing).

My use case is: I'm using the output window to simulate a conversation between a
human and a computer (think Eliza).  I want different colors for the different
parties, and a third color for system messages that may come in during the
"conversation".

Tim had told me this would be a simple thing to add.  Why not add it at the
implementation layer, even if it's not exposed all the way up to IOProvider? 
I'm just saying I'd rather use the new output2 module (instead of term), for a
number of other reasons, and this is the only thing preventing me.
Comment 4 _ tboudreau 2005-04-19 13:29:58 UTC
Vile and psycho way to implement this with no API change at all, in the editor kit class:

if (listenerForLine instanceof Color) {
   //..paint with it

...
Comment 5 _ tboudreau 2005-08-31 08:52:55 UTC
Created attachment 24387 [details]
Patch to support colored output
Comment 6 _ tboudreau 2005-08-31 08:55:22 UTC
I just attached a patch that will do this.  It doesn't create any API, but since a couple people have asked 
for this, if they want to patch their copy of core/output2 and do an implementation dependency on it, 
this will work.

How to use it:
Use the standard IOProvider way of getting an output handle.
Cast the result of either io.getOut() or io.getErr() to o.n.c.o2.LineColoredOutputWriter
Use the one method of that interface:
println (String, Color).

Enjoy...
Comment 7 _ tboudreau 2005-08-31 08:59:23 UTC
Created attachment 24388 [details]
Second diff - last one had an undeleted println() or two
Comment 8 Antonin Nebuzelsky 2008-02-07 15:52:53 UTC
Reassigning to new module owner Tomas Holy.
Comment 9 Ondrej Langr 2009-01-19 10:28:50 UTC
Any plans to implement this? This enhancement has been requested several times (see Issue #124366) during usability
studies and would be helpful for support of quick information recognition in the output window. Seems like it shouldn't
be much work since the patch is already done thanks to Tim.
Comment 10 t_h 2009-03-09 14:17:03 UTC
Fixed in core-main #b846993e69a9