From 9402543634c86e5fc7f1652abc12f1c5816ab816 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 3 May 2017 15:49:31 +0200 Subject: Bug 515836 - Search Dialog labels have different colors in dark theme The status label gets styled dynamically if regular expressions are used. To avoid that the label uses its styling information we use the foreground color of another label to set its foreground color back to the color from the styling. Change-Id: I3b18830eaf3e8ba496490dcbacc0814c4c468571 Signed-off-by: Lars Vogel --- .../search/internal/ui/text/TextSearchPage.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java index abe628986c7..fd14647febd 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -140,6 +140,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP * @since 3.6 */ private String[] fPreviousExtensions; + private Label fFileNamePatternDescription; private static class SearchPatternData { @@ -749,11 +750,10 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP fFileTypeEditor= new FileTypeEditor(fExtensions, button); - // Text line which explains the special characters - Label description= new Label(group, SWT.LEAD); - description.setText(SearchMessages.SearchPage_fileNamePatterns_hint); - description.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); - description.setFont(group.getFont()); + fFileNamePatternDescription = new Label(group, SWT.LEAD); + fFileNamePatternDescription.setText(SearchMessages.SearchPage_fileNamePatterns_hint); + fFileNamePatternDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); + fFileNamePatternDescription.setFont(group.getFont()); Group searchInGroup= new Group(group, SWT.NONE); @@ -903,10 +903,13 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP private void statusMessage(boolean error, String message) { fStatusLabel.setText(message); - if (error) + if (error) { fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay())); - else - fStatusLabel.setForeground(null); + } + else { + // use same color as another label to respect styling + fStatusLabel.setForeground(fFileNamePatternDescription.getForeground()); + } } } -- cgit v1.2.3