How to nicely format generated Java code
I am looking for a way indent the java source code automatically. I have a tool which generates java code from other language. Now, I want to indent the generated code. Please tell me how can I do that? in an other maner, how can i do exactely what ctl+shift+m do automatiquely? i can not use CTRL + SHIFT + F and CTRL + SHIFT + M
Answers
As your tag says, you are using Eclipse , you can use CTRL + SHIFT + F to indent the code.
Moreover as you are asking about replacing fully qualified name to import statement then no such thing exists in Eclipse as of now. ( Correct me if I am wrong ).
But you can still select the fully qualified name and press CTRL + SHIFT + M to import the class.
See our Java Formatter for a tool that handles all dialects of Java, including version 7.
You can select a project/folder/package in Package Explorer and format all the contents in one go using Source > Format (Ctrl+Shift+F). Or you can also configure a Clean up or a Save Action.