From 370f4149825e18a54068ec6e21cd8cecfa82c831 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Sun, 3 Nov 2013 19:14:34 +0100 Subject: [PATCH] customizable search controls --- .../src/com/intellij/ui/SearchTextField.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/SearchTextField.java b/platform/platform-api/src/com/intellij/ui/SearchTextField.java index 8603393f1e9b..b2bd48ebc04d 100644 --- a/platform/platform-api/src/com/intellij/ui/SearchTextField.java +++ b/platform/platform-api/src/com/intellij/ui/SearchTextField.java @@ -101,7 +101,7 @@ public class SearchTextField extends JPanel { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DOWN) { - if (hasNativeLeopardSearchControl() && myNativeSearchPopup != null) { + if (isSearchControlUISupported() && myNativeSearchPopup != null) { myNativeSearchPopup.show(myTextField, 5, myTextField.getHeight()); } else if (myPopup == null || !myPopup.isVisible()) { showPopup(); @@ -110,10 +110,10 @@ public class SearchTextField extends JPanel { } }); - if (hasNativeLeopardSearchControl() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) { + if (isSearchControlUISupported() || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) { myTextField.putClientProperty("JTextField.variant", "search"); } - if (hasNativeLeopardSearchControl()) { + if (isSearchControlUISupported()) { if (historyEnabled) { myNativeSearchPopup = new JBPopupMenu(); myNoItems = new JBMenuItem("No recent searches"); @@ -203,11 +203,11 @@ public class SearchTextField extends JPanel { } } - private static boolean hasNativeLeopardSearchControl() { + protected boolean isSearchControlUISupported() { return (SystemInfo.isMacOSLeopard && UIUtil.isUnderAquaLookAndFeel()) || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF(); } - private static boolean hasIconsOutsideOfTextField() { + protected boolean hasIconsOutsideOfTextField() { return UIUtil.isUnderGTKLookAndFeel() || UIUtil.isUnderNimbusLookAndFeel(); } @@ -419,7 +419,7 @@ public class SearchTextField extends JPanel { } public void setSearchIcon(final Icon icon) { - if (! hasNativeLeopardSearchControl()) { + if (! isSearchControlUISupported()) { myToggleHistoryLabel.setIcon(icon); } }