Whenever I use the Eclipse source code formatter / beautifier (via the menu item Source - Clean Up or CTRL - SHIFT - f) it reformats statements that I have broken into multiple lines back into one line that is longer than 80 chars, eg I have:
public CDataCacheContainer loadDataset(CDataFileDef dsd)
throws IOException {
and it becomes
public CDataCacheContainer loadDataset(CDataFileDef dsd) throws IOException {
which is longer than 80 characters and looks poor when printed.
Can I prevent eclipse from doing this? Or is there an alternative eclipse source code formatter that wraps at 80 characters nicely?
EDIT 1:
In Eclipse under Window - Preferences - Java - Code Style - Formatter - Edit
the maximum line width was set at 80. I've changed it to 78 and also enabled wrapping on Assignment expressions and this has helped. Now the only expression that isn't wrapping is this one:
datasetsNode.add(new TreeUtil.PanelViewNode(this, table)); // NOPMD
and others like it.
From menu bar: Window > Preferences > Java > Code Style > Formatter > Edit (button) > Line Wrapping (tab). You can customize the maximum line width and change the line wrapping policy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With