aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes How to set the formatter in Eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to set the formatter in Eclipse?" Watch "How to set the formatter in Eclipse?" New topic
Author

How to set the formatter in Eclipse?

Thomas Chang
Ranch Hand

Joined: May 13, 2008
Posts: 61
Hi all,

Normally one can format the source code in Eclipse with ctrl-shift-f. But the default length of a line is set to 70 charaters. How can I change this to let it be 100 charaters?

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5837
    
    7

That depends on the file type. For Java source files, the setting is at Window > Preferences > Java > Code Style > Formatter, click Edit, then select the Line Wrapping tab.

For other file types it is in other locations. For example, for HTML is is at Window > Preferences > Web > HTML Files > Editor.


JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Actually, I set my lines DOWN to 65 characters. Years ago when I was doing Macintosh development, some of my co-workers had large monitors. I couldn't read their code properly, because it ran outside the viewing window on my smaller monitor.

I've got a nice wide monitor myself these days, but one thing hasn't changed: I still print on standard-sized paper. Wide lines either get truncated (losing data) or wrapped (ruining the nice pretty formatting). So even though I have sufficient screen space, I still keep the lines fairly narrow. 65 was a more or less arbitrary number that was somewhat influenced by the fact that I started on punched-cards, where the normal width was 72 columns.

Although I use the Java pretty-printer to enforce the text width, I also enable the "print width" option. It places a line down the editor view at the end of column 65 so I know
where things are going to wrap.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
wood burning stoves
 
subject: How to set the formatter in Eclipse?