Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Eclipse indentation style for automatically generated code?

Is there any way to change indentation style for automatically generated code in Eclipse? I'd like to change from

class Test {
blah blah
}

to

  class Test 
  {
  blah blah
  }
like image 628
AndrejaKo Avatar asked May 23 '10 12:05

AndrejaKo


People also ask

How do I fix indentation in Eclipse?

You can use Ctrl + A to select the entire file, then use this shortcut to quickly fix all the indentation. You can also change how Eclipse handles indentation by going to Window > Preferences, then in the left panel, navigate to Java > Code Style > Formatter > Edit... > Indentation.

How do I turn off auto format in Eclipse?

If you are using multi-line comments (/* */), the fix to prevent Eclipse from applying its auto-formatting is very simple: just add a dash (-) after the asterisk at the beginning of the comment (see below).


2 Answers

If you do change the format of the brace, all new class will be generated according to that new format:

brace option

like image 199
VonC Avatar answered Sep 18 '22 13:09

VonC


It's in "Window | Preferences" in the latest eclipse.

like image 45
Ted Spence Avatar answered Sep 20 '22 13:09

Ted Spence