Reputation: 3532
Just curious if there's a setting somewhere in Eclipse to keep blocks of code collapsed when the class is opened? It's just I'll collapse methods then when the class is re-opened, everything is expanded.
Thanks
Upvotes: 18
Views: 8739
Reputation: 4250
In Windows
> preferences
:
Java
> editor
> folding
: check all, click apply
& then OK
.
Maybe this helps: Ctrl
+ Shift
+ NUM_KEYPAD_DIVIDE
collapse all methods in a java class.
Upvotes: 26
Reputation: 90417
Yes . From the eclipse official documentation :
You can specify which regions are folded by default when an editor is opened. Have a look at the Opens the folding preference page Java >Editor > Folding preference page to customize this.
Just click all the checkboxs .Then whenever a .java file is open in the java editor , everything will be collapsed.
Not sure if this options is the new feature for eclipse indigo version (3.7) , so you may have to update your eclipse to indigo if you use older version but cannot find this option.
Upvotes: 13
Reputation: 12538
I'm not aware of a solution, but let me tell you how I work - maybe this is a solution for you as well:
Enable "Only show the selected Java element". The editor will only show the element (method) you selected (see screenshot).
While editing a file use either the Outline view or CTRL + O
to navigate through the class file.
Btw: I disabled all folding options as the above approach just works best for me. Sadly, I'm not aware of a shortcut to enable/disable the "Only show the selected Java element".
Upvotes: 2
Reputation: 61538
Yes, you can set the options what to fold on file open.
You can find it at Settings->Editor->Folding
It features a resonable selection of folding options.
Upvotes: 1