Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Background Color of Embedded Xtext editor does not follow dark theme
Background Color of Embedded Xtext editor does not follow dark theme [message #1795570] Tue, 25 September 2018 11:27 Go to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 880
Registered: January 2014
Senior Member
In the Eclipse 4diac project we are using now for quite some time Xtext embedded editors in different places. Recently i noticed that when changing 4diac to dark theme the background color of the editor is not as it should be (see also the attached screenshot). I tested this with the Eclipse 2018-09 release (platform as well as Xtext).

Does anyone have a tip for me what I may be missing here in my editor setup?
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795572 is a reply to message #1795570] Tue, 25 September 2018 11:50 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 698
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Xtext does not support theming so far. It is likely that this needs to be added to Xtext. ATM we don't have a schedule for that.
Would you please raise a feature request to https://github.com/eclipse/xtext-eclipse/issues ?

Ideally provide a patch, since I don't expect that we work on it soon.
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795585 is a reply to message #1795572] Tue, 25 September 2018 15:48 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 880
Registered: January 2014
Senior Member
After spending the last 2 hours or so digging deeper into it I can see I don't think it is on the Xtext side. It seems that the root cause is the SourceViewer and here the VerticalRuler area. As soon as there is a vertical ruler area theming is not done correctly. I can even reproduce this with a plain SourceViewer as well with an embedded Xtext editor. It could be that I need to do additional setup but I haven't found anything sofar. The only difference that I noticed in the CSS layout is that with rulers an additional canvas is introduced holding the rulers and the StyledText widget. But I think this should go further into the platform forum.
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795591 is a reply to message #1795585] Wed, 26 September 2018 03:52 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 698
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Could be, I'm not so deep in the whole theming thing. If there is something to do on Xtext side, raise an issue and describe what needs to be done. Thanks.
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795604 is a reply to message #1795591] Wed, 26 September 2018 07:16 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 880
Registered: January 2014
Senior Member
To be honest. Yesterday was also my first attempt to it. I'll posted a bug on the platform Bugzilla. Will keep you updated.
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795607 is a reply to message #1795604] Wed, 26 September 2018 08:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6458
Registered: July 2009
Senior Member
Hi

In principle the theme should be nothing to do with the Xtext core of with an Xtext generated editor. The Eclipse platform defines a theme. Everything else should use platform theme.

I have checked my OCL Xtext editors and find no custom color tweaking.

(However I have discovered that the OCL console uses explicit colors. https://bugs.eclipse.org/bugs/show_bug.cgi?id=539457 raised).

Unfortunately in the pre-dark-theme days it was much easier for developers to use explicit colors than delve through the platform APIs and color inheritance philosophies to find the 'white' background color / 'black' foreground color.

It is probably just necessary to search the Xtext code for all uses of org.eclipse.swt.graphics.Color / org.eclipse.swt.graphics.RGB constants and rewrite them to import the constant from the platform / org.eclipse.ui.texteditor.AbstractTextEditor.

Regards

Ed Willink
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795661 is a reply to message #1795607] Wed, 26 September 2018 13:34 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 880
Registered: January 2014
Senior Member
Hi Ed,

As I spent quite some time in the code and could reproduce the behavior also for a plain SourceViewer, which is used by the embedded xtext editor I think it is really a jface/platform issue. Especially as when there is no vertical ruler area (e.g., line numbers error marker) everything is themed correctly. So I would say lets wait what and if I get a response to my bug report to the platform team.

Cheers,
Alois
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795663 is a reply to message #1795661] Wed, 26 September 2018 13:46 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13124
Registered: July 2009
Senior Member
Hi can you please give us a link to the platform bug you have filed. Thanks

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1795668 is a reply to message #1795663] Wed, 26 September 2018 14:32 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 880
Registered: January 2014
Senior Member
sorry forgot about the link: https://bugs.eclipse.org/bugs/show_bug.cgi?id=539441
there I've also posted different screenshots from the experiments I made.
Re: Background Color of Embedded Xtext editor does not follow dark theme [message #1810004 is a reply to message #1795668] Sun, 28 July 2019 21:36 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 880
Registered: January 2014
Senior Member
After half a year I today found some time to play around with this thing. I looked more into what the general TextEditor and its parent classes are doing. I noticed there that these are setting quite some colors manually. When I do that by myself to the Embedded editor I could achieve now much better results. The only thing that is now still in the wrong color is the annotation area. Is there some way how I can set the foreground and background color of the annotation area?

I think in the mid term these settings should be done by embedded editor itself.

BR,
alois
Previous Topic:Creating multiple XText Eclipse editors for one extension
Next Topic:Injected Index Class is always Null in my DerivedStateComputer
Goto Forum:
  


Current Time: Fri Sep 20 09:31:02 GMT 2019

Powered by FUDForum. Page generated in 0.02429 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top