Re: Invoking the 'File/Print To HTML' feature (org.netbeans.modules.editor.ExportHTMLAction.class)
Boris Heithecker <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <CAL465RGvfCRUgJnHYiPehkwxYJtG8zcprnxbh6j=u5cTgP=kVA@mail.gmail.com> |
Hi, it's in org-netbeans-modules-editor. The problem seems to be that there is no straight way to decouple a useful feature (translating the contents of an editor to html) from the actual action, which displays a customization dialog. The problem is private an final methods. Here is an ad hod workaround (I hope nobody complains because most of the code is copied). It's a single class: <goog_20168380> https://github.com/borisheithecker/customexporthtml It'a little bit nasty because it uses java reflection. Within this class, it should be possible to adapt the dialog to your own needs. Hope it helps, Boris 2016-10-12 21:39 GMT+02:00 Oliver Rettig <[email protected]>: > Hi, > > I am also interested in an export-to-html action but I can not find the > existing exportHTMLAction. Which module I have to add in my application to > see > this action? > > What are the problems with the existing action? > > best regards > Oliver > > > Hello, > > > > first of all: interesting project, i'm working on software for > > teachers/schools too. > > > > Some time ago I tried to somehow reuse the ExportHTMLAction for my own > > project too, but I was not lucky with it. > > I'm sure you'll have to implement your own export-to-html-action. An easy > > way should be to extend the existing ExportHTMLAction, > > override performAction(Node[] activatedNodes) and skip the dialog, but > for > > whatever reason this method is final. Another option is implementing a > new > > action by mostly copying, adapting and delegating to the original action. > > > > I've just tried it out and it works in my development IDE, but I'm not > sure > > if I'm allowed to publish it on github as 95% of the code is copied from > > the netbeans sources. > > > > Boris > > > > 2016-10-11 17:46 GMT+02:00 <[email protected]>: > > > To give everyone the basic idea of what I am trying to do, I will give > > > a brief summary of the plugin I am attempting to create. > > > > > > ~~~~~~~~~~~~~~ > > > Project Summary: > > > ~~~~~~~~~~~~~~ > > > > > > My plugin will allow an instructor to markup a student's homework > > > assignments (as in, their code), making it as effortless as possible to > > > give feedback by the instructor to the student on any mistakes they > > > make, without needing to actually make physical changes (I.E: Adding > > > comments, or printing out the code and physically markup the > > > assignment... believe it or not, but this is still done at my > > > University). > > > > > > The Plugin itself needs to create a Read-Only copy (and hence the need > > > for the Print to HTML feature) and allow the instructor to markup said > > > assignments (the details I will leave out, as they are irrelevant). > > > > > > > > > ~~~~~~~~~~~~~ > > > Current Solution: > > > ~~~~~~~~~~~~~ > > > > > > My current approach to this problem is to use a library that converts > > > Java to HTML, aptly named 'Java2HTML'... the issues with the generated > > > HTML aside, the plugin will need to work for any and all languages, and > > > so this library is insufficient. I also do not want to rely on network > > > API calls to do this for me (such as 'hilite.me') and such I want this > > > to work offline as well. > > > > > > > > > ~~~~~~~~ > > > Research: > > > ~~~~~~~~ > > > > > > By research, I mean I will establish, at least to the best of my > > > ability, that I didn't just "immediately jump to the mailing list > > > without doing any research first". I'll admit that I probably could > > > have done more research, but considering that said research would > > > require me to understand the entirety of the NetBeans API, as well as > > > reading the Source Code to see how it is normally done... well, I > > > figured I should attempt to get some guidance first (as time is a > > > relative constraint). > > > > > > > > > I have looked at the XML Layer file to find out what gets invoked when > > > the user attempts to select 'Print To HTML'. This leads to > > > 'org.netbeans.modules.editor.ExportHTMLAction' class, which while it > is > > > public, it's methods are either private or protected, meaning I have > > > have no access to it directly. > > > > > > > > > > > > ~~~~~~~~~~ > > > What I Need: > > > ~~~~~~~~~~ > > > > > > A way to invoke the ExportHTMLAction without the actual dialogue, > > > pretty much specifying that the currently selected file is what should > > > be 'Printed', and as well telling it precisely WHERE to print it. For > > > example, the current file, 'test.java' or 'example.cpp' should print to > > > 'generated_html/test.java.html' and 'generated_html/example.cpp.html' > > > respectively. > > > > > > Is something like this possible? If not, is there a way I can simulate > > > this functionality myself without needing to build my own > > > <Language>2HTML library myself? > > > > > > > > > This is my first time posting on this mailing list, and in fact on any > > > mailing list, so please let me know if I make any mistakes in my posts, > > > and I will proceed to correct it. Thank you for your time. > > > -- Boris Heithecker Dr. Boris Heithecker Lüneburger Str. 30 28870 Ottersberg Tel.: 0 42 05/ 31 58 34