Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 225439 - Maven output colors are hardcoded.
Maven output colors are hardcoded.
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Output Window
7.3
PC All
: P3 (vote)
: 7.4
Assigned To: Jaroslav Havlin
issues@platform
: API_REVIEW_FAST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-29 03:02 UTC by venkatramakkineni
Modified: 2013-05-04 01:47 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Maven output colors image (17.46 KB, image/png)
2013-01-29 03:02 UTC, venkatramakkineni
Details
Attachment contains code that exposes the maven output colors for customization. (8.48 KB, patch)
2013-01-29 03:03 UTC, venkatramakkineni
Details | Diff
Proposed Patch (59.19 KB, patch)
2013-04-26 09:34 UTC, Jaroslav Havlin
Details | Diff
Changes in I/O APIs (2.65 KB, patch)
2013-04-26 09:35 UTC, Jaroslav Havlin
Details | Diff
Changes in Maven Projects API (2.54 KB, patch)
2013-04-26 09:37 UTC, Jaroslav Havlin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description venkatramakkineni 2013-01-29 03:02:22 UTC
Created attachment 130753 [details]
Maven output colors image

Maven output colors are hardcoded. This makes the output obscure on custom LNFs
Comment 1 venkatramakkineni 2013-01-29 03:03:33 UTC
Created attachment 130754 [details]
Attachment contains code that exposes the maven output colors for customization.
Comment 2 Milos Kleint 2013-01-29 08:28:02 UTC
thank you for the patch, since you have the Contributor agreement signed, I've applied it straight away.
Comment 3 Milos Kleint 2013-01-29 08:28:13 UTC
https://hg.netbeans.org/core-main/rev/01ece7bb9008
Comment 4 Milos Kleint 2013-01-29 11:24:10 UTC
on second thought, it appears that output windows has it's own configuration when it comes to colors in Tools/Misc/Output. With the patch applied, the changed colors in tools don't appear to change in maven output, but they do in ant (and they do in maven for old builds without your patch)

I will have to revert the patch.
Comment 5 Milos Kleint 2013-01-29 12:00:16 UTC
reverted: https://hg.netbeans.org/core-main/rev/430d95150400

not a defect, works more or less as designed. reassigning to output window for evaluation
Comment 6 venkatramakkineni 2013-01-29 15:33:34 UTC
Milos 

Thanks for the quick turnaround. Maven module doesn't use the colors in the Tools/Options/Misc/Output. If you look at the code, the colors are hardcoded prior to the patch. I think the patch is still valid. Please look at the AbstractOutputHandler Class to see how Color.Red is hardcoded for Error Logging level. Also, if you try maven without the patch applied and colors changed in tools/Misc/output, you will not see the colors changed.

I don't see tools/misc/output in 7.2.1, I am guessing this must be a new feature in 7.3beta. Do you know if there is a work planned to add the maven colors to the tools/misc/output.

 Your thoughts..
Comment 7 Jaroslav Havlin 2013-01-29 15:50:58 UTC
(In reply to comment #6)
> Thanks for the quick turnaround. Maven module doesn't use the colors in the
> Tools/Options/Misc/Output. If you look at the code, the colors are hardcoded
> prior to the patch. I think the patch is still valid.
I also think that the patch should still be valid. I'll check it.

> Please look at the AbstractOutputHandler Class to see how Color.Red is 
> hardcoded for Error Logging level. Also, if you try maven without the patch 
> applied and colors changed in tools/Misc/output, you will not see the colors 
> changed.
In tools/Misc/output, only a few standard colors can be configured. Customized colors that are set by Output Window clients (e.g. Maven Support) are not modified.

> I don't see tools/misc/output in 7.2.1, I am guessing this must be a new
> feature in 7.3beta.
Yes, it is new in 7.3.

> Do you know if there is a work planned to add the maven
> colors to the tools/misc/output.
No such work is planned. I even think that it should not be there (Output Window should not be required to understand Maven or to depend on it).

Milos, please, any ideas?

Thank you.
Comment 8 Milos Kleint 2013-01-29 16:28:59 UTC
The majority of output will be modified by Tools/output (hyperlinks, regular output, background etc)
if some of the entries are not available via API, we have to hardcode them, yes.

The problem with standard error output is that it assumes 2 independent streams, but for maven output we mostly have just one stream and printing a line here and another one there is error prone. So we hardcode the color and print to stdout. If there's a standard way that would map to the default color from the Tools/Options I'm happy to use it.
same with gray output for debug messages etc.

the UIManager keys like "nb.output.error.foreground",  how are they related to the values shown in Tools/Options? are they invented on the maven support level? 

BTW: as an experiment, I've changed all foreground color to green in Tools/Options.  neither Ant nor Maven output complied 100%. So the issue is not entirely related to maven only but needs to be handled in a general way, allowing at least to share some UI keys. However there will always be a conflict between someone tweaking the UI from PLAF level and from UI level. Unless UI exposes all coloring settings somehow..


(In reply to comment #7)
> (In reply to comment #6)
> > Thanks for the quick turnaround. Maven module doesn't use the colors in the
> > Tools/Options/Misc/Output. If you look at the code, the colors are hardcoded
> > prior to the patch. I think the patch is still valid.
> I also think that the patch should still be valid. I'll check it.
> 
> > Please look at the AbstractOutputHandler Class to see how Color.Red is 
> > hardcoded for Error Logging level. Also, if you try maven without the patch 
> > applied and colors changed in tools/Misc/output, you will not see the colors 
> > changed.
> In tools/Misc/output, only a few standard colors can be configured. Customized
> colors that are set by Output Window clients (e.g. Maven Support) are not
> modified.
> 
> > I don't see tools/misc/output in 7.2.1, I am guessing this must be a new
> > feature in 7.3beta.
> Yes, it is new in 7.3.
> 
> > Do you know if there is a work planned to add the maven
> > colors to the tools/misc/output.
> No such work is planned. I even think that it should not be there (Output
> Window should not be required to understand Maven or to depend on it).
> 
> Milos, please, any ideas?
> 
> Thank you.
Comment 9 venkatramakkineni 2013-01-29 18:06:46 UTC
I would have to look at your comment at leisure and I will. But on the surface, maven colors are typical logging colors and the output colors are something netbeans uses. We could expand the output color set by including the logging level colors. We could then use the logging level colors inside maven module.  This way any plugin who wants to log can use these colors. Your thoughts ...
Comment 10 Quality Engineering 2013-01-30 03:41:20 UTC
Integrated into 'main-golden', will be available in build *201301300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/01ece7bb9008
User: Milos Kleint <mkleint@netbeans.org>
Log: #225439 avoid hardcoding colors in maven output, patch provided by  venkatramakkineni@netbeans.org
Comment 11 Jaroslav Havlin 2013-02-08 07:37:32 UTC
(In reply to comment #9)
> Maven colors are typical logging colors and the output colors are something
> netbeans uses. We could expand the output color set by including the logging
> level colors. We could then use the logging level colors inside maven module. 
> This way any plugin who wants to log can use these colors. Your thoughts ...
I agree this is the right solution. Thanks.
Comment 12 Jaroslav Havlin 2013-04-26 09:34:32 UTC
Created attachment 133838 [details]
Proposed Patch

Full patch. Changes in Ant, Maven Projects, I/O APIs and Output Window.
Comment 13 Jaroslav Havlin 2013-04-26 09:35:51 UTC
Created attachment 133840 [details]
Changes in I/O APIs
Comment 14 Jaroslav Havlin 2013-04-26 09:37:17 UTC
Created attachment 133841 [details]
Changes in Maven Projects API
Comment 15 Jaroslav Havlin 2013-04-26 09:47:20 UTC
Please review API changes in module I/O APIs (openide.io, public API) and in module Maven Projects (maven, friend-private API).

The patch can be applied over patch for bug 228480, in branch output_folding_208022 in repository core-main.

(If you are not interested in all changes, you can check attached diffs containing only relevant changes in the API.)

Thank you in advance.
Comment 16 Jaroslav Havlin 2013-05-02 12:58:34 UTC
If there are no objections, I'll integrate the patch tomorrow morning.
Thank you for reviewing.
Comment 17 Jaroslav Havlin 2013-05-03 08:15:29 UTC
Integrated as http://hg.netbeans.org/core-main/rev/33d52f118356
Comment 18 venkatramakkineni 2013-05-03 14:38:22 UTC
Thanks a million jhavlin. I looked at the code and it is doesn't seem like it is a breaking change for me. Great work and thanks for the relatively quick turnaround even though this change might not be a priority for the core netbeans development.
Comment 19 Quality Engineering 2013-05-04 01:47:15 UTC
Integrated into 'main-golden', will be available in build *201305032300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2f2b0132b1f6
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #225439: Maven output colors are hardcoded


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo