Bug 577912 - Display's system colors are set to late for dark theme during workbench startup
Summary: Display's system colors are set to late for dark theme during workbench startup
Status: RESOLVED MOVED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.22   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.24 M1   Edit
Assignee: Alois Zoitl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-20 13:50 EST by Alois Zoitl CLA
Modified: 2022-11-09 10:29 EST (History)
6 users (show)

See Also:


Attachments
NPEs happening with Patch 1 (38.99 KB, text/plain)
2021-12-21 11:42 EST, Alois Zoitl CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alois Zoitl CLA 2021-12-20 13:50:43 EST
During the startup of an org.eclipse.ui.ide.workbench based application the system colors of the display class are set twice. The first time with the default colors and the second time with the current themes colors. The problem is that the second time is done after the parts are created. Therefore any parts which are using system colors of the display during their creation will have the wrong color. This especially affects all GEF3 based editors and with that all GMF, Sirius and Graphiti based editors. 

Acoording to Lars Vogel's comment in the mailing list [1] a potential solution would be to set the theme earlier or initialize the styling from the workpsace prefernces.

[1] https://www.eclipse.org/lists/platform-dev/msg03227.html
Comment 1 Eclipse Genie CLA 2021-12-21 02:29:16 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/189040
Comment 2 Phil Beauvoir CLA 2021-12-21 04:17:08 EST
Alois - what parts of the GEF3 editor are having this problem? Is it the flyout palette part?
Comment 3 Alois Zoitl CLA 2021-12-21 06:39:41 EST
(In reply to Phil Beauvoir from comment #2)
> Alois - what parts of the GEF3 editor are having this problem? Is it the
> flyout palette part?

Yes for example. But also the ruler. At least these are the most obvious I noticed. In general it would be anything that is drawn with draw2d and uses GEF's ColorConstants class.
Comment 4 Phil Beauvoir CLA 2021-12-21 06:45:07 EST
(In reply to Alois Zoitl from comment #3)
> (In reply to Phil Beauvoir from comment #2)
> > Alois - what parts of the GEF3 editor are having this problem? Is it the
> > flyout palette part?
> 
> Yes for example. But also the ruler. At least these are the most obvious I
> noticed. In general it would be anything that is drawn with draw2d and uses
> GEF's ColorConstants class.

Our RCP app uses GEF3/Draw2d. One of the problems we found was that the ColorConstants were not what we wanted for the Palette (List background color could be black). So we ended up forking GEF3/Draw2d into our project so that we can set these colors from a theme extension:

https://github.com/archimatetool/archi/commit/b79e907903345e4701fee389ccef95239dea81b0

(This raises a bigger question about GMF, Sirius and Graphiti etc having a dependency on the no longer maintained GEF3/Draw2d. Now that we have forked it I am able to fix certain bugs and other issues)
Comment 5 Lars Vogel CLA 2021-12-21 08:47:29 EST
(In reply to Phil Beauvoir from comment #4)

> (This raises a bigger question about GMF, Sirius and Graphiti etc having a
> dependency on the no longer maintained GEF3/Draw2d. Now that we have forked
> it I am able to fix certain bugs and other issues)

Looks like multiple parties have maintaining GEF/Draw2d, see https://www.youtube.com/watch?v=3ZIUB2XFDLE&t=1158s. Maybe we should revive the project? Would you be interested in working on GEF in an official project, Phil?
Comment 6 Phil Beauvoir CLA 2021-12-21 09:01:39 EST
(In reply to Lars Vogel from comment #5)
> (In reply to Phil Beauvoir from comment #4)
> 
> > (This raises a bigger question about GMF, Sirius and Graphiti etc having a
> > dependency on the no longer maintained GEF3/Draw2d. Now that we have forked
> > it I am able to fix certain bugs and other issues)
> 
> Looks like multiple parties have maintaining GEF/Draw2d, see
> https://www.youtube.com/watch?v=3ZIUB2XFDLE&t=1158s. Maybe we should revive
> the project? Would you be interested in working on GEF in an official
> project, Phil?

Lars, that link is very interesting, I wasn't aware of that, thanks for the heads up.

Our fork of GEF3 [0] and Draw2d [1] is targeted toward our use of it in our RCP app and perhaps the dbeaver one is too.

There are a *lot* of projects and RCP apps that are built on "Legacy" GEF (Modelio, Sirius, GMF, Graphiti, old version of XMind, Archi, and many others...) and it always surprised me that it is no longer officially maintained.

For my own part, I am happy to contribute to a revival of Legacy GEF, but I don't have the ability to lead or set it up.

[0] https://github.com/archimatetool/archi/tree/master/org.eclipse.gef
[1] https://github.com/archimatetool/archi/tree/master/org.eclipse.draw2d
Comment 7 Alois Zoitl CLA 2021-12-21 11:09:21 EST
Ah Lars was faster then me. I also wanted to point out that there are already several forks out there. Furthermore I know several projects, like GMF, Sirius, Graphiti having fixes and workarounds in their code base. This is the same for the project I'm leading, Eclipse 4diac. I think this is a bad situation and I realy hope we can find some way to bring these changes back to the original code base. A starting point could be just contributing code back. I would be happy to upstream 
  - a new zoom toolbar
  - an improvement to the marquee select that allows to change the feedback figure
  - and what I'm most proud of an incremental growing canvas similar to draw io's canvas

But I guess this is not the right place to discuss this.
Comment 8 Alois Zoitl CLA 2021-12-21 11:42:12 EST
Created attachment 287717 [details]
NPEs happening with Patch 1

When running the first patch with dark theme enabled during startup the attached NPEs occur.
Comment 9 Kalyan Prasad Tatavarthi CLA 2022-02-17 00:30:15 EST
@Lars, Please Retarget this bug as 4.23 M2 is over.
Comment 10 Lars Vogel CLA 2022-11-09 10:18:13 EST
Project has moved to Github, please re-create this issue in https://github.com/eclipse-platform/eclipse.platform.ui/issues