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?


你可以使用下面的插件http://plugins.netbeans.org/plugin/18365/format-files


老爷车

链接地址: http://www.djcxy.com/p/51416.html

上一篇: Web.config转换变量

下一篇: 以编程方式对Java自动生成的源进行格式化和缩进