eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

Highlighting problem when using the dark theme on Windows.

Open marioja opened this issue 2 years ago • 35 comments

Describe the bug Highlighting problem when clicking between the left tree view and the right page in the Eclipse preference pages when using the dark theme.

To Reproduce When using the Eclipse preferences dialog with the dark theme, the current preference in the left tree selection pane is not visible as soon as an item is selected in the right hand side preferences pane (problem-1). If I click back on the left tree selection item for the current preference page, then the selection of the current setting in the right hand window is no longer visible(problem-2). I will attach a screen shot of both problems. This does not happen with the Eclipse Classic theme and you can use that theme to see how things should work.

Expected behavior I expect the left tree to always highlight the node when working on the right hand pane. I expect the current item in the right hand pane to remain highlighted when I click back on the node in the left tree.

Screenshots Problem-1: You cannot notice that the current item in the tree is 'Keys' image Problem-2: You cannot notice that the current key settings in the right is Add Attribute to XML (or it is barely noticeable) image

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • [ ] All OS
    • [x] Windows
    • [ ] Linux
    • [ ] macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)

Windows 10

  1. JRE/JDK version JDK 17 Version since Eclipse 2023-09 (noticed in Eclipse 2023-03)

Workaround (or) Additional context This problem also happens between the Enterprise Explorer and the editor tabs in the Java EE Perspective.

marioja avatar Sep 20 '23 18:09 marioja

If this is theme related you might want to report or transfer the issue here - https://github.com/eclipse-platform/eclipse.platform.ui/issues

Phillipus avatar Sep 20 '23 20:09 Phillipus

Hi @Phillipus I opened it here because another issue which was fixed by a commit that you pointed out to me was fixed by correcting some code in this repository. I suspect that this might be the same problem again but I am not the expert here by any stretch. What should I do, create one also in eclipse-platform, transfer it to eclipse-platform or leave it here? BTW I presume that by "transfer" you mean recreate in other repo and close in this one?

marioja avatar Sep 21 '23 13:09 marioja

@marioja It might be an issue with one of the dark theme CSS files here. I suspect that might be the case rather than being SWT. Let's see if anyone else knows.

Phillipus avatar Sep 21 '23 14:09 Phillipus

@Christopher-Hermann if you have time could you have a look at this problem. I apologize if I am breaking etiquette by tagging you.

marioja avatar Sep 21 '23 14:09 marioja

Should I create a similar issue in eclipse.platform.ui repo also? I know you guys are just volunteers like me and you work on this in your free time but since I am a newbie I want to make sure that I have done the correct thing so that the correct volunteer can work on it in their free time. If I knew how to test this I would love to try to debug this myself but I am not certain how to do this. If someone had 15 minutes to point me in the right direction I might be able to look at this myself.

marioja avatar Sep 22 '23 14:09 marioja

@marioja I experimented with the CSS theme files in eclipse\plugins\org.eclipse.ui.themes_1.2.2200.v20230220-0932\css. I added the folllowing to the e4-dark_win.css file:

Shell Tree {
    color: #CCC;
}

With this the unfocussed selected Preferences tree text is whiter than the other tree nodes. Perhaps a clue there?

Phillipus avatar Sep 26 '23 15:09 Phillipus

@Phillipus I tried to test this myself by modifying the same in my .p2 folder: C:\Users\Public.p2\pool\plugins\org.eclipse.ui.themes_1.2.2200.v20230220-0932\css\e4-dark_win.css I restarted eclipse and I did not see any change. Am I missing something?

marioja avatar Sep 29 '23 20:09 marioja

Unfortunately, I'm not able to reproduce the error. I'm running on MacOS where everything works like expected. When I install eclipse on my VM, the preferences looks like this: image Do you have any special settings? For example, your scrollbar is painted a dark color while my scrollbar is gray.

Christopher-Hermann avatar Oct 04 '23 09:10 Christopher-Hermann

@Christopher-Hermann Good day, thank you for chiming in. This problem is on Windows 10 as indicated in the original post on this issue. Do you have access to Windows 10? Windows 11 may work differently, I have not tested. As I said before, if someone can help me I could help work/test/fix this problem.

marioja avatar Oct 04 '23 12:10 marioja

Sorry guys, Eclipse 2023-12 is out and this is still not fixed. Can anyone look into this? I always use dark them and it makes it really hard for my eyes to relate trees to selections. If someone could help me troubleshoot this on windows I am willing to help. I have no knowledge of the code base and I cannot do anything on my own. Ping me at mfj (at) earthling.net and we can connect.

marioja avatar Dec 06 '23 18:12 marioja

As far as I understand the SWT tree control is drawing the selection via the OS. So the OS theme decides about the color of the selection.

For example when I change my windows to high contrast mode, we can see that the selection color in the theme matches the selection color in eclipse: Bildschirmfoto 2023-12-07 um 10 40 21

Since I only have access to a virtual Windows Server machine with limited configuration possibilities, I cannot manipulate the OS theme. @marioja Maybe you can try to configure your highlight color on your local Windows machine and confirm that this color is used for the selection in eclipse. Here is a description how this can be done: https://learn.microsoft.com/en-us/answers/questions/1193134/how-to-change-the-highlight-color-of-a-selected-de This would at least help to really understand the issue.

I uploaded a commit where I do overwrite the default selection color with custom defined colors in eclipse, see https://github.com/Christopher-Hermann/eclipse.platform.ui/commit/731c5acb684fd94dcf083f749df8e747d9237160 This solution works, but I'm not sure if this is a good solution:

  1. The color of the OS theme is overwritten, I'm not sure if this ok for other themes like high contrast
  2. The color of the selected item is drawn with a custom method, I'm afraid that this is not a good idea

Maybe someone can comment about my concerns. Currently I don't see a better solution for this issue.

Christopher-Hermann avatar Dec 07 '23 11:12 Christopher-Hermann

I will do the test and report back. It would be nice if eclipse could respect the os current color scheme. I am running windows in dark mode and eclipse will use the white mode unless I switch to using the dark theme. On to testing...

marioja avatar Dec 07 '23 14:12 marioja

ok, testing result. Unfortunately, with Windows 10 it is never simple. When you set windows to use dark mode so go to settings/colors and you select the Dark under choose your color. Unfortunately, this does not provide you with an option to select different colors for different components such as Selected text. This is only available when using the high contrast mode and when I select that, indeed Eclipse will use the Selected text color in the tree portion. But that is not an option since this problem is related to use case when one is not using high contrast mode. I will try to use your commit. @Christopher-Hermann How do I do this?

marioja avatar Dec 08 '23 14:12 marioja

I personally think that your solution for respecting the eclipse dark theme colors in Windows by overriding how the selected text is written is perfectly acceptable. The current implementation of dark theme in Windows at least is totally based independent of the Windows dark mode settings and it should be. A developer should be able to use eclipse dark mode without having to switch to Windows dark mode or even if they switched.

One feature in the future could be that if you are running eclipse in a Windows using Light color then eclipse switches to Light theme and if you are using Windows in Dark color then eclipse switches to Dark theme. This again does not mean it would have to use the windows selected text color, it could still override it but just switches the theme based on the windows color.

There is still the possibility to have Eclipse use the windows theme colors to set the eclipse theme but that is something else and if we have control over eclipse themes and it works in either windows colors then there is no incentive IMHO.

marioja avatar Dec 08 '23 14:12 marioja

To use my commit you need to follow the description on https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#contributing-to-eclipse-platform

More accurate:

  1. Install an eclipse for eclipse development: https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#creating-an-eclipse-development-environment
  2. Check out my commit via a git client: https://github.com/Christopher-Hermann/eclipse.platform.ui/commit/731c5acb684fd94dcf083f749df8e747d9237160
  3. Make sure that following projects are imported: org.eclipse.jface, org.eclipse.ui
  4. Start the target IDE

Christopher-Hermann avatar Dec 08 '23 14:12 Christopher-Hermann

The problem with my commit is that the selection color is overwritten for all TreeViewers. I assume that this will also overwrite the color in viewers with custom coloring which is not acceptable. We could also change the coloring in the eclipse tree viewer for the preferences, but then we will end up with different colors in different trees which is also a really strange behavior. I need to test how my change affects the custom coloring in other tree viewers.

Christopher-Hermann avatar Dec 13 '23 09:12 Christopher-Hermann

I tried finally your branch, it took me long time to do step 1 and I think if I check out your commit in any eclipse and run an eclipse application it should work without all the rest of the 4G in the platform-sdk folder, but then again, this is all black magic so I am not sure if that is true.

When I navigate and the package explorer is active I am not sure I like that blue color. Should be selectable in preference maybe?

image

When I click on the editor tabs, the dark grey highlight in package explorer is quite good:

image

The same color apply in preferences, which is ok.

If the bright blue when the tree is active cannot be changed, it is still acceptable. Better if it could be user settable.

As for your comment about cusom coloring in other tree viewers maybe there could be a way for other tree viewers to no use these colors. What would those be using currently without your branch. If they behave as the rest of eclipse it is probably as bad. If they do not, well I guess they do not use the theme. Maybe an option is available to other tree viewers to use the theme or use the custom coloring. Or maybe using custom coloring could disable the behaviour you have introduced in your branch. I would love to have your branch in eclipse 2023-12 as soon as possible.

marioja avatar Dec 21 '23 00:12 marioja

I just noticed the two preferences in Colors and Fonts (after looking at the branch and the code change). Cool. Personally, I prever Tree selection color focused to be RGB 81.155.255. image

When can this code be added to an update for 2023-12?

marioja avatar Dec 22 '23 02:12 marioja

I'm still testing the change with all kinds of Tree/Table viewers and custom coloring, cell coloring, etc. Up to now it looks quite promising. The only doubt that is left is that the blue color will be very strange for OS that have custom seleection colors, like Ubuntu with orange selection color.

Regarding your questions:

  • We could add the color to the color preferences, then they will be customizable. But of course we can also have a look if we can improve the default colors that are set.
  • The change will not be added to 2023-12. As soon as I finished the testing I can provide a pull request and if this requests gets approved, it will be shipped at earliest with 2024-03

P.S.: Thanks for testing the change and providing screenshots on Windows

Christopher-Hermann avatar Dec 29 '23 12:12 Christopher-Hermann

I uploaded a new version of my commit with color support on tree viewer and table viewer. Furthermore you can change the colors in the preferences via Colors and Fonts > Basic > Selection ...

Here is a code snipped to test the different settings/styles. Could you import this project into your workspace and try it out under Windows? It would also be nice to have some screenshots. To open the test dialog you must: CTRL+3 and search for command "Open Viewer Demo Dialog" viewerDemo.zip

I took the same colors as it is done in MacOS. So maybe they are not perfect on Windows, but at least the coding looks promising now. Here is a screenshot how it looks on MacOS: JfaceViewers

My change was only possible for Table and Tree viewer, so most probably you will still have issues on the list viewer

Christopher-Hermann avatar Dec 29 '23 14:12 Christopher-Hermann

I will look at your change. As for 2023-12, please note that I work for a large public sector organization. They are just in the process to move to 2023-12 which includes long awaited enterprise fixes in some IBM plugins. It would be extremely useful to have a back port of this fix in 2023-12 since upgrading follow long release cycles. In the past I have had very low success doing this as the plugin repo is signed and it makes it difficult to introduce those changes myself. You help would be greatly appreciated.

marioja avatar Dec 29 '23 17:12 marioja

Here is a screen shot of the Test viewer with selection on windows: image I tried clicking on the last row in each section. Unfortunately I was unable to get anything highlighted in the second columns

marioja avatar Dec 29 '23 19:12 marioja

As for the Eclipse IDE, I could see the effect of the Colors and Fonts> Basic> Selection... in the preference dialogs. However, I noticed that there is no highlighting for the Enterprise Explorer view and the source code tabs. This is very important as we spend more time in that use case than in the preference dialog box. I know that this use case might fall into the "list viewer" category (although the Enterprise Explorer looks like a tree viewer to me) but regardless of what category it falls, this feature is very important and is a must IMHO. This is the use case that made me create the issue in the first place. In that respect, the previous commit you had me test was better as it did handle this use case. Do you think you will be able to do something about it and do you think you will be able to do something about eclipse 2023-12?

marioja avatar Dec 29 '23 19:12 marioja

I'm not aware of the Enterprise Explorer view, how can I install this view?

Christopher-Hermann avatar Jan 22 '24 11:01 Christopher-Hermann

Part of the java enterprise perspective which comes with Eclipse IDE for Enterprise Java and Web Developers

marioja avatar Jan 22 '24 12:01 marioja

Can you share a screenshot? I don't find a "Enterprise Explorer" view in the Eclipse IDE for Enterprise Java and Web Developers. I assume that this view is appiling a custom coloring in the Table/Tree. And as already discussed, it's highly incompatible to overwrite custom coloring. In my first change, the coloring in the Table/Tree didn't pay attention to any custom coloring that is done from other plugins.

Christopher-Hermann avatar Jan 22 '24 13:01 Christopher-Hermann

Will provide a screen shot later but it will show no highlighting. You need to open the java ee perspective. You can email me at mfj (at) earthling.net and we could chat and discuss if you want.

marioja avatar Jan 22 '24 15:01 marioja

This is a screen shot using the Enterprise Explorer view. As you can see the Java source DCInitializer.java is not highlighted in the tree view on the left when my cursor is inside the java editor view on the right: image If I click on the Enterprise Explorer view title then you see the file highlighted in the tree view but this disappears as soon as I click in the java editor view. image

marioja avatar Jan 25 '24 21:01 marioja

Just to be sure - does it happen when using "Project Explorer" ? We have to be 100% sure that it's not a problem in particular view.

akurtakov avatar Jan 26 '24 06:01 akurtakov

Just to be sure - does it happen when using "Project Explorer" ? We have to be 100% sure that it's not a problem in particular view.

@marioja: Can you answer this question?

BeckerWdf avatar Feb 22 '24 08:02 BeckerWdf