开发者

How do I change the code convention in Eclipse

开发者 https://www.devze.com 2023-01-31 06:27 出处:网络
I like to use curly brackets in this fashion void hello() { code开发者_C百科(); } When I press Ctrl + Shift + F in Eclipse it changes everything to

I like to use curly brackets in this fashion

void hello()
{
    code开发者_C百科();
}

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

void hello(){
    code();
}


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.


Window -> Preferences -> Java -> Code Style -> Formatter -> Braces


Window > Preferences > Java > Code Style > Formatter


In Eclipse, go to Windows -> Preferences -> Java -> Formatter. Choose the Formatter you have. Click on Edit... Go to Tab "Braces". Change as suitable.


In Eclipse, go to Windows -> Preference -> Java -> Formatter. In Active Profile drop down box, select any profile, click Edit on right of it. In Profile Dialog box opened, you can change a lot of things like Indentation, New Line, Braces, White Spaces etc. Alternatively, if your profile is altogether different than standard one, Create a new active profile and then edit it accordingly.

:)

0

精彩评论

暂无评论...
验证码 换一张
取 消