When you want to format multiple Java source in Eclipse the only way is to open each and every file, right click in the editor window, select the "Format" option, and save the formatted file. This plugin allows you to select one or more packages in the Java Package Explorer and format all .java files in those packages. You can also choose to select just the specific Java source files you wich to format or even the whole source directory.
N.B.: This functionality comes standard in Eclipse 3.0 and up. I won't be creating any new versions, but these versions will be available for those stuck on an older version of Eclipse, e.g. those using IBM WebSphere Application Developer 4.0, 5.0 or 5.1.
To install this plugin, follow these steps:
To use the plugin, go to the Package Explorer (usually found in the Java Perspective) and select one or more of the following:
The selected packages and source folders will be scanned for Java source files. The Java source files and those selected by the user are then formatted. If any of those Java source files has already been opened in an editor window, the contents of that window are formatted. If the window had unsaved changes, the contents are not saved to disk.
Click on this link to get more detail: http://www.klomp.org/formatjava/
Posted on: October 8, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles