Bug 242803 - [Preferences] Preference dialog's error message area looks awful with the white background
Summary: [Preferences] Preference dialog's error message area looks awful with the whi...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux-GTK
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-31 19:51 EDT by Remy Suen CLA
Modified: 2020-04-21 04:04 EDT (History)
7 users (show)

See Also:


Attachments
An image depicting the white background of the error message. (7.21 KB, image/jpeg)
2008-07-31 19:51 EDT, Remy Suen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2008-07-31 19:51:43 EDT
Created attachment 108913 [details]
An image depicting the white background of the error message.

I noticed its white background while checking out bug 242723. I'm sure I've seen it before but just never bothered to complain about it.

Adding the code below to DialogMessageArea's createContents(Composite) method will fix the problem.

messageText.setBackground(messageComposite.getBackground());

However, I don't get why it doesn't just recursively inherit the parent's background which seems to be what it's doing on Windows (according to bug 242723).
Comment 1 Remy Suen CLA 2008-11-14 01:24:25 EST
This is not a preference problem. It is a discrepancy between GTK+ and Windows.

Running the below on GTK+ will show a white text box whereas on Windows, it is "greyed" out and properly inherits the background colour of the parent Composite.

public class DemonstrateAppWindowTopSeparatorProblem {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());

		Composite composite = new Composite(shell, SWT.NONE);
		composite.setLayout(new GridLayout());
		Text messageText = new Text(composite, SWT.NONE);
		//messageText.setBackground(composite.getBackground());
		messageText.setEditable(false);
		messageText.setText("ABC"); //$NON-NLS-1$

		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		display.dispose();
	}
}

If you uncomment the background code above (which I described in comment 0), it will work properly on GTK+. I don't know if that's what we want to do in DialogMessageArea though. Perhaps the proper solution would be to use a Label instead of a Text (as it is not editable anyway) instead of hacking in the setBackground(Color) call.
Comment 2 Susan McCourt CLA 2009-07-09 19:30:10 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 3 Sedat Akkus CLA 2011-01-19 18:24:00 EST
Same problem exists on OSX.
Comment 4 Robert Roth CLA 2015-04-22 07:36:36 EDT
I would like to fix this in context of the #greatfix initiative.

I agree that the error message is not editable anyway, so using a label instead of a non-editable Text should work just fine, and would avoid the need for hacking the background colour, so that is the solution I'm trying to implement in jface.
Comment 5 Eclipse Genie CLA 2015-04-22 07:42:46 EDT
New Gerrit change created: https://git.eclipse.org/r/46241
Comment 6 Andrey Loskutov CLA 2015-04-22 08:00:28 EDT
(In reply to Robert Roth from comment #4)
> I agree that the error message is not editable anyway, so using a label
> instead of a non-editable Text should work just fine, and would avoid the
> need for hacking the background colour, so that is the solution I'm trying
> to implement in jface.

Just FYI: the reason for the text is probably the possibility to select & copy the error message *text*. With the label this will be not possible & screen readers support. 

In context of the preferences dialog this could be not that important, but the fix is for the public class org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogMessageArea.java and I guess changing this is similar to breaking the API, since many clients might have expected that the message area is a *Text* (as specified in the class javadoc) with that specific behavior.

Also see comment on the review: the "Label" probably can't be used by screen readers.
Comment 7 Robert Roth CLA 2015-04-22 09:04:53 EDT
OK then, changing to Label idea dismissed, would you agree with the "background hack"on the text widget, as suggested in the description ?
Comment 8 Dani Megert CLA 2015-04-22 09:08:46 EDT
(In reply to Robert Roth from comment #7)
> OK then, changing to Label idea dismissed, would you agree with the
> "background hack"on the text widget, as suggested in the description ?

The fact that it works under Windows but not Linux rather indicates an SWT problem rather than a bug in Platform UI.
Comment 9 Niklas Kellner CLA 2020-04-21 03:44:14 EDT
This Bug is still present, has somebody created an SWT Ticket for it as suggested by comment 8?
Or can it be moved over to the SWT Component?
Comment 10 Karsten Thoms CLA 2020-04-21 04:04:50 EDT
Moving to SWT