Teddy
Teddy

Reputation: 1022

invert if statement in eclipse

I develop in C++. I know JetBrain's function "invert if statement" to swap the if block with the else block and also swap the condition. It there a way to do the same in eclipse?

Upvotes: 1

Views: 693

Answers (2)

Michael Zilbermann
Michael Zilbermann

Reputation: 1428

It is possible with Eclipse through "quick fix" operation : select the if keyword and conditions then Ctrl+1 and select "Invert Conditions". Example here https://veerasundar.com/blog/2012/10/eclipse-refactoring-on-steroids/#4-invertingifstatement

Upvotes: 3

Arcanefoam
Arcanefoam

Reputation: 727

Not as part of the default refactor methods in Eclipse. You could try to write your own refactor plugin to add the functionality (look at this answer), but that might be too much hassle.

Upvotes: 0

Related Questions