0

So I just discovered the amazing use of Ctrl+Shift+F to format my code after nearly three years of using Eclipse and am wondering if I can change it to remove the space after formatting an if/for statement as such:

From this:

if (i == 1) {
    //do something else
} else {
    //do something
}

To this:

if(i == 1) {
    //do something else
}
else {
    //do something
}

I looked all over the Eclipse format area and saw nothing to edit this.

  • Window > Preferences > Java > Code Style > Formatter > Edit... > White Space > Control statements > 'if else' > before opening parenthesis – shmosel Jun 20 '17 at 02:52
  • You need to make a new profile in Window > Preferences > Java > Code Style > Formatter. Base it on one of the built-in ones, then edit the settings you need to. – Dawood ibn Kareem Jun 20 '17 at 03:02

0 Answers0