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

Bug 550967

Summary: [10.15] Mac dark theme not listed in Eclipse
Product: [Eclipse Project] Platform Reporter: Lakshmi P Shanmugam <lshanmug>
Component: UIAssignee: Lakshmi P Shanmugam <lshanmug>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: a.nesheret, akarjakina, alexandr, cgatesman, greg_pugh, lshanmug, ma.becker, nobody, peter, register.eclipse, sravankumarl
Version: 4.13Flags: sravankumarl: review+
Target Milestone: 4.14 RC1   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/151138
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=b8325a5581313c7b40774fcaa870905e1b18938b
https://git.eclipse.org/r/153176
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=1ece5e5955171db322072c4b9965874a589a8502
Whiteboard:
Bug Depends on:    
Bug Blocks: 550891    
Attachments:
Description Flags
"Dark Themed" Eclipse after upgrading to macOS 10.15
none
Eclipse 4.13 Theme Preferences none

Description Lakshmi P Shanmugam CLA 2019-09-11 06:57:58 EDT
On 10.15 Beta (19A546d) and Eclipse 4.13 RC2.

Set system appearance to Dark and start Eclipse.

Expected: Eclipse should automatically start in dark theme.
Actual: Eclipse starts in Classic Theme. Mac dark theme is not listed in the themes Combo on the preference page.
Comment 1 Lakshmi P Shanmugam CLA 2019-09-11 07:03:44 EDT
Running a simple SWT snippet with org.eclipse.swt.display.useSystemTheme property set to true starts the SWT application in dark theme.
Comment 2 Lakshmi P Shanmugam CLA 2019-09-19 05:15:25 EDT
May be this needs to be fixed in Platform UI.
Sravan, can you please take a look?
Comment 3 Chad Gatesman CLA 2019-10-11 09:38:29 EDT
Created attachment 280234 [details]
"Dark Themed" Eclipse after upgrading to macOS 10.15

This is a screenshot of what my Eclipse 4.13 looks like now after upgrading to macOS 4.13 (Catalina).  Before the upgrade, the entire window was dark themed.  I don't remember what the theme setting said, before, but now, nothing is selected, and no "Dark [macOS]" exists (there is only Windows and Linux).
Comment 4 Chad Gatesman CLA 2019-10-11 09:39:50 EDT
Created attachment 280235 [details]
Eclipse 4.13 Theme Preferences

Notice in the screenshot, there doesn't appear to be options for macOS.
Comment 5 Peter Severin CLA 2019-10-14 00:49:43 EDT
I believe this happens because of the way org.eclipse.ui.themes plugin declares dark theme for macOS using the os_version restriction:

    <theme
        basestylesheeturi="css/e4-dark_mac1013.css"
        id="org.eclipse.e4.ui.css.theme.e4_dark"
        label="%theme.dark"
        os="macosx"
        os_version="10.11,10.12,10.13">
    </theme>
    <theme
        basestylesheeturi="css/e4-dark_mac.css"
        id="org.eclipse.e4.ui.css.theme.e4_dark"
        label="%theme.dark"
        os="macosx"
        os_version="10.14">
    </theme>

The os_version is checked for equality only in ThemeEngine of org.eclipse.e4.ui.css.swt plugin:

This means that for each new version of macOS a new declaration has to be made. I believe the should be the possibility to declare an open range, or have a different test to make sure that new versions of macOS are automatically supported.
Comment 6 Greg Pugh CLA 2019-10-14 02:36:26 EDT
As a workaround manually editing the os_version="10.14" line in the theme to be os_version="10.14,10.15" and restarting Eclipse with -clean appears to work.
Comment 7 Sravan Kumar Lakkimsetti CLA 2019-10-14 04:07:42 EDT
I will investigate whether I can create a generic solution for this problem
Comment 8 Eclipse Genie CLA 2019-10-16 02:15:41 EDT
New Gerrit change created: https://git.eclipse.org/r/151138
Comment 9 Matthias Becker CLA 2019-10-16 02:26:40 EDT
(In reply to Peter Severin from comment #5)
> This means that for each new version of macOS a new declaration has to be
> made. I believe the should be the possibility to declare an open range, or
> have a different test to make sure that new versions of macOS are
> automatically supported.

Absolutely agree. It's bad that we need to adapt this for every OS release.
Comment 11 Sravan Kumar Lakkimsetti CLA 2019-10-16 03:10:51 EDT
added 10.15 ro the list of versions. I will continue to investigate a solution to find a generic solution. 

I am thinking of the following lines

instead of having only equality for the os_string(like os_version = "10.15") I am thinking of implementing <, > also
Comment 12 Till Brychcy CLA 2019-10-17 02:23:29 EDT
(In reply to Sravan Kumar Lakkimsetti from comment #11)
> added 10.15 ro the list of versions. I will continue to investigate a
> solution to find a generic solution. 
> 
> I am thinking of the following lines
> 
> instead of having only equality for the os_string(like os_version = "10.15")
> I am thinking of implementing <, > also

If you don't find time for that you could at least already list 10.16,10.17,10.18,10.19,10.20 so it will work at least for the next 5 years unless apples switches the major version to 11
Comment 13 Matthias Becker CLA 2019-10-17 03:11:49 EDT
(In reply to Sravan Kumar Lakkimsetti from comment #11)
> added 10.15 ro the list of versions. I will continue to investigate a
> solution to find a generic solution. 
> 
> I am thinking of the following lines
> 
> instead of having only equality for the os_string(like os_version = "10.15")
> I am thinking of implementing <, > also

An alternative could be that one specify a theme without an os_version and one with speciifc os_versions and the algorithm takes the one with the specific version if version matches exactly but takes the one without an os_versions for all other versions.

So that a theme contribution without os_version is the default one and may be overwritten by other contributions with more specific os_version strings.
But that change is maybe an incompatible change with regards to behaviour...
Comment 14 Eclipse Genie CLA 2019-11-22 06:22:26 EST
New Gerrit change created: https://git.eclipse.org/r/153176
Comment 15 Lakshmi P Shanmugam CLA 2019-11-25 03:51:57 EST
(In reply to Eclipse Genie from comment #14)
> New Gerrit change created: https://git.eclipse.org/r/153176

The patch removes the version info from one dark theme declaration and it applies to all versions.
On 10.11 to 10.13, the theme with specific versions will be registered. On newer versions, the generic theme will be registered.

Tested on 10.13 and 10.15
Comment 17 Lakshmi P Shanmugam CLA 2019-11-26 00:16:49 EST
@Sravan,
Thanks for the review!
Comment 18 Lakshmi P Shanmugam CLA 2019-11-28 04:31:43 EST
Verified with I20191127-1800