Eclipse Tip: Remove Surrounding Statement

Eclipse Tip Remove Surrounding Statement

One of my previous tips from long ago is the Surround With feature. What we have today is kind of the opposite to that. It removes the surrounding statement.

Let say we have a if statement. We go to the starting or ending brace of the statement and press the magic key, Crtl + 1 or choose Edit > Quick Fix. Eclipse shows a quick fix option to remove the surrounding statement.

It is a simple feature but kind of useful if you want to remove a if statement in the middle of a complex set of nested if statements. Well I guess one should not have a complex set of nested if statements…