Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 466275 - GVT45: In Dark Theme, the used memory color of heap monitor is incorrect
Summary: GVT45: In Dark Theme, the used memory color of heap monitor is incorrect
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.5 RC1   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-04 05:49 EDT by Jack Chen CLA
Modified: 2018-08-09 08:43 EDT (History)
8 users (show)

See Also:
Lars.Vogel: review+
dirk.fauth: review+


Attachments
Background color of Heap Monitor in Dark Theme. (8.27 KB, image/png)
2015-05-04 05:49 EDT, Jack Chen CLA
no flags Details
Heap on windows with patch applied (1.33 KB, image/png)
2015-05-04 13:41 EDT, Fabio Zadrozny CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Chen CLA 2015-05-04 05:49:17 EDT
Created attachment 253127 [details]
Background color of Heap Monitor in Dark Theme.

Build ID: 20150502-1500
Locale: English

Steps to reproduce:
1. Click Window -> Preferences
2. Click General -> Appearance.
3. Change the Theme to Dark.
4. Click Apply button.
5. Click on General.
6. Check the "Show heap status" option.
7. Click Apply button.

Problem Description:
  The background color should be black not white.
Comment 1 Lars Vogel CLA 2015-05-04 12:21:11 EDT
I think you do not mean the background color but the usedMemCol which is used to draw the border on the HeapMonitor. This is currently hard coded to SWT.COLOR_INFO_BACKGROUND, in HeapStatus line 133:

usedMemCol = display.getSystemColor(SWT.COLOR_RED);
Comment 2 Eclipse Genie CLA 2015-05-04 12:39:53 EDT
New Gerrit change created: https://git.eclipse.org/r/47073
Comment 3 Lars Vogel CLA 2015-05-04 12:43:44 EDT
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/47073

This implementation "recycles" the setForeground method for the used memory indicator. This allows me to implement this relatively easy, as I do not need an additional CSS handler.

Jack or Fabio can you test the change? On Linux SWT.COLOR_INFO_BACKGROUND is already black.
Comment 4 Lars Vogel CLA 2015-05-04 12:44:05 EDT
(In reply to Lars Vogel from comment #1)
> usedMemCol = display.getSystemColor(SWT.COLOR_RED);

usedMemCol = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
Comment 5 Fabio Zadrozny CLA 2015-05-04 13:15:43 EDT
Hi Lars,

I just checked the patch and it's still not working on windows.

There are some details:

1. The label color on the heap is still black
2. The color for drawing the memory usage is still SWT.COLOR_INFO_BACKGROUND

For 2. the reason it seems to happen is because the setForeground() is never called (it gets called if you set a color different from black, such as red -- so, I guess this happens because getForeground() is returning black, so setForeground() is never called -- so, you probably also need to override the getForeground() to return the used color).

I.e.:

	@Override
	public Color getForeground() {
		if (usedMemCol != null) {
			return usedMemCol;
		}
		return getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
	}

For 1. it seems that this isn't addressed in the patch (although it's still a problem -- I don't see any styling option for that, probably the proper way here would be actually creating a HeapStatusSWTHandler (which extends AbstractCSSPropertySWTHandler) to set the text color?
Comment 6 Lars Vogel CLA 2015-05-04 13:25:02 EDT
(In reply to Fabio Zadrozny from comment #5)
> Hi Lars,
> 
> I just checked the patch and it's still not working on windows.
> 
> There are some details:
> 
> 1. The label color on the heap is still black

Funny, these platform differences. This is white on Linux. 

> 2. The color for drawing the memory usage is still SWT.COLOR_INFO_BACKGROUND
> 
> For 2. the reason it seems to happen is because the setForeground() is never
> called (it gets called if you set a color different from black, such as red
> -- so, I guess this happens because getForeground() is returning black, so
> setForeground() is never called -- so, you probably also need to override
> the getForeground() to return the used color).

Thanks. Gerrit review adjust. Would be great if you can test it, if that works now under Window?

> For 1. it seems that this isn't addressed in the patch (although it's still
> a problem -- I don't see any styling option for that, probably the proper
> way here would be actually creating a HeapStatusSWTHandler (which extends
> AbstractCSSPropertySWTHandler) to set the text color?

If we introduce a new CSS handler, we should most like use it to set the memory usage color and use setForeground for the text color.
Comment 7 Fabio Zadrozny CLA 2015-05-04 13:41:28 EDT
Created attachment 253145 [details]
Heap on windows with patch applied

I'm posting a screenshot on how it looks on windows (with the getForeground applied too)... I think that either those colors should be lighter on Windows so that the text can actually be seen (which should be something fast to do) or a proper handler should be created -- probably best choice if you have the time to do that ;)
Comment 9 Lars Vogel CLA 2015-05-05 16:18:59 EDT
(In reply to Eclipse Genie from comment #8)
> Gerrit change https://git.eclipse.org/r/47073 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=0e2a41e90dd981e00494bae49fa59ccb0c34c246

This fixes the reported issue. It does NOT configure the text color, which is still black. If that is also required, please open a new bug report for this.
Comment 10 Jack Chen CLA 2015-05-11 04:02:11 EDT
This bug is fixed in build I20150509-1500.
Comment 11 Torkild Resheim CLA 2018-08-09 08:43:03 EDT
See bug #466275 which describes a related problem on macOS 10.14.