Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Hacking the NetBeans IDE – 4. Changing the way NetBeans IDE Local History works

1 min read

To help us prepare for our talks for our talks at Oracle CodeOne – “Writing Better Code (Faster) in the Apache NetBeans IDE [BOF4759]” and “Hacking the NetBeans IDE [BOF4760]”, we have been writing some blog posts on NetBeans. We hope you find them useful…

Extending Local History in NetBeans IDE

One of my pet hates on NetBeans IDE is that you cannot get a local history on multiple files. I do not like the way it is commented out if you select multiple files like this…

I think it would be much cooler if it could open all the files selected like this….

As Steve Jobs might say, “fix it” and now that you can.

Making Local history accept multiple files

The NetBeans platform provides a very modular code base which does most of the hard work for you. It just needs code added to call back when you want something to happen. Extensive use is made of Annotations to reduce code needed and the code is cleanly split out into Actions, Views, etc.

The Show Local History function is controlled by the ShowHistoryAction.java class. It contains two sections of interest to us. The enable function is called by NetBeans to determine when the menu option is enabled or disabled. Currently it is setup to reject anything which is not a File or more than one file. We can easily change this with the additional code.

The action is still expecting to be given a single file so we also need a little bit of code to handle the multiple files selected. For the moment, we will just open them all in a new window each.

Notice how little actual code I have written to implement this. I am just reusing existing NetBeans functionality.

We could easily hack this code to recursively open directories and all manner of new features. But Steve Jobs also believed in leaving the audience wanting more, so we will stop there for this instalment…

 



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Creating a WordPress Plugin Part 3: Adding Shortcodes

Recently, I’ve been working on a proof of concept project which integrates our JPDF2HTML5 web service with the popular blogging platform WordPress. This series of...
Simon Lissack
1 min read