score:83

Accepted answer

to prevent specific portions of java code from being formatted, go to "window > preferences > java > code style > formatter". click the "edit..." button, go to the "off/on tags" tab and enable the tags. afterwards, you can simply embed those tags in java code to disable the formatting in-between them. if you don't change the default tags, something like this will do :

//@formatter:off
this.
    portion.of(code
); // will not be touched by the formatter
//@formatter:on
but this will be
       reformatted.

iirc, this option only exists since eclipse 3.6.

as for css code, if you have installed eclipse wtp, go to "window > preferences > web > css files > editor" and you will find some basic formatting options there.

score:5

you cannot configure the formatting at class level, but you can configure at the project level. to do the configuration follow this path in eclipse

window->preferences-> java -> code style -> formatter

now select the configure project specific settings and do your changes.


Related Query

More Query from same tag