DESCRIPTION

Bug 464781 - [Linux] Theme change to dark does not request native GTK
support

Change-Id: I645e6f0c9330e35b84e2b18c4b287dfdd4c3ea2f
Signed-off-by: Chase Horton xxx@xxx.xxx

COMMENTS

author: Chase Horton
date: 2015-04-17 10:16:59.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2015-04-17 10:17:06.000000000

Patch Set 3:

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

-------------------------------------
author: Chase Horton
date: 2015-04-17 10:23:24.000000000

Patch Set 3:

Added an alternative implementation through a preference set in the CSS. Still using fragments as there is no way around that.

-------------------------------------
author: Zaid Mosley
date: 2015-04-17 10:34:30.000000000

Patch Set 3:

(5 comments)

Using preference instead of a new CSS swt specific attribute has the drawback that you cannot explicitly control the reset of the attribute. I think a new attribute would give you more flexibility.

What happens if you switch from dark to a theme which does not have the new property set to false? If you have your own CSS property you can reset it.

Line:60, bundles/org.eclipse.ui.themes/css/e4_default_gtk.css -> I don't think that is required, if you present your handler should not be triggered.

Line:18, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> Typo in class name

Line:28, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> Is this conversion save or can an invalid value throw an exception?

Line:30, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> Make the cast before not in the method call.

Line:2, bundles/org.eclipse.ui.gtk/.settings/org.eclipse.jdt.core.prefs -> Please set the default Eclipse formatter for the plug-in and activate the save actions to trailing whitespace

-------------------------------------
author: Chase Horton
date: 2015-04-17 10:45:46.000000000

Patch Set 3:

(5 comments)

> (5 comments)
 > 
 > Using preference instead of a new CSS swt specific attribute has
 > the drawback that you cannot explicitly control the reset of the
 > attribute. I think a new attribute would give you more flexibility.
 > 
 > What happens if you switch from dark to a theme which does not have
 > the new property set to false? If you have your own CSS property
 > you can reset it.

This change is specific to this couple of themes, Dark and Gtk. Other themes are out of the scope of this change and should not interact with the handler.

Line:60, bundles/org.eclipse.ui.themes/css/e4_default_gtk.css -> The hint has to be given in both cases. If the user goes from light to dark there is a call "make it dark". If it goes from dark to light it has to call "make it light". So it needs to be triggered.

Line:18, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> Will fix.

Line:28, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> Will add a couple of checks.

Line:30, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> What's wrong with that?

Line:2, bundles/org.eclipse.ui.gtk/.settings/org.eclipse.jdt.core.prefs -> Will do.

-------------------------------------
author: Brenden Conley
date: 2015-04-17 10:51:04.000000000

Patch Set 3: Verified+1

Build Successful 

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

-------------------------------------
author: Zaid Mosley
date: 2015-04-17 10:58:56.000000000

Patch Set 3: Code-Review-1

(1 comment)

> This change is specific to this couple of themes, Dark and Gtk. Other themes are out of the scope of this change and should not interact with the handler.

Unfortunately this is not that easy. There are tons of custom themes out there, most visible the jeeeyl theme. Now if I install this theme and switch to dark and then to jeeeyls theme, his theme will not have the setting. So your handle need to ensure that it resets this value before setting it. We do this a lot in your widget related CSS handlers.

For an example see http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=9b58903d98a9c85379b836c057b94d514c238899 and the reset method

Line:30, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> See discussion of line 28, I would do the cast and type check outside of this method call.

-------------------------------------
author: Zaid Mosley
date: 2015-04-17 10:59:23.000000000

Patch Set 3:

(2 comments)

Line:23, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> Please remove ws

Line:27, bundles/org.eclipse.ui.gtk/src/org/eclipse/ui/gtk/ThemeChangeHanlder.java -> Please remove ws

-------------------------------------
author: Chase Horton
date: 2015-04-17 11:25:30.000000000

Patch Set 3:

> (1 comment)
 > 
 > > This change is specific to this couple of themes, Dark and Gtk.
 > Other themes are out of the scope of this change and should not
 > interact with the handler.
 > 
 > Unfortunately this is not that easy. There are tons of custom
 > themes out there, most visible the jeeeyl theme. Now if I install
 > this theme and switch to dark and then to jeeeyls theme, his theme
 > will not have the setting. So your handle need to ensure that it
 > resets this value before setting it. We do this a lot in your
 > widget related CSS handlers.
 > 
 > For an example see http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=9b58903d98a9c85379b836c057b94d514c238899
 > and the reset method

Can you be a bit more explicit on your suggestions? What exactly are you proposing to have on the CSS? Also which kind of ElementAdapter are you thinking of as the CompositeElement and so on are for specific widget properties AFAIK and not for overall settings like "being dark" or not. Or are you thinking of having a new type ElementAdapter altogether?

The examples you point at are directly related to processing properties of SWT widgets like font, background color etc. but this does not fit into those as it's a "global" setting.

-------------------------------------
author: Zaid Mosley
date: 2015-04-17 11:43:33.000000000

Patch Set 3:

Maybe we introduce a new CSS property to style MApplication similar to the properties of other model elements. See https://wiki.eclipse.org/Eclipse4/CSS for examples.

-------------------------------------
author: Chase Horton
date: 2015-04-17 12:21:12.000000000

Patch Set 3:

> Maybe we introduce a new CSS property to style MApplication similar
 > to the properties of other model elements. See https://wiki.eclipse.org/Eclipse4/CSS
 > for examples.

The resetting you mentioned is specific to SWT widgets and this is not something you can attach to an SWT widget. 

I'm still not convinced that the preference is not the right approach. To me it feels better than styling the MApplication or getting into that route. I'll investigate a bit more into a way to handle cases in which no CSS indication is present.

-------------------------------------
author: Chase Horton
date: 2015-04-17 12:27:05.000000000

Patch Set 3:

> > Maybe we introduce a new CSS property to style MApplication
 > similar
 > > to the properties of other model elements. See https://wiki.eclipse.org/Eclipse4/CSS
 > > for examples.
 > 
 > The resetting you mentioned is specific to SWT widgets and this is
 > not something you can attach to an SWT widget.
 > 
 > I'm still not convinced that the preference is not the right
 > approach. To me it feels better than styling the MApplication or
 > getting into that route. I'll investigate a bit more into a way to
 > handle cases in which no CSS indication is present.

Now that I think of it custom themes should really specify this property also. There is no guarantee that Jeeeyul's (anyone's) theme will be "light". There will be custom dark and light themes and just resetting everytime is not a solution. So it looks quite reasonable for me to have all custom themes specify whether they are light or dark. Brian also mentioned that we need a way for the themes to define this "shade" property or as to whether they are light or dark. Specifying it in the CSS could be a start.

-------------------------------------
author: Zaid Mosley
date: 2015-04-17 13:56:35.000000000

Patch Set 3:

Let me explain the reset functionality. Before 4.4. if you applied a theme and afterwards another theme all stuff that was not overriden in the new theme remained styled as in the first theme. That was annoying and therefore we had this "Restart" warning in the Preference dialog (which you implemented).

In 4.4. we introduced the "reset to default" functionality. If you switch from theme A to B, everything would be set to "default" and afterwards everything would be styled accordingly to B. 

This allows new themes to control everything without side effects from older themes. Please note that we still have a few bugs in the reset stuff, e.g., Form controls do not all support the reset functionality.

So in your case, if I switch from one theme to "Something else" all styling must be resetted to the default, e.g., preferences, colors, etc. As you are now argue this reset requirement away for the OS settings in this review, we also tried to argue that away for the preferences but this was strongly requested by the JDT team.

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