Is there a way to collapse all code blocks in Eclipse?

There is a hotkey, mapped by default to Ctrl+Shift+NUM_KEYPAD_DIVIDE.

You can change it to something else via Window -> Preferences, search for "Keys", then for "Collapse All".

To open all code blocks the shortcut is Ctrl+Shift+NUM_KEYPAD_MULTIPLY.

In the Eclipse extension PyDev, close all code blocks is Ctrl + 9

To open all blocks, is Ctrl + 0


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.


A "Collapse All" command exists in recent builds (e.g. 3.2 M6) and is bound to Ctrl+Shift+NUM_KEYPAD_DIVIDE by default.

You can also configure it in Preferences->Editor->Keys.