Eclipse: Java Enum auto-completion of switch case

后端 未结 3 1550
遥遥无期
遥遥无期 2021-01-30 16:03

Is there a CTRL+space -like way of \"auto-constructing\" a switch case around a given Java Enum in Eclipse? I\'d like a stub with all Enum cases...

3条回答
  •  无人及你
    2021-01-30 16:34

    You can add your own code templates using: Windows->Preferences->Java->Editor->Templates.

    Once you have added a code template, type enough characters of the template name to make it unique; type CTRL+Space; and your defined code will replace the template name characters.

    The template for switch is predefined in Eclipse Galileo. sw+CTRL+Space should give you a switch statement. You might have to adapt an existing template to give you the switch-enum combination.

提交回复
热议问题