Skip to content

Commit

Permalink
Find/Replace Overlay: adapt to target theming
Browse files Browse the repository at this point in the history
The find/replace overlay now gets it's colors from the targetted view if
the target is a text editor.

fixes #2118
  • Loading branch information
Wittmaxi committed Jul 22, 2024
1 parent b502ad7 commit be8946a
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,17 @@ private void initializeSearchShortcutHandlers() {
* grab it's color and then immediately dispose of that bar.
*/
private void retrieveBackgroundColor() {
Text textBarForRetrievingTheRightColor = new Text(container, SWT.SINGLE | SWT.SEARCH);
container.layout();
backgroundToUse = textBarForRetrievingTheRightColor.getBackground();
normalTextForegroundColor = textBarForRetrievingTheRightColor.getForeground();
textBarForRetrievingTheRightColor.dispose();
if (targetPart instanceof StatusTextEditor textEditor) {
Control targetWidget = textEditor.getAdapter(ITextViewer.class).getTextWidget();
backgroundToUse = targetWidget.getBackground();
normalTextForegroundColor = targetWidget.getForeground();
} else {
Text textBarForRetrievingTheRightColor = new Text(container, SWT.SINGLE | SWT.SEARCH);
container.layout();
backgroundToUse = textBarForRetrievingTheRightColor.getBackground();
normalTextForegroundColor = textBarForRetrievingTheRightColor.getForeground();
textBarForRetrievingTheRightColor.dispose();
}
}


Expand Down

0 comments on commit be8946a

Please sign in to comment.