title: Eclipse: Can you format code on save?
body: <p>In Eclipse, under <kbd>Windows</kbd> -> <kbd>Preference</kbd> -> <kbd>Java</kbd> -> <kbd>Code Style</kbd>, you can define code templates for comments and code, and you can setup a code formatter. </p>
  
  <p>I'm wondering if it is possible in Eclipse to have these setting take affect every time I save a source file.  Basically, instead of me highlighting everything and pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd>, I want Eclipse to be responsible for making sure my code is formatted properly.</p>
  
  <p>Is this possible and how do you set it up?</p>
  
  <p><strong>Note On Using the Auto-Format:</strong>  It's probably best to choose "Format Edited Lines" as merging changes becomes very difficult when you reformat a whole file that is in source control already that was not formatted properly. Already did this to a co-worker.</p>