ReShaper can automatically recognize if
states on enums and offer to convert them to switch
statements (or back). (Of course, this can only happen
For sake of completeness, the option Convert 'if-else' to 'switch'
is shown by having the cursor e.g. on the if
and then pressing the quick-assist command (Ctrl + 1
).
Eclipse can convert switch statements to if-else but not the other way around. There is already a bug open to provide a "Convert 'if-else' to 'switch'" quick assist, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=348179
Update: The bug has been fixed, Starting 4.3 Milestone 1 Eclipse will support converting if-else statements to switch statements.