用于折叠/展开方法的 NetBeans 快捷键
这是一个 IDE 问题,
我总是使用折叠方法,因为我希望能够一起查看我的方法。这有点耗时,因为我必须使用鼠标向上滚动到方法的声明,然后单击 -(减号)图标。然后分别转到我想要处理的方法并单击+(加号)图标。
有没有办法通过键盘快捷键来折叠(以及分别展开)?
This is an IDE question
I am always working with collapsed methods, because I want to be able to see my methods all together. This is a little time consuming because I have to use the mouse to scroll up to the declaration of the method and click on the - (minus) icon. And then respectively go to the method I want to work on and click on the + (plus) icon.
Is there a way through a keyboard shortcut to do the collapse (and respectively the expand)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我从 http://wiki.netbeans.org/KeymapProfileFor60 复制了一段内容。
第一个选项适用于 Win/Lin,第二个选项适用于 Mac。
1 在 Windows 上,您还可以使用数字键盘 + 和 -
2 它显示 +,achkatually 它是 = 键
I copied a piece from http://wiki.netbeans.org/KeymapProfileFor60.
The first option is for Win/Lin and the second for Mac.
1 On Windows you can also use the numpad + and -
2 It says +, achkatually it's the = key
只是为了提供替代方案,您是否考虑过使用导航器视图在成员内导航?我通常只是将所有方法保持未折叠状态,然后双击导航器视图中的方法以转到该方法。导航器视图的优点是提供了方法和字段的类型和可见性的视觉指示符的图标。
Just to offer an alternative, have you considered using the Navigator View to navigate within the members instead? I usually just leave all methods uncollapsed, and double click on the method in the Navigator view to go to that method. What's nice about the Navigator View are the icons which provide visual indicators of the type and visibility of methods and fields.
右键单击窗口 ->代码折叠 ->全部折叠或Ctrl+Shift+减号
听起来像你正在寻找的东西
Right click the window -> Code Folds -> Collapse All or Ctrl+Shift+Minus
Sounds like what you ar looking for
到目前为止,我发现的最好的解决方法是右键单击文件树旁边的空白区域,然后单击“全部折叠”
The best workaround I've found sofar is to right-click in the white space next to the file tree and then click on "Collapse All"
在netbean工具中设置默认折叠
单击工具->选项->编辑器->折叠,启用复选框
To set default collapsing in netbean tool
click Tools->Option->Editor->Folding, enable checkboxes
导航器视图不显示循环块、逻辑块等。因此无法折叠“if this”下的该部分,以便您可以专注于“else that”部分。
NetBeans 仅支持折叠函数/方法 (Java) 或基于 XML 格式注释字符串的折叠(这是一个糟糕的解决方案,特定于 IDE,并且会在代码中留下 IDE 的痕迹)。
The navigator view does not show loop blocks, logic blocks, etc. So there is no way to collapse that section under the "if this" so you can focus on the "else that" section.
NetBeans only supports collapsing functions/methods (Java) or collapsing based on their XML formatted comment strings (a terrible solution that is IDE specific and leaves traces of your IDE all over your code).