Is there a way to fold eclipse sub-blocks like an "if" statement?

Solution 1:

I found the Coffee-Bytes plugin. I downloaded it from this link and found this guide by the author, for using it.

You can find more details in these references:

What code folding plugins work on Eclipse 3.6?
How to use Coffee-Bytes code folding

Solution 2:

in updated versions of Eclipse

Change folding preferences at:

Window -> Preferences -> C/C++ -> Editor -> Folding -> Enable folding of preprocessor branches (#if/#else)

Enable folding using ctrl + shift + /

Solution 3:

No, in the Preferences Dialog (Menu Window/Prefernces): Java/Editor/Folding you may choose,

  • Comments
  • Head Comments
  • Inner Types
  • Members and Imports

if Enable Folding is checked.

If you wan't to do this because the blocks are so long that can't reconize the structure you should consider to split if/else blocks into methods using Alt-Shift-M (Extract Method)