From http://www.velocityreviews.com/forums/t144789-eclipse-stripping-whitespace-at-eol.html, Dale King writes:
Actually, Eclipse has functionality to remove trailing whitespace, but
for some reason they don't expose it by default.
If you go to the key bindings, select modify and select File for the
category you will see that there is a Remove trailing whitespace that
can be bound to a key.
I don't see any way to actually add that to the menus.
To do it automatically check out the AnyEdit plugin:
I installed the AnyEdit plugin and it works great.