DESCRIPTION

Bug 516533 - Bug: isEditable="false" colors/fonts can still be edited if
referenced by other colors

While working on the color api fix patch (Bug 508819) I found two issues
with Color/Font preference if defaultsTo is used.

1) Definitions can still be edited by others:
If you set a color (or font) to be not editable (isEditable=false), then
Colors (or fonts) that reference it  via defaultsTo=... can still edit 
such colors (or fonts).

2) User preferred color is loaded instead of default if isEditable=false is set:
If a user sets a color (e.g HOVER_/Information), and if that color is 
subsequently made 'isEditable=false', then when eclipse loads, the 
prefered user color is loaded instead of the default one.
So if colors that reference it use "reset to default", 
they get the old prefered color instead of the default one. 
This has the issue that the old color is left no-mans-land and cannot be
changed and isn't set to it's default.


FIX:

1) ThemeElementHelper
Changes here ensure that default is loaded if isEditable=false is set,
rather
than user's previous preference, avoiding a uneditable color situation.

2) ColorsAndFontsPreferencePage
Changes here gray out "Edit Default" and "Go to Default" if
default has isEditable=false set (and is thus not visible).

Test strategy:
- Open Child eclipse
- In "Colors and Fonts" under "Basic", change "Information Background
color" to something else.
- Close child eclipse
- Cherry pick the patch that makes HOVER_ colors not editable:
  https://git.eclipse.org/r/#/c/96889/
- Open child eclipse. Observe issues:
  * Javadoc Background is set to previous "Information" colors,
  * Javadoc Background can edit it's default
  * Javadoc Background has the "go to default" button, that does
nothing.
- Close child eclipse. Cherry pick this fix. Open child Eclipse.
- Observe:
  * Javadoc Background has background of default "Information"
  * Javadoc background's "edit default" and "goto default" buttons
    are grayed out.
  * User can edit Javadoc Background and resetting it resets it to
    "Information" default color.

The logic was copied for Font Definitions. For testing purposes, the
following fonts can be used:
* Basic -> "Text font" (as the default which is to be hidden with patch
above).
* Java -> "Java Editor Text Font" (as the font that references the
default"

Note for tester: There is a slight difference between FontDefintions and
ColorDefinitions.
ColorDefinitions must have either have a value or a 'defaultsTo'.
FontDefinitiosn can be left blank without a value or defaultsTo. So
subsequently
if a font references another one (Java->Basic), if the default is hidden
via isEditable=false, then the reference color (e.g Java's), doesn't
automatically reset back to the default of the original (basic)
font and instead shows "Overrides", because default has no actual value.
However, you can still click on "reset" on it (Java), and it'll reset to
the default (Basic). This is a very small detail and I don't expect it
to be a problem (or even noticeable) by anyone.

Change-Id: Ifa08bf267263642365a636e057a2de67641bc138
Signed-off-by: Natalia Golden xxx@xxx.xxx


COMMENTS

author: Natalia Golden
date: 2017-07-04 14:43:54.000000000

Patch Set 2: Commit message was updated.

-------------------------------------
author: Natalia Golden
date: 2017-07-04 14:44:16.000000000

Patch Set 2: Code-Review+1

Awaiting review.

-------------------------------------
author: Brenden Conley
date: 2017-07-04 14:53:46.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/13038/

-------------------------------------
author: Brenden Conley
date: 2017-07-04 15:33:48.000000000

Patch Set 2: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/13038/ : SUCCESS

-------------------------------------
