Code folding in Eclipse

PhatHV picture PhatHV · Nov 22, 2012 · Viewed 51.9k times · Source

I used this way to get code folding in Netbeans:

// <editor-fold defaultstate="collapsed" desc=" description">
....
// </editor-fold>

and Visual Studio:

#region description
...
#endregion

but I can't find the same usage in eclipse. How can i use code folding in Eclispe?

Answer

Isaac picture Isaac · Nov 22, 2012

Eclipse supports code folding.

Go to workbench preferences -> General -> Editors -> Structured Text Editors, and check the "Enable folding" box.

Then go to workbench preferences -> Java -> Editor -> Folding, and adjust your folding preferences.