Bug 241896 - [api] Make HTML2TextReader API
Summary: [api] Make HTML2TextReader API
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P5 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, helpwanted
: 265997 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-23 19:28 EDT by Alex Fitzpatrick CLA
Modified: 2018-01-27 22:30 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Fitzpatrick CLA 2008-07-23 19:28:55 EDT
Build ID: 3.4GA

org.eclipse.jface.internal.text.html.HTML2TextReader has been replicated as: 

 - org.eclipse.pde.internal.ui.editor.contentassist.display.HTML2TextReader
 - org.eclipse.wst.sse.ui.internal.derived.HTML2TextReader

And while it is in an internal package, that package has been made available to a large number of "friends" and is used directly in a number of places including JDT.

It would be logical to either refactor this as public API or provide a public interface/factory etc.

This would have a number of benefits:

  - the first being the number of friends could probably be reduced 
  - the duplicate (and likely of date) classes could be eliminated
  - new consumers would have access to the API without violating bundle export rules

This would also allow us to easily meet a customer request for better presentation of HTML formatted documentation in UML models.

(Would be nice to have for 3.4.1 to meet product requirements, but more essential for later.)
Comment 1 Dani Megert CLA 2008-07-30 06:14:03 EDT
How/where do you display HTML? Maybe you could use org.eclipse.jface.text.DefaultInformationControl.DefaultInformationControl(Shell, boolean) which internally uses the reader.
Comment 2 Alex Fitzpatrick CLA 2008-07-30 11:16:07 EDT
We actually want it for its ability to create (at least partially) formatted
plaintext from HTML input. I could not see how to do that with
DefaultInformationControl. 

Perhaps there is a way and I just missed it?
Comment 3 Alex Fitzpatrick CLA 2008-07-30 11:18:14 EDT
Also... me simply using the other class does not address the issue of duplicated code. Clearly that class does something useful that people need.
Comment 4 Dani Megert CLA 2008-07-30 12:18:51 EDT
>Also... me simply using the other class does not address the issue of
>duplicated code. Clearly that class does something useful that people need.
In my opinion that duplication wasn't needed (will check that).

What exactly are you trying to do?
Comment 5 Alex Fitzpatrick CLA 2008-07-30 13:25:32 EDT
We're trying to display a plaintext equivilant of an HTML fragment, mostly in diagrams.
Comment 6 Dani Megert CLA 2008-07-31 02:46:10 EDT
>We're trying to display a plaintext equivilant of an HTML fragment, mostly in
>diagrams.
OK, so it's not inside a hover? The reason why we don't make this API is because it is only supports a very small subset of HTML (the one for simple rendering of Javadoc). Also, we got away from using this by showing the HTML directly inside the Browser widget. This gives much better HTML rendering. Wouldn't that also work in your case?
Comment 7 Alex Fitzpatrick CLA 2008-07-31 12:05:33 EDT
We are unable to embed the browser control in a GMF diagram (or so I've been told).

Found another copy in the Ruby tooling:

http://www.koders.com/?s=HTML2TextReader&la=*&li=*
Comment 8 Dani Megert CLA 2008-08-01 07:11:06 EDT
>(or so I've been told).
Why?

>Found another copy in the Ruby tooling:
Well, just because you found a copy doesn't mean it is used right and doesn't mean that they are aware of all its limitations.
Comment 9 Dani Megert CLA 2008-08-01 07:13:52 EDT
Could you check if you could use the Browser widget? Because even if we made the current class API it would probably not fit all your needs (i.e. handle all your HTML tags). Also, assuming you can't use the Browser widget: would it work to use the (yet internal) org.eclipse.jface.internal.text.html.HTMLTextPresenter?
Comment 10 Dani Megert CLA 2008-08-11 10:25:41 EDT
Ping.
Comment 11 Alex Fitzpatrick CLA 2008-08-11 12:05:17 EDT
I'm a little busy trying to ship a product... I'll try to give you a full response before the end of the week.

However, there is no way we'll be embedding one or more browser controls in a diagram.
Comment 12 Dani Megert CLA 2008-08-11 12:08:41 EDT
OK, next week would also be good enough.
Comment 13 Dani Megert CLA 2008-08-13 06:15:06 EDT
To be disposed or fixed during 3.5.
Comment 14 Chris Aniszczyk CLA 2008-10-06 14:24:22 EDT
PDE's also interested in this as we use this class:

org.eclipse.pde.internal.ui.editor.contentassist.display.HTML2TextReader
org.eclipse.pde.internal.ui.editor.contentassist.display.BrowserInformationControl
Comment 15 Dani Megert CLA 2009-01-06 12:12:23 EST
We looked at this and came to the conclusion to not make this API at this point. The reason is that our reader is very limited and explicitly fit to our internal needs i.e. only supports those tags we actually need. We don't want to make that state API and we don't have the resources to work on a full blown HTML2Text reader.

If someone wants to contribute a complete HTML2TextReader along with test cases we are open for it.
Comment 16 Dani Megert CLA 2009-02-25 03:09:02 EST
*** Bug 265997 has been marked as a duplicate of this bug. ***
Comment 17 Dani Megert CLA 2009-07-16 02:02:12 EDT
>PDE's also interested in this as we use this class:
>
>org.eclipse.pde.internal.ui.editor.contentassist.display.HTML2TextReader
>org.eclipse.pde.internal.ui.editor.contentassist.display.BrowserInformationControl
The latter is covered by bug 218482.