1

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

2
  • Possible duplicate of stackoverflow.com/questions/996646/… Commented May 2, 2012 at 9: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. Commented May 2, 2012 at 10:15

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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
0

See our Java Formatter for a tool that handles all dialects of Java, including version 7.

2 Comments

i don't search a tool, i want to create a Java classe to integrate in my plugin. Thank's
Call the tool from your plugin.
-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.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.