under preferences, choose java --> editor --> save actions. check the perform the selected actions on save, and check the format source code box.
this may or may not be available in previous versions of eclipse. i know it works in:
build id: m20080221-1800
if you find that you do not have a save actions preference under java--> editor, it may be because you are using an older version of eclipse. in that case you can install the format on save plugin from here.
then, under preferences, choose java --> format on save. select the run format option under select a code formatting action
i have a snapshot of the setting. please follow the path:
in the preferences window, choose java --> editor --> save actions.
check the perform the selected actions on save, and check the format source code box.
i strongly recommend checking your eclipse format xml descriptor into source control. that way all members of the team can use it and you don't get to and fro reformatting battles.
- Eclipse: Can you format code on save?
- Can you save groups of tabs in Eclipse so you can open them later?
- Is there a limit on the number of lines of code you can put in an Eclipse java doument
- How do you add a PHP framework to code completion/assist in Eclipse PDT and can the framework be added as default for all projects?
- Can you configure eclipse to code assist some imports rather than others
- Eclipse IDE - can you batch code generation in one hit?
- I want to know how you can run Processing Code in Eclipse
- Can you organize imports for an entire project in eclipse with a keystroke?
- Can you have 2 completely independent instances of Eclipse running at the same time?
- Format XML code in Eclipse
- How can I get Eclipse to index code inside #ifdef .... #endif
- Can I make it so that a fanfare plays when my code compiles in Eclipse (Java)?
- Format C/C++ code on save
- Where can I find the source code for the Android Development Tools (ADT) plugin for the Eclipse IDE?
- Can you define your own template variables in Eclipse
- Can you Disable DDMS in Eclipse
- When using Eclipse with FindBugs can you mark a bug as not a bug and have it removed from the bug list?
- Can I setup Eclipse to show code changes
- How can I format an entire source tree in Eclipse 3.4 (Ganymede)?
- Can you have #regions in Android / eclipse
- Format only selected code in eclipse
- How to make Eclipse to format JSP code properly?
- Can Eclipse format comma-separated statements (var a = 1, b=2;) on different lines?
- Can Eclipse PDT automatically add PHPDoc Blocks to code where needed?
- In the Eclipse debugger, what kind of changes can be "hot code replaced" into the running JVM?
- how can I have eclipse auto insert subversion revision number into my code
- Can I save Eclipse files from a gradle tasks?
- Can I share source code among projects in Eclipse (CDT) without using absolute paths?
- How do you attach JSdoc in Eclipse so that I can have autocomplete for a personal library
- How can I prevent Eclipse from stepping into Java library code
More Query from same tag
- How to add an external dependency to an eclipse project?
- Eclipse not responding (Windows 8)
- Configuring Eclipse CDT for Apache Mesos
- How to externalize XML files when exporting spring batch to JAR
- Java get enum array values?
- Eclipse configuration to run a JNI project
- How can I get Eclipse/Jetty/GWT2.0 to find org/apache/commons/logging/Log
- Loading image as resource returning null
- JBOSS has too many libs! (a problem with m2eclipse)
- How can I convert a maven project to a Dynamic Web Project in Eclipse that builds with Ant?
- Eclipse Lyo OSLC workshop: jetty plugin - cannot run Lab1
- Start Tomcat on Eclipse Startup?
- Issue with eclipse: Potential null pointed analysis
- JGraph has unresolved AttributeMap on precompilation
- How to fill my .xml file from URL?
- Running Flex in Eclipse
- Unable to execute dex: Multiple dex files define Lorg/OpenUDID/OpenUDID_manager$ValueComparator;
- to create client.jar file in ejb in addition to myEJB.jar file
- Application servers tab not enabled in Intellij ultimate edition
- Android, Eclipse & CM10.1 Profile Manager
- How to use cloned github repository classes into existing java project
- Compiling C/GTK within Eclipse
- Window moving when debug stepping in Eclipse
- Java 8 Optional.ifPresent is my code wrong or is it eclipse?
- Calling Jmeter Functions from BeanShell Assertion Script
- Eclipse: adding a whole repository for all projects to use
- Unknown entity when running junit test
- New Blank Activity Android Application Not Working
- How to find references to a class that's referenced indirectly via exported jar in Eclipse?
- How to make eclipse Luna compile with debug information?