Bug 84297 - [prefs] unwanted Tab character
Summary: [prefs] unwanted Tab character
Status: RESOLVED DUPLICATE of bug 82275
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-02 18:45 EST by vivek CLA
Modified: 2005-04-29 07:17 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vivek CLA 2005-02-02 18:45:37 EST
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.
Comment 1 Dani Megert CLA 2005-02-03 04:22:50 EST
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

Comment 2 vivek CLA 2005-02-03 12:47:57 EST
Sorry about that. Here is the detail I copied from Help->About:

Eclipse Platform

Version: 3.1.0
Build id: 200412162000

-vivek.
Comment 3 Dani Megert CLA 2005-02-03 13:26:53 EST
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.
Comment 4 Tom Hofmann CLA 2005-02-09 06:15:52 EST
investigating
Comment 5 Tom Hofmann CLA 2005-02-09 06:47:36 EST
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.
Comment 6 Olivier Thomann CLA 2005-02-09 11:51:25 EST
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.
Comment 7 Olivier Thomann CLA 2005-02-10 14:41:22 EST
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.
Comment 8 Olivier Thomann CLA 2005-02-10 16:17:59 EST

*** This bug has been marked as a duplicate of 82275 ***