Skip to content

Commit

Permalink
Add and use icons for Case Sensitivity and Reg Ex
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgeiger committed Mar 14, 2016
1 parent 680c615 commit 57abf99
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/sf/jabref/gui/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ public enum JabRefIcon {
FIND_DUPLICATES("\uf16b"), /*css: code-equal */

OPEN_IN_NEW_WINDOW("\uf3cc"), /*css: open-in-new */
CASE_SENSITIVE("\uf02c"), /* css: mdi-alphabetical */
REG_EX("\uf451"), /*css: mdi-regex */

// STILL MISSING:
GROUP_REGULAR("\uF4E6", Color.RED);
Expand Down
27 changes: 19 additions & 8 deletions src/main/java/net/sf/jabref/gui/search/SearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.List;
Expand Down Expand Up @@ -65,9 +67,9 @@ public class SearchBar extends JPanel {

private SearchMode searchMode = getSearchModeFromSettings();

private final JCheckBox caseSensitive;
private final JToggleButton caseSensitive;
private final JToggleButton regularExp;

private final JCheckBox regularExp;
private final JLabel currentResults = new JLabel("");

private AutoCompleteSupport<String> autoCompleteSupport;
Expand All @@ -86,12 +88,21 @@ public SearchBar(BasePanel basePanel) {

currentResults.setFont(currentResults.getFont().deriveFont(Font.BOLD));

caseSensitive = new JCheckBox(Localization.lang("Case sensitive"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_CASE_SENSITIVE));
caseSensitive.addItemListener(ae -> performSearch());
caseSensitive.addItemListener(ae -> updatePreferences());
regularExp = new JCheckBox(Localization.lang("regular expression"), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REG_EXP));
regularExp.addItemListener(ae -> performSearch());
regularExp.addItemListener(ae -> updatePreferences());
caseSensitive = new JToggleButton(IconTheme.JabRefIcon.CASE_SENSITIVE.getSmallIcon(),Globals.prefs.getBoolean(JabRefPreferences.SEARCH_CASE_SENSITIVE));
caseSensitive.setToolTipText(Localization.lang("Case sensitive"));
caseSensitive.addActionListener(e -> {
performSearch();
updatePreferences();
});


regularExp = new JToggleButton(IconTheme.JabRefIcon.REG_EX.getSmallIcon(), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REG_EXP));
regularExp.setToolTipText(Localization.lang("regular expression"));
regularExp.addActionListener(e -> {
performSearch();
updatePreferences();
});


openCurrentResultsInDialog = new JButton(IconTheme.JabRefIcon.OPEN_IN_NEW_WINDOW.getSmallIcon());
openCurrentResultsInDialog.setToolTipText(Localization.lang("Show search results in a window"));
Expand Down

0 comments on commit 57abf99

Please sign in to comment.