How do I reindent all my codes in Eclipse?
Question
In most of the IDEs, I had a Reindent All command. How do I do that in Eclipse 1.2?
Edit: The commands work with Java codes but is there a way I can get it to work with Clojure?
Solution
Ctrl+Shift+F
will format all your code according to active formatting rules, this includes any indentation rules you defined (tabs/spaces, amount of those, etc...)
You can change those rules at:
- Window > Preferences
- Java > Code Style > Formatter
OTHER TIPS
Is CRTL+SHIFT+F working in eclipse 1.2 ? In 3.5 is working fine.
You can also select all the code you want to indent, and then hit CTRL + I
Eclipse is up to version 3.5 now. You might want to upgrade.
To format your code however you like, including indentation and a dozen other minute details that you might care about, you can set Formatter options (under Preferences / Java / Code Style / Formatter). You can also tell Eclipse to run the Formatter on every save, along with other rules.
TAB and SHIFT+TAB should also work for selected lines of code/text - provided your tab character is configured to be equal to your indent space count.