Note
This chapter is a continuation of Code Formatting
Tabs or Spaces? Or Both? Indent with 2 spaces? 3? 4? Or 8 spaces? Do these questions make any sense to you? If yes, you would be lucky to have Eclipse. If not — pity on your peer developers.
Most open source projects have their own strict coding conventions. [1] The feature of Code Style within Eclipse can make this task very easy for developers. Eclipse also supports profiles for using different coding styles. (Or share code style within in Organization.)
A profile is a set of rules for Code Style/formatting.
By default, Eclipse has the following profiles.
You can also create/share your own profile. For e.g. let’s take [BSD/Allman] profile, and extend it.
Go to Code style profiles
. You will get a list ofClick on New and select the base profile.
Extend the profile and save it.
Now we have profile Meera
that is almost same as BSD/Allman
but uses SPACES instead of TABS.
You can see the effect of your settings in the right area of the dialogue box. This will give you a hint on changing the style. The Eclipse code style formatter is much more extendible.