Community
Participate
Working Groups
I want tabs to be replaced by spaces in the java code I write using eclipse. I think I have all the correct setting but it does not work, tab character still appears as a tab and is becoming a major annoyance. On Indentation tab of windows->preference->java->Code Style->Formatter, I have Tab size 4 and "use tab character" unchecked.
We need to know at least which build you use. See also: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-text-home/development/bug-incomplete.htm
Sorry about that. Here is the detail I copied from Help->About: Eclipse Platform Version: 3.1.0 Build id: 200412162000 -vivek.
Could reproduce with out of the box Eclipse. It seems that we apply the settings only after a preference change and not when initially opening the editor.
investigating
This only happens if the formatter preferences are never changed, but used out of the box. The problem is in JavaCorePreferenceInitializer.formatterSettings. It does use the JavaConvention settings to initialize the preference store, but then overwrites the values with the old default values. Among them is JavaCore.FORMATTER_TAB_CHAR, which is set to TAB, but the java convention setting is SPACE. org.eclipse.jdt.internal.ui.preferences.formatter.ProfileManager finds no profile and uses the JavaConvention settings as the default, but does not check whether the current settings really correspond to that profile. Moving to core - the default settings should correspond to the default profile we provide. We can either adjust the profile (this might happen together with the bug 73104 work) or the preference initializer.
I don't understand why we change the java convention settings in JavaCorePreferenceInitializer. This looks boggus. But I cannot talk to Frédéric. He is not available for now.
Frédéric, The problem is that JavaCore.FORMATTER_TAB_CHAR/JavaCore.FORMATTER_TAB_SIZE and the DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR and DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE have the same key. I think the fix is simply to get rid of the two lines related to JavaCore.FORMATTER_TAB_CHAR/JavaCore.FORMATTER_TAB_SIZE.
*** This bug has been marked as a duplicate of 82275 ***