Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Eclipse settings (for Java) to put brackets on the line after a method/class declaration? [duplicate]

Possible Duplicate:
Eclipse and curly braces

So basically this:

public void foo 
{
    doStuff();
}

Instead of the default, which is this:

public void foo {
    doStuff();
}

Just personal preference.

like image 872
Rishi Avatar asked Nov 25 '12 19:11

Rishi


People also ask

How do I change the format in Eclipse?

Go to Source | Format Document or press Ctrl+Shift+F.

How do I get to the closing bracket in eclipse?

To jump to the matching bracket, press Ctrl+Shift+P.

How do you change curly braces in eclipse?

The simplest and global way: Go to Window -> Preferences. Then in search put: "brace". Select -> Java -> Code Style-> Formatter After opening new window go to brace tab and change it as you prefer.


2 Answers

go to windows -> preferences -> java -> code style -> formatter

press edit and go to braces tab

choose braces style that you want for each.

  • note that if you don't have any non-built-in active profile you have to make one

hope help

like image 147
Alireza Mazloumi Avatar answered Oct 05 '22 22:10

Alireza Mazloumi


Next time when You forget where it was just type "formatter" in window>preferences. It will filter it out fast and smooth.

like image 35
Andrzej Rehmann Avatar answered Oct 05 '22 22:10

Andrzej Rehmann