DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Eclipse Folding

Eclipse Folding

Erich Styger user avatar by
Erich Styger
·
Jul. 07, 12 · Java Zone · Interview
Like (0)
Save
Tweet
14.50K Views

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:

source file with source folding

source file with source folding

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.

toggle folding

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 ):

folding commands

folding commands

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.

enabling folding

‘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:

folding preferences

folding preferences

i can fold/unfold portions in my source code like below which greatly improves readability:

folding markers

folding markers

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 tool tip

folding tool tip

summary

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 :-)

Eclipse

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How Template Literal Types Work in TypeScript
  • Deploying Java Applications to AWS Elastic Beanstalk
  • How to Gain Competitive Advantage in Software Development With Innovative Technology?
  • Getting Started Building on the NEAR Network with Infura

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo