Window -> Preferences -> Java -> Code Style -> Formatter. I Just hit CTRL+SHIFT+F time from time and let the IDE do the boring job for me. Occasionally, I want the different result then the Eclipse Formatter produce. Especially when a method has many parameters. Sometimes I like to have all of them on one line, sometimes I like to break them into multiple times. Of course, the Eclipse automatic formatter cannot be configured to meet wishes.
The Eclipse formatter has a nice option
On/Off Tags:@formatter:off@formatter:on
// ant the and of line, which you want to break. For example, I have configured the Eclipse formatter to have all method parameters on a single line. But when I writethis.someMethod(param1, //
param2, //
param3, //
param4, //
param5);
Then the CTRL+SHIFT+F reformatting let this piece of the code as is.
Žádné komentáře:
Okomentovat