Java – Intellij IDEA, format all code in a project

code formattingintellij-ideajava

I really like IDEA's code formatting, but how do I get it to reformat all the code in a particular project without going through each file? I've found the option to tidy / optimise imports on code before committing it to subversion which is great, but it only seems to apply to files that have otherwise been modified (which is sensible in the majority of cases!)

Is there a way to auto-format all the source files in a project without going through them all by hand?

Best Answer

In the tree-structure, right click on the folder you like to reformat, choose "Reformat code" from the menu.