Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans: Java: Shortcut for creating all cases in a switch

Is there any shortcut to immediately create (for one enum) all cases in a switch case statement?

like image 682
pedjjj Avatar asked Mar 24 '26 01:03

pedjjj


1 Answers

To keep the answer short: there's none (yet).

Feel free to file a feature bug at netbeans.


However, there are some helpers:

  • Case template: Within the switch, type cs + <TAB> to generate a case template, including break and a ready-to-type case-value.
  • Switch/Case template: Type sw + <TAB> to generate a switch/case template. It doesn't generate cases for all enum values, but in addition to the case template it reduces the effort a lot!

You can find all temples at: Tools -> Options -> Editor -> Code Templates.

Maybe you can write even a template to generate a switch/case for all enum values.


Update

Feature announced for Netbeans 8.1.

like image 64
ollo Avatar answered Mar 26 '26 14:03

ollo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!