Join the DZone community and get the full member experience.Join For Free
no, this is not about how to fold eclipse: it is about the folding feature of the eclipse editor view. my source files tend to get much larger than a single screen page. the eclipse framework comes with many great editor and navigation features, but it would be great to have the amount of information reduced. well, it can look like this:
yes, this shows about 140 lines of code in a condensed way . it gives me the high level picture. i can dive into the details on demand. what i’m using here is the eclipse feature of folding . note the small + and - signs on the left side of the view: this is used to fold/unfold regions in the editor.
to toggle folding, i use the ctrl+numpad_divide command. i can use the command as well with ctrl+3 (see the mother of all eclipse shortcuts ):
note: in case numpad_divide is not easily accessible on my keyboard layout, the key bindings can be changed under the menu window > preferences > general > keys.
‘toggle folding’ just enables folding for the current editor view. by default it is not enabled when i open a new editor view. i can change and configure this. i go to the menu window > preferences and go the ‘folding’ setting page as below: here i can configure the level of folding:
i can fold/unfold portions in my source code like below which greatly improves readability:
to have a sneak preview what is inside a folded region, i do not need to unfold it: i simply move my mouse cursor over the + and a hover text will show what is behind it:
folding makes it easy for me to navigate through big chunks of source files and to focus on the parts which are important. it saves me a lot of scrolling or navigating around.
happy folding and unfolding
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.