How can do code alignment with Eclipse base Force.com IDE. Alignment shortcut key 'CTRL+SHIFT+F' is not working for Apex code.
None of the suggestions so far work for me. Note that the Force IDE opens the Apex class in an Apex Editor. This editor does not appear in the list of contexts that you can associate with a key event. For example, this list contains such contexts as "editing in structured text", "editing in Java Source", etc.
The Apex Editor does not contribute a "Source" menu option to the right click menu. So there is no way to get to the formatting features.
I tried to open the apex class in the Java. Now the "Source" menu option appears the format option doesn't do anything. (Hence no key event will be able to do anything.)
The only thing I can get to work is this ...
Select file.... Open With... Other ... locate Java Editor. Once file is open ... select all text .. right click and select Source ... Correct Indentation .
This does not reformat but it does fix the indentation problem.
Someday I hope SFDC will make the code for the Force IDE open source. Then we, as a community, could build more developer-friendly tools.