Source code layout versus Eclipse

Andrew Haley aph at redhat.com
Thu Nov 6 06:01:09 PST 2008


I've noticed that some IcedTea commits have rather messed-up
formatting and wondered why.  The cause seems to be that Eclipse,
unlike every other tool in GNU/Linux systems, defaults to four
character wide tab stops.  This means that if you edit with anything
other than Eclipse, post patches in mail, etc., the indentation is
wrong.

Here's how to fix it, thanks to Deepak:

Go to Window->Preferences->Java->Code Style->Formatter->"New..."

Type in a name for the new profile, and select "Eclipse [built-in]" as
the template. In the dialog that follows hitting OK (assuming "Open
the editor" dialog was checked), for "Tab Policy" select "Spaces
only". The default Indentation and tab size should be 4, you don't
need to change that. And that is it.. once you hit OK, Eclipse should
show the new profile as the "Active Profile", and if it doesn't, you
need to select it from the drop down list.

Andrew.



More information about the distro-pkg-dev mailing list