Eclipse:Java Enum自动完成开关盒 [英] Eclipse: Java Enum auto-completion of switch case

查看:131
本文介绍了Eclipse:Java Enum自动完成开关盒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个CTRL +类似空间的方式在Eclipse中自动构建一个关于给定Java Enum的开关环境?我想要一个具有所有枚举例子的存根...

解决方案

它已经在Eclipse年龄了。诚然,只有一点难以找到。首先从

  switch(myEnum){

}

在这一点上,你的光标通常位于语句块 {} 之内。您需要将cusror放回到开关关键字的行,然后按 Ctrl + 1 ,然后选择添加缺少的案例语句。这样就可以插入任何可能的案例





你直观地希望这个选项可以在语句块 {} 内部可用,但是没有。




更新:从Eclipse开普勒(或者也许已经是Juno,但是它是如此不稳定我从来没有真正使用它),这个选项通过 Ctrl + 1 可以在语句块中使用。




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...

解决方案

It has been in Eclipse for ages. It's admittedly only a bit hard to find. First start with

switch (myEnum) {

}

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.


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自动完成开关盒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆