2

I have typed code in Java for Android in Eclipse. The formatting is not nice. Is there any way I can automatically format it using keyboard shortcuts? Any help will be highly regarded...

Eddie
  • 78
  • 1
  • 6

9 Answers9

7

Press [Ctrl]+[Shift]+F to auto format the java code in Eclipse.

Sulav Timsina
  • 703
  • 7
  • 20
2

Use Ctrl + Shift +F to auto format the code

Virag Brahme
  • 2,062
  • 1
  • 20
  • 32
1

For Formatting code in eclipce press ctrl+shift+f

kalyan pvs
  • 14,486
  • 4
  • 41
  • 59
1

Press ctrl + A and then ctrl + I and as well as you can press ctrl+ shift+ F for formatting code in Eclipse.

JavaUser
  • 41
  • 2
1

//Right click your project and select

Source -> Format

this will format your whole project

same way if your do organize your imports it will good.

Source -> Organize Imports [Ctrl+ Shift +o]

Padma Kumar
  • 19,893
  • 17
  • 73
  • 130
0

Press ctrl + A and then ctrl + I and as well as you can press ctrl+ shift+ F for formatting code in Eclipse.

Sanket Shah
  • 4,352
  • 3
  • 21
  • 41
0

Use Ctrl+I it will align automatically...

pavanmvn
  • 749
  • 10
  • 21
0

You should really have a look at

Eclipse in that Window > Preferences > Keys . You can find all of the shortcuts there and you can also define you own shortcuts you want.
And you can also set you formatter to custom format the you want to format your code in
Window > Preferences > Java > Code Style.
And AS YOU KNOW.
ctrl + shift + f is the autoformat shortcut

johntheripp3r
  • 989
  • 6
  • 15
0

Just press : Ctrl + Shift + F

Hope this helps.

Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69