Bug 579505: [hover] Unreadable text in expression hover
Use the current theme for the expression information control. If the
theme doesn't provide information colors use the old implementation
(system colors) as fallback.
Change-Id: I0096a730364994dbd39e37c561f217bd3ff5979c
Signed-off-by: Dominic Scharfe <dominic.scharfe@coseda-tech.com>
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java
index 3682639..5d4a81c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java
@@ -33,6 +33,8 @@
import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.preference.JFacePreferences;
+import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.text.AbstractInformationControl;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
@@ -56,6 +58,7 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.themes.ITheme;
/**
* Creates an information control to display an expression in a hover control.
@@ -430,8 +433,21 @@
fViewer.addViewerUpdateListener(fViewerUpdateListener);
- setForegroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
+ ColorRegistry colorRegistry = currentTheme.getColorRegistry();
+
+ Color fg = colorRegistry.get(JFacePreferences.INFORMATION_FOREGROUND_COLOR);
+ if (fg == null) {
+ fg = getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
+ }
+
+ Color bg = colorRegistry.get(JFacePreferences.INFORMATION_BACKGROUND_COLOR);
+ if (bg == null) {
+ bg = getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ }
+
+ setForegroundColor(fg);
+ setBackgroundColor(bg);
}
/**