Eclipse JAVA Formatter Line Wrapper Setting

Personally I don't like Eclipse line wrapper default setting since it's not properly wrap my code.
As the result, my code look ugly and harder to be read.

Before : (It will look worse if the code is longer)
adminTree.addListener(Events.OnDoubleClick,
                new Listener<TreePanelEvent<ModelData>>() {

                    @SuppressWarnings("unchecked")
                    @Override
                    public void handleEvent(TreePanelEvent<ModelData> be) {
                        ModelData p = be.getItem();
                        System.out.println(p.get("name"));
                        // MenuHandler.handleMenu(p);
                        Application.defaultViewNavigationTree.getTree()
                                .getSelectionModel().select(p, false);
                        Application.defaultViewNavigationTree.getTree()
                                .setExpanded(p, true);
                    }
                });

Finally I found the solution.

ANSWER:
Source: http://minimalbugs.com/questions/disable-line-wrapping-in-eclipse

You can’t disable line wrapping, but you can add more maximum characters to appear in a single line, by accessing :
  • Window – Preferences – Java – Code Style – Formatter – Edit
  • Insert New profile name because you can’t edit the default profile
  • Click Line wrapping tab in the maximum width, put the maximum character you wanted to be appeared in a single line
After :

adminTree.addListener(Events.OnDoubleClick, new Listener<TreePanelEvent<ModelData>>() {

            @SuppressWarnings("unchecked")
            @Override
            public void handleEvent(TreePanelEvent<ModelData> be) {
                ModelData p = be.getItem();
                System.out.println(p.get("name"));
                // MenuHandler.handleMenu(p);
                Application.defaultViewNavigationTree.getTree().getSelectionModel().select(p, false);
                Application.defaultViewNavigationTree.getTree().setExpanded(p, true);
            }
        });

0 comments:

 
Copyright © peyotest