Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 493361

Summary: ColorsAndFontsPreferencePage marks color definitions that default to another definition with "not available in the current theme"
Product: [Eclipse Project] Platform Reporter: Andreas Mayer <anma-e>
Component: UIAssignee: Andreas Mayer <anma-e>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Lars.Vogel, loskutov
Version: 4.4Flags: loskutov: review+
Lars.Vogel: review+
Target Milestone: 4.6 RC1   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/72438
https://bugs.eclipse.org/bugs/show_bug.cgi?id=355946
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=19ed239d114d195c2fa0637936fc1e0184bded1d
Whiteboard:
Attachments:
Description Flags
Screenshot that shows the problem none

Description Andreas Mayer CLA 2016-05-10 11:24:25 EDT
Created attachment 261605 [details]
Screenshot that shows the problem

The org.eclipse.ui.themes extension point [1] supports color definitions with another color definition as default (defaultsTo attribute). For example, "Java > Colored labels - match highlight" defaults to "Basic > Match highlight background color".

The ColorsAndFontPreferencePage greys out these color definitions and appends "not available in the current theme" to their description  (see attached screenshot). 

The cause of this problem is ColorsAndFontPreferencePage.isAvailableInCurrentTheme(ThemeElementDefinition), which only checks ColorDefinition.value, but not ColorDefinition.defaultsTo.

[1] http://help.eclipse.org/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_themes.html
Comment 1 Eclipse Genie CLA 2016-05-10 11:45:34 EDT
New Gerrit change created: https://git.eclipse.org/r/72431
Comment 2 Andrey Loskutov CLA 2016-05-10 11:50:52 EDT
Thanks for the patch! Is this a regression in 4.6?
Comment 3 Eclipse Genie CLA 2016-05-10 12:38:22 EDT
New Gerrit change created: https://git.eclipse.org/r/72438
Comment 4 Andreas Mayer CLA 2016-05-10 12:39:36 EDT
(In reply to Eclipse Genie from comment #3)
> New Gerrit change created: https://git.eclipse.org/r/72438

Sorry, but I've mixed up commits for two different bugs. So I#ve abandoned my first change and created a new one.
Comment 5 Andreas Mayer CLA 2016-05-10 13:04:22 EDT
(In reply to Andrey Loskutov from comment #2)
> Thanks for the patch! Is this a regression in 4.6?

It seems that the bug was introduced end of February 2014 with changes for #355946. Prior to that date, the preference page didn't check whether a color was available in the current theme.
Comment 6 Andrey Loskutov CLA 2016-05-10 14:06:20 EDT
Andreas, I've slightly changed the patch (no logic change, just style). Are you OK with that?
Lars, I need a second committer +1 on this change. Do you have time for a review?
Comment 7 Andreas Mayer CLA 2016-05-11 04:19:37 EDT
(In reply to Andrey Loskutov from comment #6)
> Andreas, I've slightly changed the patch (no logic change, just style). Are
> you OK with that?

I'm OK with that, but nevertheless rearranged the condition to make it even clearer.
Comment 8 Lars Vogel CLA 2016-05-11 05:10:48 EDT
(In reply to Andrey Loskutov from comment #6)
> Lars, I need a second committer +1 on this change. Do you have time for a
> review?

Looks fine.