Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328198

Summary: [nls tooling] NLSStringHover and PropertiesFileHover should not use HTMLTextPresenter
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: TextAssignee: Deepak Azad <deepakazad>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: daniel_megert, markus.kell.r, raksha.vasisht
Version: 3.7   
Target Milestone: 3.7 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
fix
none
Fix 2 none

Description Deepak Azad CLA 2010-10-19 22:23:04 EDT
Whitespace information gets lost in NLSStringHover and PropertiesFileHover. For example a string like "This \t string \n has \t whitespace" is simply shown as "This string has whitespace"

Both these hovers use DefaultInformationControl which in turn uses HTMLTextPresenter by default.
Comment 1 Dani Megert CLA 2010-10-20 02:23:39 EDT
Should fix for M3 since the hover is a new M3 feature which people will try out.
Comment 2 Deepak Azad CLA 2010-10-20 02:29:22 EDT
(In reply to comment #1)
> Should fix for M3 since the hover is a new M3 feature which people will try
> out.
Sure. (Note that the problem was always there in NLSStringHover)
Comment 3 Deepak Azad CLA 2010-10-22 06:08:17 EDT
Created attachment 181483 [details]
fix
Comment 4 Deepak Azad CLA 2010-10-22 06:09:30 EDT
Dani, can you please review and commit this patch. It includes a small change in o.e.jface.text
Comment 5 Markus Keller CLA 2010-10-22 13:18:14 EDT
Created attachment 181521 [details]
Fix 2

I've removed the unnecessary PropertiesFileHoverPresenter again and replaced the call to its constructor with null.

The handling of preformatted text in HTMLPrinter and HTML2TextReader is quite broken, but I don't want to change this now since we have clients that rely on the bad semantics. Ideally, HTMLPrinter#convertToHTMLContent(String) would have taken care of this, but that method was already used by clients that create HTML for a browser as well as in places where the result ends up in HTML2TextReader. I've added warnings about that problem to HTMLPrinter.

The patch also didn't render the <b> in "<b>Warning:</b> The key is missing!" any more. Fixed in NLSStringHover#toHtml(..).

I've also added 2 fixes to render constant values in Javadocs correctly.
Comment 6 Markus Keller CLA 2010-10-22 13:19:08 EDT
Committed to HEAD.
Comment 7 Raksha Vasisht CLA 2010-10-26 08:54:09 EDT
Verified for 3.7 M3 with I20101025-1800.