有没有办法折叠 Eclipse 中的所有代码块?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1726525/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to collapse all code blocks in Eclipse?
提问by ambertch
Eclipse has that "+/-" on the left to expand and collapse blocks of code.
Eclipse 左侧的“+/-”用于展开和折叠代码块。
I've got tens of thousands of lines to go through and would really like to just collapse everything, and selectively expand blocks to look at them.
我有数以万计的行要经过,并且真的很想折叠所有内容,并有选择地展开块来查看它们。
回答by ChssPly76
There is a hotkey, mapped by default to Ctrl+Shift+NUM_KEYPAD_DIVIDE.
有一个热键,默认映射为Ctrl+ Shift+ NUM_KEYPAD_DIVIDE。
You can change it to something else via Window -> Preferences, search for "Keys", then for "Collapse All".
您可以通过 Window -> Preferences 将其更改为其他内容,搜索“Keys”,然后搜索“Collapse All”。
To open all code blocks the shortcut is Ctrl+Shift+NUM_KEYPAD_MULTIPLY.
要打开所有代码块,快捷方式是Ctrl+ Shift+ NUM_KEYPAD_MULTIPLY。
In the Eclipse extension PyDev, close all code blocks is Ctrl+ 9
在 Eclipse 扩展PyDev 中,关闭所有代码块是 Ctrl+9
To open all blocks, is Ctrl+ 0
要打开所有块,是Ctrl+0
回答by akf
In addition to the hotkey, if you right click in the gutter where you see the +/-, there is a context menu item 'Folding.' Opening the submenu associated with this, you can see a 'Collapse All' item. this will also do what you wish.
除了热键之外,如果您在看到 +/- 的装订线中右键单击,则会出现一个上下文菜单项“折叠”。打开与此相关的子菜单,您可以看到“全部折叠”项目。这也会做你想做的。
回答by Mark Mayo
A "Collapse All" command exists in recent builds (e.g. 3.2 M6) and is bound to Ctrl+Shift+NUM_KEYPAD_DIVIDEby default.
A“全部折叠”命令存在于最近构建(例如3.2 M6),并绑定到Ctrl+ Shift+NUM_KEYPAD_DIVIDE默认情况下。
You can also configure it in Preferences->Editor->Keys.
您也可以在 Preferences->Editor->Keys 中进行配置。
回答by donfede
The question is a bit old, but let me add a different approach. In addition to the above hot-key approaches, there are default preference settings that can be toggled.
这个问题有点老了,但让我添加一个不同的方法。除了上述热键方法之外,还有可以切换的默认首选项设置。
As of Eclipse Galileo (and definitely in my Eclipse Version: Indigo Service Release 2 Build id: 20120216-1857) language specific preferences can open up new files to edit which are already collapsed or expanded.
从 Eclipse Galileo 开始(当然在我的 Eclipse 版本中:Indigo Service Release 2 Build id:20120216-1857)语言特定的首选项可以打开新文件进行编辑,这些文件已经折叠或展开。
Here is a link to Eclipse Galileo online docs showing the feature for C/C++: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_c_editor_folding.htm.
以下是显示 C/C++ 功能的 Eclipse Galileo 在线文档的链接:http: //help.eclipse.org/galileo/index.jsp?topic=/ org.eclipse.cdt.doc.user/ reference/ cdt_u_c_editor_folding。嗯。
In my Eclipse Indigo I can open the Folding Preferences window via : menu/ Window/ Preferences/ Java/ Editor/ Folding
and set all options on so I can open files by default that are completely collapsed.
在我的 Eclipse Indigo 中,我可以通过 : 打开折叠首选项窗口menu/ Window/ Preferences/ Java/ Editor/ Folding
并设置所有选项,这样我就可以在默认情况下打开完全折叠的文件。
回答by Hittz
Ctrl+Shift+/and Ctrl+Shift+*works great for Aptana Studio 3.
Ctrl+ Shift+/和Ctrl+ Shift+*非常适合 Aptana Studio 3。
Apart from that you can always use Window > Preferences > Editors > Foldings to enable it
除此之外,您始终可以使用 Window > Preferences > Editors > Foldings 来启用它
回答by wisbucky
回答by NightSkyCode
Right click on the +/- sign and click collapse all or expand all.
右键单击 +/- 符号,然后单击全部折叠或全部展开。
回答by lightalchemist
If you are using PyDev in Eclipse, its Ctrl0and Ctrl9for collapse all and uncollapse all respectively. Ctrl-and Ctrl=to collapse individual methods when your cursor is on the line of the method declaration.
如果您在 Eclipse 中使用 PyDev,则其Ctrl0和 分别Ctrl9用于折叠所有和取消折叠所有。Ctrl-并Ctrl=在光标位于方法声明的行上时折叠单个方法。
回答by partizanos
Just to sum up:
简单总结一下:
- anycode:
- ctrl + shift + NUMPAD_divide = collapse all
- NUMPAD_multiply = exand all
- pydev:
- -ctrl + 0 = collapse all
- -ctrl + 9 = exand all
- 任何代码:
- ctrl + shift + NUMPAD_divide = 全部折叠
- NUMPAD_multiply = 展开所有
- pydev:
- -ctrl + 0 = 全部折叠
- -ctrl + 9 = 全部展开
回答by Monica Arsela
Right click on the circles +/- sign and under Foldings select Collapse All
右键单击圆圈 +/- 符号,然后在折叠下选择全部折叠