I assume you're editing Java code - anyway, Eclipse offers this kind of functionality for other languages, too.
As JohnDR and Tomas Lycken said, in
Preferences -> Java -> Code Style -> Formatter you can define this kind of rules (you have to create a new Formatter profile).
Note, however, that the default rules (at least for Eclipse Indigo) should already satisfy your requirements. Try to edit the default profile, and you'll see them:
White Space -> Expressions -> Assignments
White Space -> Expressions -> Operators
White Space -> Control Statements -> 'for'
- When I tried, the comparison operators were treated correctly.
The formatting rules are not applied while you type, though: you have to press Ctrl + Shift + F, as Jonas suggested, or set up Eclipse to perform source code formatting every time you save the file.
This can be done in
Preferences -> Java -> Editor -> Save Actions: just check
'Perform selected actions on save' and
'Format source code'.
Enjoy your formatting.