Sunday, February 27, 2011

Automatically format the java source file for Android Eclipse

Eclipse java project, Ctrl + Shift + F can be used to automatically format the source file.
You can also first select the lines in source file and then use Ctrl+I to only format the selected lines.
Another option is automatically formatting the source file when saving the file. To configure this, go to Windows->Preference->Java->Editor->Save Action, and enable the option of "Format All Lines".
This will save a lot of time to manually format the code and also make it more readable.

Other useful short cut keys:
Ctrl+Shift+E: showing the list of all opened editor,
Ctrl+Shift+F6: navigateing to previous editor
Ctrl+F6: navigating to next editor
Ctrl+/: comment and uncomment all selected lines.
Jonathan

No comments:

Post a Comment