Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the code convention in Eclipse

I like to use curly brackets in this fashion

void hello()
{
    code();
}

When I press Ctrl + Shift + F in Eclipse it changes everything to

void hello(){
    code();
}
like image 272
code511788465541441 Avatar asked Dec 17 '10 12:12

code511788465541441


People also ask

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.


1 Answers

Window/Preferences/Java/Code style/Formatter view:

Create a new profile based on the eclipse built in, then go to braces tab and change "same line" to next line everywhere. Then set the new profile to default.

like image 72
Gábor Lipták Avatar answered Oct 11 '22 23:10

Gábor Lipták