我想在Eclipse中使用区域进行代码折叠;在Java中怎么做到呢?
c#中的一个例子:
#region name
//code
#endregion
我想在Eclipse中使用区域进行代码折叠;在Java中怎么做到呢?
c#中的一个例子:
#region name
//code
#endregion
当前回答
只需安装并启用Coffee-Bytes插件(Eclipse)
其他回答
如果有人感兴趣,在Eclipse中,你可以一次折叠你所有的方法,当你通常插入断点时,只需右键单击,点击“折叠”>“折叠所有”。它知道这不是问题的答案,但只是提供了一种快速代码折叠的替代方案。
在语言中没有对应的…基于ide…
例如在netbeans中:
NetBeans/Creator支持以下语法:
// <editor-fold defaultstate="collapsed" desc="Your Fold Comment">
...
// </editor-fold>
http://forums.java.net/jive/thread.jspa?threadID=1311
在Mac和Android Studio上遵循以下顺序:
突出显示要折叠的源代码 按Alt +命令+ t 选择< editor-fold >
您还可以选择其他选项:
Jet Brains IDEA拥有这一功能。你可以使用热键环绕(ctrl + alt + T),这只是IDEA功能。
区域是这样的:
//region Description
Some code
//endregion
自定义代码折叠功能可以使用CoffeeScript代码折叠插件添加到eclipse。
这已被测试用于月食Luna和Juno。以下是步骤
Download the plugin from here Extract the contents of archive Copy paste the contents of plugin and features folder to the same named folder inside eclipse installation directory Restart the eclipse Navigate Window >Preferences >Java >Editor >Folding >Select folding to use: Coffee Bytes Java >General tab >Tick checkboxes in front of User Defined Fold Create new region as shown: Restart the Eclipse. Try out if folding works with comments prefixed with specified starting and ending identifiers
你也可以在这个博客上下载存档和查找步骤。