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.


Need Your Help

Regex to escape question mark from URL using java/ tuckey URL rewriter

java mod-rewrite url-rewriting

I'm trying to use tuckey URL rewriter and java to redirect all URLs with a certain request parameter. So for example I'd like to convert all of the following:

How do I keep all sub-menu items open at once?

javascript jquery slidetoggle slidedown fadeto

I'm going to do my best to articulate this, hopefully it's clear.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.