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
Asked
Active
Viewed 319 times
1
-
Possible duplicate of http://stackoverflow.com/questions/996646/stand-alone-java-code-formatter-beautifier-pretty-printer – Guillaume Polet May 02 '12 at 09:34
-
I replaced the title question with something that actually had some relevance to the question you actually asked. In the future, *please* make sure the title and what you ask have some relationship. – Ira Baxter May 02 '12 at 10:15
3 Answers
2
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.

Rakesh Juyal
- 35,919
- 68
- 173
- 214
-
Rakesh Juyal. Thank you for your answer. But i want to have the same results that CTRL + SHIFT + F and CTRL + SHIFT + M automatically. Because the java source code generated automatically. So the source java files will be regenerated from begin in each small changes. SO it is not possible to do CTRL + SHIFT + M for all java source files generated. i want to do that automatically. Thanks – biba May 03 '12 at 10:31
0
See our Java Formatter for a tool that handles all dialects of Java, including version 7.

Ira Baxter
- 93,541
- 22
- 172
- 341
-
i don't search a tool, i want to create a Java classe to integrate in my plugin. Thank's – biba May 07 '12 at 10:14
-
-1
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.

Deepak Azad
- 7,903
- 2
- 34
- 49
-
hte generated code change regularely. I want have an indented generated code. My technologie don't indente it so i want that this opération will be done automatiquely and in manner totaly abstract for the user. I use an AST but i don't have lot of idés. thank you very much – biba May 02 '12 at 13:28