NetBeans shortcut key for collapsing/expanding a method

百般思念 提交于 2019-11-29 20:16:20
Peter Tillemans

I copied a piece from http://wiki.netbeans.org/KeymapProfileFor60.

The first option is for Win/Lin and the second for Mac.

Collapse (hide) a block                     Ctrl + Minus                 Cmd + Minus
Collapse (hide) a block                     Ctrl + NumPad Minus     
Collapse (hide) all code blocks             Ctrl + Shift + NumPad Minus  Cmd + Shift + Minus
Expand a Collapsed Block (expand-fold)      Ctrl + Plus                  Cmd + Plus
Expand a Collapsed Block (expand-fold)      Ctrl + NumPad Plus  
Expand a Collapsed Block (expand-fold)      Ctrl + Equals                Cmd + Equals
Expand all code blocks (expand-all-folds)   Ctrl + Shift + NumPad Plus  
Expand all code blocks (expand-all-folds)   Ctrl + Shift + Plus          Cmd + Shift + Plus
Expand all code blocks (expand-all-folds)   Ctrl + Shift + Equals        Cmd + Shift + Equals 

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.

SirMedvind

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"

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

To set default collapsing in netbean tool click Tools->Option->Editor->Folding, enable checkboxes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!