Download the eclipse-java-google-style.xml. Under Window/Preferences select Java/Code Style/Formatter. Import the settings file by selecting Import.
Configure save actions to automatically format your code when saving
In the Preferences menu, select Java -> Editor -> Save Actions.
Select Perform the selected actions on save.
Select Format source code.
Click the Formatter” link and ensure the “GoogleStyle formatter is selected as active.
Click OK.
Now, whenever you make changes to your code, you can use the format source code menu item, or just save the file and formatting will be applied automatically.
Installing the coding style settings in Eclipse
Google Java Code Style
Download the eclipse-java-google-style.xml. Under
Window/Preferences
selectJava/Code Style/Formatter
. Import the settings file by selectingImport
.Configure save actions to automatically format your code when saving
In the
Preferences
menu, selectJava -> Editor -> Save Actions
.Select
Perform the selected actions on save
. SelectFormat source code
. Click theFormatter” link and ensure the “GoogleStyle
formatter is selected as active. ClickOK
.Now, whenever you make changes to your code, you can use the format source code menu item, or just save the file and formatting will be applied automatically.