Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328708 - Colors and Fonts preference page: Reset is broken
Summary: Colors and Fonts preference page: Reset is broken
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 399345
  Show dependency tree
 
Reported: 2010-10-26 09:38 EDT by Markus Keller CLA
Modified: 2013-01-28 19:18 EST (History)
2 users (show)

See Also:


Attachments
Fix (3.72 KB, patch)
2010-10-27 06:25 EDT, Dani Megert CLA
no flags Details | Diff
Additional Fix (4.06 KB, patch)
2010-10-28 05:34 EDT, Dani Megert CLA
no flags Details | Diff
Additional Fix (4.82 KB, patch)
2010-10-28 08:06 EDT, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2010-10-26 09:38:13 EDT
I20101025-1800

Colors and Fonts preference page: Reset is broken

- open 'Colors and Fonts' preference page
- click Restore Defaults
- click OK, reopen Preferences
- select 'Java Editor Text Font'
- click Edit..., choose a different font A
- click Reset
- click Edit Default..., choose a different font B
=> Bugs:
  - tree item label says "(overrides default: Text Font)", but it shouldn't override
  - Edit Default... button is disabled
  - 'Java Editor Text Font' is decoupled from its parent font (e.g. when I change the parent, then the child font doesn't change in the tree, and even more confusingly, its preview shows the system default font)
Comment 1 Dani Megert CLA 2010-10-26 09:40:19 EDT
I'll take a look.
Comment 2 Dani Megert CLA 2010-10-27 06:23:37 EDT
This is an old problem not introduced by the latest changes to the page. The state of the fonts isn't correctly maintained.

'Restore Defaults' is broken as well. And of course same for colors.
Comment 3 Dani Megert CLA 2010-10-27 06:25:58 EDT
Created attachment 181818 [details]
Fix
Comment 4 Dani Megert CLA 2010-10-27 06:26:20 EDT
Markus, can you please test and review the patch? Thanks.
Comment 5 Dani Megert CLA 2010-10-27 13:16:27 EDT
There were two other issues:
1. preview is also broken
2. other direction is also broken

Fixed this in HEAD (ColorsAndFontsPreferencePage.java rev. 1.73).
Available in builds > I20101027-1300.
Comment 6 Markus Keller CLA 2010-10-27 13:48:09 EDT
From what I could understand of that code, the final fix (1.73) looks good, except for a wrong dispose() call that I've removed in 1.74.
Comment 7 Dani Megert CLA 2010-10-28 02:24:49 EDT
Argh!

It now works in the dialog but once an override is applied one can no longer get rid of it.
Comment 8 Dani Megert CLA 2010-10-28 05:34:24 EDT
Created attachment 181917 [details]
Additional Fix
Comment 9 Dani Megert CLA 2010-10-28 08:06:00 EDT
Created attachment 181926 [details]
Additional Fix
Comment 10 Markus Keller CLA 2010-10-28 09:41:09 EDT
Regression compared to I20101005-0800:
- start with default settings
- set "Java editor text font" to bold
- set "Java compare text font" to bold-italic
- save preferences (OK, reopen)
- reset "Java compare text font"
=> preview and label for "Java compare text font" look OK, but when preferences are saved, the "Java compare text font" is a custom font that matches the "Text Font".

Changing resetFont(..) to do
    fontPreferencesToSet.put(definition.getId(), newFD);
solves this problem but brings back comment 0.

Remaining problems (were already broken in I20101005-0800):
A:
- start with default settings
- set "Java compare text font" to bold
- set "Java editor text font" to bold
- reset "Java editor text font"
=> "Java compare text font" says it overrides, but label and preview look like it doesn't override
=> After storing the change and reopening the dialog, the "Java compare text font" is bold again (and overrides)

B:
- start with default settings
- set "Java compare text font" to bold
- set "Java editor text font" to bold
- save preferences (OK, reopen)
- Restore Defaults
=> labels and preview look OK
=> After storing the change and reopening the dialog, the "Java compare text font" is bold again (and overrides)
Comment 11 Dani Megert CLA 2010-10-28 10:14:10 EDT
The way the page stores the stuff into the preference store can only be fixed with a bigger rewrite. At this point the safest thing to use the mechanism we used in M2 and 3.6 and take a closer look during M4.
Comment 12 Dani Megert CLA 2011-02-10 02:57:29 EST
Fixed in ColorsAndFontsPreferencePage.java, rev. 1.76.
Available in builds >= I20110210-2000.
Comment 13 Jesse CLA 2011-03-08 15:52:41 EST
Altering fonts/styles seem to be working correctly. However, changing text color doesn't seem to have an effect on either the preview or in an editor after being saved.

- If you change the Java Editor Text Font color to something other than black, it says that it overrides the default, but it will appear the same as the default in the preview and in the editor after being saved.

Options to change JUST colors (and not the font) seems to work fine though (eg. changing content assist color works fine).
Comment 14 Jesse CLA 2011-03-08 16:38:16 EST
I've opened a new bug for this -> https://bugs.eclipse.org/bugs/show_bug.cgi?id=339283
Comment 15 Jesse CLA 2011-03-09 10:46:21 EST
Woops! Seems the color controls shouldn't even be in the dialog anyway, and the bug was marked as a duplicate. Sorry about that.
Comment 16 Jesse CLA 2011-03-09 13:57:00 EST
Verified in build I20110307-2110. Everything looks good.