Often I have wanted to save Java or other languages as html. There are several tools online that does this, but many are commercial and they are cumbersome to use (you often have to cut and paste the java into a webpage).
So I figured, Eclipse has the style information needed, why not just extract it and generate HTML directly from Eclipse editors.
The HTML is stored in a file and also in the clipboard. You can cancel the save file action and the HTML will still be stored in the clipboard. It will use your exact settings including font settings, formatting and colors.
How to make your editor work with htmlSave:
The plug-in can work with any text editor in Eclipse, but it needs to know how to get a hold of the StyledText widget in it. This is done by using an extension point HtmlSave.sourceViewerFinder. An example of one of one of these extensions is the java class exampled above.
Version 1.1 of htmlSave has gotten a little "smarter" and works with more editors than before, but it still might not be able to find the style information needed. Also, if you extend IAdaptable and return the StyledText widget when asked for it, that works as well.
Know click for more information.
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: March 3, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles