eclipse / xtext

Eclipse Xtext™ is a language development framework
http://www.eclipse.org/Xtext
Eclipse Public License 2.0
768 stars 321 forks source link

Derived Source View: Black Background in Light Theme #1461

Open NicoPrediger opened 5 years ago

NicoPrediger commented 5 years ago

Steps to reproduce:

Bildschirmfoto von 2019-05-20 09-52-14

cdietrich commented 5 years ago

wonder whats different on my machine. Bildschirmfoto vom 2019-05-22 09-48-26

cdietrich commented 5 years ago

@Hejado which underlying eclipse version did you choose?

kthoms commented 5 years ago

It was 2019-03 configured

cdietrich commented 5 years ago

@Hejado can you provide the config log in the about dialog as file attached here

cdietrich commented 5 years ago

generatedcode

another machine. same behaviour => wonder which distro with which gtk version and theme is used on your machine

cdietrich commented 5 years ago

@kthoms @Hejado did you choose "latest" as xtext version?

kthoms commented 5 years ago

Yes, xtext version was "latest".

NicoPrediger commented 5 years ago

GTK 2 and 3 are installed, but should be GTK 3, config.log is attached. config.log

cdietrich commented 5 years ago

i dont see any chance to analyze this => you need to find out which swt styles are used for foreground and background

on my first machine there is

org.eclipse.swt.internal.gdk.backend=x11
org.eclipse.swt.internal.gtk.theme=Clearlooks-Phenix
org.eclipse.swt.internal.gtk.version=3.22.10

and on the second

org.eclipse.swt.internal.gdk.backend=x11
org.eclipse.swt.internal.gtk.theme=Mint-Y
org.eclipse.swt.internal.gtk.version=3.22.30

thus i wonder if that is specific to adwaita and if other eclipse views are affected as well. (might even be a platform bug)

NicoPrediger commented 5 years ago
org.eclipse.swt.internal.gdk.backend=x11
org.eclipse.swt.internal.gtk.theme=Adwaita
org.eclipse.swt.internal.gtk.version=3.24.8
cdietrich commented 5 years ago

which background does e.g. the javadoc view have?

cdietrich commented 5 years ago

=> would be interesting to evalute COLOR_INFO_BACKGROUND COLOR_INFO_FOREGROUND and why they both are black

NicoPrediger commented 5 years ago

Other views have a white background.

cdietrich commented 5 years ago

hmmm i wonder which others use

xxxx.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); xxxx.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));

and why both are black (should be seeable in debugger) and would be a platform bug imho cc @kthoms

kthoms commented 5 years ago

Could be a platform bug of course. @Hejado is the issue reproducible when you oomph a second Xtext dev workspace?

cdietrich commented 5 years ago

I assume this can be reproduced with a hello world view using the two colors mentioned above

cdietrich commented 5 years ago

@Hejado

how does this simple swt app look on your machine

package org.eclipse.xtext.xbase.ui.hover;

import org.eclipse.swt.*;

import org.eclipse.swt.widgets.*;

import org.eclipse.swt.layout.*;

public class LayoutExample {

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        // Create the layout.
        RowLayout layout = new RowLayout();
        // Optionally set layout fields.
        layout.wrap = true;
        // Set the layout into the composite.
        shell.setLayout(layout);
        // Create the children of the composite.
        Composite button1 = new Composite(shell, SWT.NONE);
        Composite button2 = new Composite(shell, SWT.NONE);
        button1.setBackground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
        button2.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
        shell.pack();
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
    }

}

swtapp

Bildschirmfoto vom 2019-05-23 12-35-40

NicoPrediger commented 5 years ago

@cdietrich Bildschirmfoto von 2019-05-23 12-41-14

@kthoms Will oomph a new workspace now, report later.

cdietrich commented 5 years ago

hmmm i wonder why the background is black. we dont use information color foreground for the font

 <fontDefinition
            label="%xtendEditorFontDefiniton.label"
            defaultsTo="org.eclipse.jface.textfont"
            categoryId="org.eclipse.xtend.ui.presentation"
            id="org.eclipse.xtend.ui.editors.textfont">

maybe that is the problem

cdietrich commented 5 years ago

=> i assume we have to define and use foreground color as well. you should be ablte to do this in your workspace and then run a runtime ws to test the fix

cdietrich commented 5 years ago

=> which os do you use?

NicoPrediger commented 5 years ago

Fedora 30

cdietrich commented 5 years ago

hmmm. i dont have that one on any of my machines. => i assume you and karsten should somewhen sit together and have a look at

org.eclipse.xtext.ui.views.AbstractSourceView.inititalizeColors() org.eclipse.xtend.ide.view.DerivedSourceView.inititalizeColors()

and see if we have to deal with the foreground color differently

cdietrich commented 5 years ago

the

        textWidget.setForeground(
                getColorFromStore(store, 
                        AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, 
                        SWT.COLOR_WIDGET_FOREGROUND, 
                        AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND));
        textWidget.setBackground(
                getColorFromStore(store, 
                        AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, 
                        SWT.COLOR_INFO_BACKGROUND, 
                        AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND));

looks bogus to me.

cdietrich commented 5 years ago

SWT.COLOR_WIDGET_FOREGROUND,

maybe that is a typo and should be

SWT.COLOR_INFO_FOREGROUND,

cdietrich commented 5 years ago

does not help problem can be reproduced by setting GTK_THEME=Adwaita in environment tab

cdietrich commented 5 years ago

@szarnekow can you have a look at my change. do you have a better idea? why do we change colors and fonts at all?

=> wont it be better to let jdt do all the work?

cdietrich commented 5 years ago

AbstractSourceView does similar strange things

cdietrich commented 5 years ago

still behaves bad.

cdietrich commented 5 years ago

bad behaviour can also be seen on mac switching from dark to light and back