NeoAcheron
NeoAcheron

Reputation: 111

Programmatically format and indent automatically generated source from Java

I wrote code generator that creates Java and C++ source code from custom IDL using Antlr. It works perfectly except for the Java code formatting. Currently I use Gnu Indent, but the format that it spits out is hardly readable and makes debugging a pain. I would love to use the same code formatter as NetBeans does (like when you press Alt+Shift+F) to format the generated files. What I do not want is to go through each of these files and manually pressing Alt+Shift+F. I tried using the NetBeans API, but either I am not looking in the right places or Google is being an idiot, I cannot find a proper working example to do this on files not loaded in the editor...

Can someone at least guide me towards the right direction for this?

Upvotes: 7

Views: 2128

Answers (2)

Ben
Ben

Reputation: 2255

You could use the following plugin http://plugins.netbeans.org/plugin/18365/format-files

Upvotes: 3

Harsha Hulageri
Harsha Hulageri

Reputation: 2830

Jalopy

Upvotes: 1

Related Questions