Skip to content

Commit aae915a

Browse files
committed
SwingSearchBar: rename search text field
The phrase "search term" typically implies a single token, with a search query consisting of one or more terms.
1 parent 4eda530 commit aae915a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/org/scijava/ui/swing/search/SwingSearchBar.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,12 @@ public class SwingSearchBar extends JTextField {
124124

125125
private final JButton closeButton;
126126

127+
/** Currently active text search. */
128+
private String searchText;
129+
127130
/** The maximum number of results per search category. */
128131
private int resultLimit = 8;
129132

130-
private String searchTerm;
131-
132133
public SwingSearchBar(final Context context) {
133134
super(DEFAULT_MESSAGE, 12);
134135
context.inject(this);
@@ -454,14 +455,14 @@ public void mouseMoved(final MouseEvent e) {
454455
else {
455456
// populate details pane
456457
detailsTitle.setText("<html><h2>" + highlightSearchUnderline(
457-
escapeHtml(result.name()), searchTerm) + "</h2>");
458+
escapeHtml(result.name()), searchText) + "</h2>");
458459
detailsProps.removeAll();
459460
result.properties().forEach((k, v) -> {
460461
if (v != "") {
461462
if (k == null) {
462463
final JTextPane textPane = new JTextPane();
463464
textPane.setContentType("text/html");
464-
textPane.setText(highlightSearchBold(v, searchTerm));
465+
textPane.setText(highlightSearchBold(v, searchText));
465466
final Font font = UIManager.getFont("Label.font");
466467
final String bodyRule = "body { font-family: " + font
467468
.getFamily() + "; " + "font-size: " + font.getSize() +
@@ -540,7 +541,7 @@ public void mouseMoved(final MouseEvent e) {
540541

541542
public void search(final String text) {
542543
assertDispatchThread();
543-
searchTerm = text;
544+
searchText = text;
544545
operation.search(text.toLowerCase());
545546
}
546547

@@ -639,7 +640,7 @@ private void rebuild() {
639640
resultsList.setModel(listModel);
640641

641642
// TODO: Improve retainment of previous selection.
642-
if (!searchTerm.isEmpty()) {
643+
if (!searchText.isEmpty()) {
643644
if (previous == null) {
644645
if (listModel.getSize() > 0) {
645646
resultsList.setSelectedIndex(firstResultIndex());

0 commit comments

Comments
 (0)