Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Did anyone create the Java Code Formatter Profile for Eclipse IDE that conforms to the Android Code Style Rules?

Android Code Style Guide defines "Android Code Style Rules".
To conform to these rules one have to change quite a number of settings of the Java Code Formatter (Window->Preferences->Java->Code Style->Formatter) default profile (in Eclipse IDE).

Did anyone manage to configure the formatter to follow the "Android Code Style Rules" already?
If yes, please export the Formatter profile and publish to be used by community.

PS: I've tried to do this myself but I've found that there are too many formatter options available, and most of them are not mentioned in the Code Style Guide :-(

like image 360
yvolk Avatar asked Mar 19 '10 21:03

yvolk


People also ask

How do I import code formatter XML into eclipse?

All you need is to export settings from Eclipse (go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.


3 Answers

There are pre-made formatter rules available from the platform/development.git repository (GitHub mirror, in folder /ide/eclipse).

So you can simply import android-formatting.xml and android.importorder as mentioned here.

like image 200
kroimon Avatar answered Sep 21 '22 08:09

kroimon


On a related note, here's how developers around Google keep their various Eclipse instances all in agreement: Workspace Mechanic for Eclipse

like image 26
Drew Dara-Abrams Avatar answered Sep 24 '22 08:09

Drew Dara-Abrams


I think personal or team preferences vary to much to globally enforce a coding style. So every body should deploy his project specific coding style.

like image 40
Moritz Avatar answered Sep 24 '22 08:09

Moritz