Skip to content

Commit 3597fcf

Browse files
committed
Inherit host control colors in content proposal popups
Content proposal popups now fall back to the colors of the control they are attached to when the JFace CONTENT_ASSIST_* color preferences are unset. RCP applications that style their controls through SWT API, without configuring these JFace preferences, get matching popups for free. It also fixes the white completion popup in the dark-themed workspace selection dialog, which is shown before the workbench theme is applied.
1 parent 4f036a6 commit 3597fcf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ContentProposalAdapter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,14 +594,18 @@ boolean hasFocus() {
594594

595595
@Override
596596
protected Color getForeground() {
597-
return JFaceResources.getColorRegistry().get(
597+
Color foreground = JFaceResources.getColorRegistry().get(
598598
JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
599+
// Fall back to the host control's color so the popup matches its
600+
// surroundings when no content assist color is configured.
601+
return foreground != null ? foreground : control.getForeground();
599602
}
600603

601604
@Override
602605
protected Color getBackground() {
603-
return JFaceResources.getColorRegistry().get(
606+
Color background = JFaceResources.getColorRegistry().get(
604607
JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
608+
return background != null ? background : control.getBackground();
605609
}
606610

607611
/*

0 commit comments

Comments
 (0)