score:82
Under "Preferences": Java > Editor > Save Actions
1) Check "Additional actions"
2) Click "Configureā¦"
3) Go to the "Code Style" tab
4) Check "Use blocks in if/while/for/do statements" and configure to your preferences
score:-7
I usually do it by creating a code formatter by copying the built in eclipse formatter, here:
Windows > Preferences > Java > Code Style > Formatter
Select the profile that you have just created. and click on Edit and go to "Braces" tab.
Change the braces placement as you like (it's a WYSIWYG kind of editor, makes it easy) .
When I need to format, I just select all the text and Ctrl+Shift+F
and it works fine for me.
score:0
This is what I did: Eclipse -Preferences-Java-Code Style-Formatter-Edit-Braces Select next line as desired in each box then save as a different name (your choice).
score:8
In Eclipse Oxygen (2017+), that option is now at:
Window
-> Preferences
-> Java
-> Code Style
-> Clean Up
-> Edit
-> second tab "Code Style"
After changing, select the corresponding parts of your code and run the "Clean Up" option.
score:22
Yes.
Eclipse menu: Source -> Clean Up...
Configure... -> Code Style -> Use blocks in if/while/for/do statements.
Source: stackoverflow.com
Related Query
- How to make eclipse automatically add braces to an IF statement?
- How to make eclipse automatically add spaces between operators and operands?
- How do I get eclipse to automatically add a semicolon?
- How to make Eclipse (pydev) automatically fold all comments when opening a file?
- how to automatically add a new file to SVN in eclipse
- how to add a tool to eclipse-cdt to automatically generate a header file during make
- How to make Eclipse generate OSGi Declarative Services Bundle Component XML automatically with bnd annotations?
- How to format java code automatically to add braces
- How to make Eclipse debugging automatically jump to line being debugged
- How can I make it so Eclipse automatically updates my code in a window as I edit it?
- How to make Eclipse jump back automatically to development prespective when app that was debugged finished?
- How to make Eclipse to automatically free the port after stopping the application?
- How can I add sql statement in C/C++ Eclipse Editor?
- How to make eclipse formatter keep while statement on same line?
- How can I make sure Eclipse automatically detects XML files?
- How to make Eclipse automatically show selected file in explorer?
- How to make eclipse validate jsp files automatically
- How to make default indentation for parenthesis the same as for braces in Eclipse in Java?
- How to add external jars in eclipse oxygen, so that they are automatically available to all other projects?
- how do I make eclipse not add javadoc tags in new method comments?
- Why does Eclipse automatically add appcompat v7 library support whenever I create a new project?
- How do you stop Console from popping up automatically in Eclipse
- How to add native library to "java.library.path" with Eclipse launch (instead of overriding it)
- How to make Eclipse behave well in the Windows 7 taskbar?
- How to make an existing directory into an eclipse project
- How to make Eclipse prompt me for command line arguments
- How can I add a default header to my source files automatically in Eclipse?
- How to make eclipse "File Search" to also search inside source jars containing some text?
- Very slow Eclipse 4.2, how to make it more responsive?
- How can I make Eclipse file search not include svn directories?
More Query from same tag
- How do I create shapes and place them in any positions with <hr>?
- Why does Eclipse not recognize the build() method from the Notification.Builder class to return a Notification object?
- Eclipse does not seem to recognize Native Android code
- Android Eclipse ADT Code Errors when starting new Android Project
- What is the directory of the current workspace in Eclipse
- Attach sources not working in ScalaIDE
- Algotrader open source project not recognized as java project in eclipse
- Eclipse: Info: Nothing to build for [Project Name]
- Android app Activities
- Eclipse 4 RCP (aka E4) documentation
- Why Eclipse run web app on localhost port 13405?
- How to undo Mark goal run as ignored in Eclipse build in Eclipse preferences?
- How can I find all bugs that have been fixed in an Eclipse release?
- java: NullPointerException, need help
- How to export an Eclipse Database (JDBC) project and make it executable on user's pc?
- Add seleniumlibrary prefix to keyword call issue
- Opening Java enum method declarations in Eclipse
- Xdebug ignores breakpoints
- Eclipse C/C++ Console behaving strangely
- Navigation drawer using text and icon
- Hadoop V2.7 and Eclipse
- Make eclipse save an XML file after undoing all its changes?
- Moving a grails project to use greclipse
- Symfony2 Eclipse plugin, so hard to get it working?
- Change user agent in Eclipse 3.5 for new software installations
- Why is the AbstractApplicationContext throwing NoClassDefFoundError for LogFactory?
- Changing Eclipse's server IP address
- display result sql in columns
- how to use bootreciever to set wallpaper after restarting device? (android, eclipse)
- Renesas -- cannot get I/O to work except onboard LED