Community
Participate
Working Groups
To reproduce: 1. Create a new workspace 2. Import the preference file attached 3. Create a new Java project (without enabling project specific settings) 4. Create a HelloWorld class with method braces on same line as method signature 5. Select all the code and run the code formatter Expected: Braces are moved to line below signature since this is what the code formatter is setup to do Actual: The custom code formatting is not applied Work-around: Open the General Preferences windows and navigate to the code formatter option Notice that the SJM custom code formatter is selected in the drop down Select another code formatter then reselect the SJM code formatter Hit OK on the preferences window Now the code will format correctly
Created attachment 69195 [details] preference file for reproducing
Reproduced in I20070529-0010 Seams to be related to the old version of the profile/profile is not updated
I think its because the preference file only contains the profiles, but not the actual jdt.core settings. I assume you handcrafted that preference file. So either leave a way the '/instance/org.eclipse.jdt.ui/formatter_profile=_SJM' key and manually switch the profile or include all jdt.core formatter settings in the profile as well.
setting to invalid. please reopen if you didn't handcraft that file.
It works fine when exporting and importing all preferences. The problem is, that we have a 'Java Code Style Preferences' category which claims to contain all the Java > Code Style preferences. However, it does not export the formatter settings of the compiler along with it. When importing, we do set all the code style settings, including the formatter ones, but this does not get transferred to the compiler. Possible workarounds: - export all (or at least also the compiler) preferences - export and import the profiles directly via preference page - open the preference page, switch to another profile and back, click 'OK'
*** Bug 410940 has been marked as a duplicate of this bug. ***
*** Bug 473156 has been marked as a duplicate of this bug. ***
From bug 473156 comment #11: > I did some more testing and found that those extra entries are added in Mars > only if you check "Export all" (which is checked by default) in the Export > Preferences wizard page. If you check only "Java Code Style Preference" or > check all preference types manually / using "Select All" button, then those > entries are missing in the exported file and the bug can be reproduced on > import. > > The above behavior can be seen in Eclipse 3.8.1 also. > > So looks like the bug is that those entries are not being added to exported > file on checking only "Java Code Style Preference" or on checking all > preference types manually / using "Select All" button.
New Gerrit change created: https://git.eclipse.org/r/53472
(In reply to Eclipse Genie from comment #9) > New Gerrit change created: https://git.eclipse.org/r/53472 We should export the org.eclipse.jdt.core.formatter entries ("/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter...") also while exporting "Java Code Style Preferences". Tested that the attached patch works fine when preferences are exported and imported with either all or only "Java Code Style Preferences" checked. Dani, please have a look.
Gerrit change https://git.eclipse.org/r/53472 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=293f3f755aad8908bfde33a4572731aa16333221
(In reply to Eclipse Genie from comment #11) > Gerrit change https://git.eclipse.org/r/53472 was merged to [master]. > Commit: > http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=293f3f755aad8908bfde33a4572731aa16333221 > Thanks Noopur!