How to trigger intention for if-else if to switch

I have the intention enabled that is supposed to convert an if-else if statement to a switch statement; however, I can't figure out how to trigger it. I have tried pressing alt-enter on various places on the if statement (including on the if itself) but the intention just won't popup in the the intention dialog. The only one that pops up is "Invert If condition".

How do I trigger converting if-else if to switch?

Screen shot 2011-04-13 at 10.56.40 AM.PNG

Comment actions Permalink

Hi Michael,

Just tried that with the latest 10.5 EAP - works fine, i.e. 'if' is highlighted and I have the option to transform it to switch when I put cursor on it and press <enter>:

1. Put cursor on 'if':

2. Press Alt+Enter:


Comment actions Permalink

My conditionals are enums compared with the equals() method. I am going to change it to use == to see if that makes a difference. Or to see if using an enum is the problem.

I will do some testing...


Please sign in to leave a comment.