Sawyer
Sawyer

Reputation: 15917

How to fold or hide setters and getters in Eclipse?

The problem is that there're too much setters and getters messing up the source code editor.

I have to scroll up and down and distinguish where are the demarcation of the business methods.

Is there a plugin that I can hide or fold setters and getters?

I know there're some libraries can eliminate setters and getters by using annotations or AOP techniques, but this is not allowed in my project.

Upvotes: 6

Views: 4804

Answers (5)

Use Ctrl+O to navigate

Create section that separate specific part of code (like Bozho suggested).

Instead of scrolling the code You can use the outline view.

While You are working with Eclipse the mouse is not really needed.

Upvotes: 2

If you have too many getters and setters confusing you with business methods, it sounds like it is time to refactor into two separate classes.

Upvotes: -1

Sylar
Sylar

Reputation: 2333

Coffee Bytes Code Folding is your friend:

Adds Code Folding preference page - Enable/Disable folding types - Control Folds: e.g. getter/setter, main methods, constructors, other methods separately. - Fold Javadocs, Block Comments, etc. separately - Filter foldable regions (e.g. on number of lines) - Define own foldable regions based on specially defined comments and define custom folding structures (e.g. if, while, try/catch, switch, comments, ...) - New icon set

Upvotes: 1

Bozho
Bozho

Reputation: 597106

I'd rather place the business methods above the setters and getters, and place something like this between them:

//================== Setters and getters start =====================

Upvotes: 1

Related Questions