Bug 559093

Summary: [JFace] Completion proposal popup foreground color can be wrong
Product: [Eclipse Project] Platform Reporter: Ralf Heydenreich <rheydenr>
Component: TextAssignee: Ralf Heydenreich <rheydenr>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: loskutov, paul-eclipse
Version: 4.14Keywords: ui
Target Milestone: 4.15 M3   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=531761
https://git.eclipse.org/r/156145
https://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=abb49b4ffde7627b6bc90c63d16d4da04e4b9437
Whiteboard:

Description Ralf Heydenreich CLA 2020-01-13 03:52:56 EST
In method org.eclipse.jface.text.contentassist.CompletionProposalPopup#createProposalSelector() there seems to be a C&P mistake (l. 682-690):

{code}
Color background= getBackgroundColor(control);
if (background == null) {
   background= JFaceColors.getInformationViewerBackgroundColor(Display.getDefault());
}

Color foreground= getForegroundColor(control);
if (foreground == null) {
	foreground= JFaceColors.getInformationViewerBackgroundColor(Display.getDefault());
}
{code}
I think the foreground color should come from JFaceColors.getInformationViewerForegroundColor
Comment 1 Paul Pazderski CLA 2020-01-13 04:04:53 EST
Yes, seems fishy. Same for CompletionProposalPopup2. Do you like to provide a change yourself [1] or is it not worth the setup for you?

I'm also interested how you found it. It seems to be rare that fore- and background are retrieved from JFaceColors if no one had reported such unreadable result yet.

[1] https://wiki.eclipse.org/Platform/How_to_Contribute
Comment 2 Ralf Heydenreich CLA 2020-01-13 04:20:25 EST
I'll try to contribute a patch (but could take some time). 
I found the bug while proving the migration of Xtext to a pure E4 base. For this I've created a little example project with a very pure Xtext implementation. While showing the autocompletion the error occured.
Comment 3 Paul Pazderski CLA 2020-01-13 04:26:01 EST
(In reply to Ralf Heydenreich from comment #2)
> I'll try to contribute a patch (but could take some time). 
No problem. Feel free to ask if you want any help.
Comment 4 Eclipse Genie CLA 2020-01-19 07:57:49 EST
New Gerrit change created: https://git.eclipse.org/r/156145
Comment 6 Andrey Loskutov CLA 2020-01-20 05:16:39 EST
Thanks Ralf!