1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

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>
This commit is contained in:
Dominic Scharfe 2022-03-31 13:27:15 +02:00 committed by Torbjörn Svensson
parent c4920f78f9
commit be0a7410c1

View file

@ -33,6 +33,8 @@ import org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContaine
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.swt.widgets.Tree;
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 @@ public class ExpressionInformationControlCreator implements IInformationControlC
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);
}
/**