I was attempting to switch my use of tabs (in Eclipse Juno) to pure spaces. The problem was, even though the Text Editor configuration within Eclipse was set to use “Insert spaces for tabs”, this was not having any effect on my Java code.
Solution: the Java editor is using an Eclipse editor “profile” which is overriding the default Text Editor configuration parameters; thus, you need to customize the Java editor profile.
- Open up Eclipse preferences (Mac: Eclipse->Preferences)
- Navigate to Java->Editor->Formatter
- Create a new ‘Active Profile’, and call it whatever you like
- Edit the newly created profile (click Edit)
- Next to the ‘Tab policy’ item, select ‘Spaces only’ under the drop-down menu
- Click OK and make sure you use this profile
- (optional) for exiting code, you can convert source code to use the new tab policy by highlighting all the code, and right-clicking to select: Source->Correct Indentation