tags:

views:

189

answers:

2

Currently Eclipse only fold the java doc and at function level, but when reading long methods, there could be quite a lot of if/else etc, is there a way to fold them?

+1  A: 

It appears Eclipse does not have built-in support for folding if/else statements but allows folding for other more complex cases like Anonymous inner classes. Try looking for plugins like this one (last modified 2007, try it if it supports your Eclipse version).

paul_sns
Thanks but it doesn't work. the plugin home page is broken. I have searched but no answer from google :)
Shawn
Found it at: http://code.google.com/p/coffee-bytes/But still some issues with 3.5...(String index out of bound..) anyway..
Shawn
A: 

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)

stacker
I agree but I still want to fold "if else", the code was not written by me but someone else, or just consider it a 3rdparty code.
Shawn