How to set up line wrapping for import in eclipse

The guys from eclipse and checkstyle will probably face this problem now: after organizing the import in eclipse using CTRL-SHIFT-o, each import will be on a separate line without line wrappers.

If you've configured checkstyle to warn if you have lines longer than 80 characters, it will probably warn about your imports. I usually insert new lines at the appropriate positions in the expression and everything is fine. But next time someone uses eclipse import import feature, each import is on the same line again.

Eclipse auto-linewrap formatting doesn't work with imports. So I'm wondering if there is another way to tell eclipse to linewrap huge import statements? Or is there a plugin for this?

+2


source to share


1 answer


Why not define an exception for the LineLength Checkstyle rule (using a property ignorePattern

)?
Thus, any line starting with an import will not raise this warning.



If this is not possible, you will need to define your own formatted code (see this SO answer )

+1


source







All Articles