Skip to content

Commit 0d6c27b

Browse files
Maximilian Wittmervogella
authored andcommitted
Find/Replace Overlay: adapt to target theming
The find/replace overlay now gets it's colors from the targetted view if the target is a text editor. fixes #2118
1 parent b502ad7 commit 0d6c27b

File tree

1 file changed

+11
-5
lines changed
  • bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay

1 file changed

+11
-5
lines changed

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,17 @@ private void initializeSearchShortcutHandlers() {
466466
* grab it's color and then immediately dispose of that bar.
467467
*/
468468
private void retrieveBackgroundColor() {
469-
Text textBarForRetrievingTheRightColor = new Text(container, SWT.SINGLE | SWT.SEARCH);
470-
container.layout();
471-
backgroundToUse = textBarForRetrievingTheRightColor.getBackground();
472-
normalTextForegroundColor = textBarForRetrievingTheRightColor.getForeground();
473-
textBarForRetrievingTheRightColor.dispose();
469+
if (targetPart instanceof StatusTextEditor textEditor) {
470+
Control targetWidget = textEditor.getAdapter(ITextViewer.class).getTextWidget();
471+
backgroundToUse = targetWidget.getBackground();
472+
normalTextForegroundColor = targetWidget.getForeground();
473+
} else {
474+
Text textBarForRetrievingTheRightColor = new Text(container, SWT.SINGLE | SWT.SEARCH);
475+
container.layout();
476+
backgroundToUse = textBarForRetrievingTheRightColor.getBackground();
477+
normalTextForegroundColor = textBarForRetrievingTheRightColor.getForeground();
478+
textBarForRetrievingTheRightColor.dispose();
479+
}
474480
}
475481

476482

0 commit comments

Comments
 (0)