月蚀:开关壳体的Java枚举自动完成 [英] Eclipse: Java Enum auto-completion of switch case
问题描述
是否有自动构建围绕一个给定的Java枚举Eclipse的一个开关盒一个CTRL +空格样的方式?我想存根所有枚举的情况下...
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) {
}
在这一点上,你的光标通常会是语句块中 {}
。你需要把你的cusror回用开关
关键字和preSS <大骨节病>控制骨节病> + <大骨节病> 1 骨节病>而行选择的添加缺少的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开普勒(或者已经朱诺,但它是如此不稳定,我从来没有真正使用它),这个选项的最后的通过提供<大骨节病>控制骨节病> + <大骨节病> 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.
这篇关于月蚀:开关壳体的Java枚举自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!