views:

406

answers:

4

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?

+4  A: 

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
Yuval A
Damn that didnt work with Clojure. Thanks anyway
kunjaan
I think you have to consult the clojure plugin provider ;) clojure-dev has formatting on the roadmap but not yet implemented
Andreas_D
+2  A: 

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.

matt b
+3  A: 

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

Antoine Claval
A: 

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.

dls