Community
Participate
Working Groups
Build Identifier: 20110916-0149 For some weird reason this setting does not work for me at all. When removing the checkbox for it, even if I put braces around a for loop manually, it still removed them. If I check it and select "Always" or "Always, except...", it still always REMOVES the braces. Checked on a clean project with no project-specific preferences. Reproducible: Always Steps to Reproduce: 1. create a new Java project 2. make a new class containing this code: public static void main(final String[] args) throws Exception { for (int i = 0; i < 10; i++) if (true) System.out.println(i); } 3. go to Eclipse Code Style>Clean Up>Edit...>Code Style, check "Use blocks in if/while/for/do statements" and select "Always". 4. save the settings, go back to the newly created class and tap Ctrl+Shift+F (or right-click and choose Source>Format). At this point it should format the IF statement and the FOR loop to have braces, but for me it doesn't do it!
Please note the difference between formatting and Clean Ups. Formatting only changes white space, whereas clean ups may also modify the actual code, which is what you need for adding braces. Can you please confirm that "Source > Clean Up ..." works as expected?
Ahh... So the Additional save actions in Editor>Save Actions are not the same as Clean Up preferences... That is weird tbh. Yes, it works.
If it is possible, I would suggest adding a drop-down list of clean-up profiles when selecting the Additional save actions. Otherwise, as you can see, it can get confusing.
(In reply to comment #2) > Ahh... So the Additional save actions in Editor>Save Actions are not the same > as Clean Up preferences... That is weird tbh. > > Yes, it works. Thanks, based on this I'm closing the bug as invalid. (In reply to comment #3) > If it is possible, I would suggest adding a drop-down list of clean-up profiles > when selecting the Additional save actions. Otherwise, as you can see, it can > get confusing. Please feel free to chime in on bug 178429 which seems to cover your suggestions.
Verified by submitter in comment# 2