Eclipse: Java Enum auto-completion of switch case(Eclipse:Java Enum 自动完成 switch case)
问题描述
在 Eclipse 中是否有类似 CTRL+空格的自动构造"围绕给定 Java 枚举的 switch case 的方式?我想要一个包含所有 Enum 案例的存根...
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...
推荐答案
它在 Eclipse 中已经存在很长时间了.诚然,它只是有点难找.先从
It has been in Eclipse for ages. It's admittedly only a bit hard to find. First start with
switch (myEnum) {
}
此时,您的光标通常会位于语句块 {}
内.您需要将您的光标放回带有 switch
关键字的行,然后按 Ctrl+1 并选择 Add missing case statements.这样它将插入任何可能的case
.
At that point, your cursor would usually be inside the statement block {}
. You need to put your cusror back to the line with the switch
keyword and press Ctrl+1 and choose Add missing case statements. This way it will insert any possible case
.
您会直观地期望此选项在内部语句块{}
中也可用,但不是.
You'd intuitively expect this option to be available inside the statement block {}
as well, but no.
更新:自从 Eclipse Kepler(或者可能已经是 Juno,但它太不稳定以至于我从未真正使用过它)以来,此选项终于可以通过 Ctrl 获得+1 在语句块中也是如此.
Update: since Eclipse Kepler (or perhaps already Juno, but it's so instable that I never really used it), this option is finally available via Ctrl+1 inside the statement block as well.
这篇关于Eclipse:Java Enum 自动完成 switch case的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Eclipse:Java Enum 自动完成 switch case


基础教程推荐
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 降序排序:Java Map 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01