I use many brackets and braces when I code. Be it casting multiple times, casting multiple times in if blocks, etc. I sometimes get lost in the brackets and also, hate putting a lot of them. Is there any short-cut key to format this selected part of code? I have tried Ctrl-Shift-F, but that doesn't give me what I want. Note: I work on Eclipse Mars.
What you want is Source
menu | Cleanup
, then customize the profile to add the remove extra parenthesis. From the Code Style
tab check the Use parenthesis in expressions
Only if necessary
. And then complete the wizard:
That changes:
super.start(((BundleContext)(context)));
to:
super.start(context);
As an extra you can set your project to do code cleanup tasks on save automatically if you desire.