Skip to content

Conversation

@eirikbakke
Copy link
Contributor

Quick search is the little search bar that pops up when you start typing in various NetBeans explorer view components:

image

This PR unifies the search bar behavior in OutlineView, TreeTable, and ListView, with some adjustments and bug fixes. Mostly the search bar should work like a search bar in any other app, e.g. Chrome. Some common alternative keystrokes are handled for Find Next/Previous.

Details:

  • For OutlineView and TreeTable, avoid changing the selection when pressing Escape. (TreeView already has the desired behavior.)
  • Add F3 and Ctrl/Command+G as alternative keystrokes for next-match (and Shift variants for previous-match).
  • Have QuickSearch select all when invoking Ctrl+F or alternative shortcuts while the search bar is already open.
  • Make the ListView's quick search box look more modern, and consistent with that of OutlineView/TreeView. Use the magnifying glass icon instead of the text 'Search', and use a flat border style. Note that ListView has a "floating" search bar instead of one attached to the bottom of the box; I have not changed this.
    • image
  • Add more alternative find-next/previous keystrokes for ListView, like I did in the QuickSearch class (which is used by TreeView and OutlineView but not ListView). On Ctrl+F or F3, open the search bar, or select-all the existing text if it is already open.
  • In OutlineView and TreeTable, avoid backtracking to the first hit if backspace is pressed on a still-matching selection.

@eirikbakke eirikbakke added Platform [ci] enable platform tests (platform/*) UI User Interface labels Mar 11, 2025
Details:
* For OutlineView and TreeTable, avoid changing the selection when pressing Escape. (TreeView already has the desired behavior.)
* Add F3 and Ctrl/Command+G as alternative keystrokes for next-match (and Shift variants for previous-match).
* Have QuickSearch select all when invoking Ctrl+F or alternative shortcuts while the search bar is already open.
* Make the ListView's quick search box look more modern, and consistent with that of OutlineView/TreeView. Use the magnifying glass icon instead of the text 'Search', and use a flat border style.
* Add more alternative find-next/previous keystrokes for ListView, like we did in QuickSearch (which is used by TreeView and OutlineView but not ListView). On Ctrl+F or F3, open the search bar, or select-all the existing text if it is already open.
* In OutlineView and TreeTable, avoid backtracking to the first hit if backspace is pressed on a still-matching selection.
@mbien mbien added this to the NB26 milestone Mar 12, 2025
@neilcsmith-net neilcsmith-net modified the milestones: NB26, NB27 Apr 16, 2025
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this introduces regressions in the IDE (see inline comments). I don't think this should merged as is.

keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT ||
keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_F3) {
keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_F3 ||
keyCode == KeyEvent.VK_ENTER && ke.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keyCode == KeyEvent.VK_ENTER && ke.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK ||
(keyCode == KeyEvent.VK_ENTER && ke.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK) ||

Comment on lines +795 to +796
keyCode == KeyEvent.VK_F3 && e.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK ||
keyCode == KeyEvent.VK_ENTER && e.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keyCode == KeyEvent.VK_F3 && e.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK ||
keyCode == KeyEvent.VK_ENTER && e.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK ||
(keyCode == KeyEvent.VK_F3 && e.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK) ||
(keyCode == KeyEvent.VK_ENTER && e.getModifiersEx() == KeyEvent.SHIFT_DOWN_MASK) ||

}
});
InputMap im = component.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
im.put(Utilities.stringToKey("D-F"), "openQuickSearch");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a problem in Project and Files views in the IDE as it overrides the project wide searches.

keyCode == KeyEvent.VK_F3 && e.getModifiersEx() == 0 ||
/* We can't use ENTER to go to the next match, as this keystroke is used to
invoke the row's default action. */
/* keyCode == KeyEvent.VK_ENTER && e.getModifiersEx() == 0 || */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really make sense to handle Shift-Enter, but not Enter?

quickSearchInitialColumn = -1;
}

private static final boolean RESTORE_PRIOR_SELECTION_AFTER_QUICK_SEARCH = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the idea here? Is this a fancy way of commenting out code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry I left that in. I'll remove it...

(Yes, fancy way to comment out code, especially when I need to experiment with different UI behaviors for a while before deciding what works or not. It also survives later refactoring.)

@neilcsmith-net neilcsmith-net modified the milestones: NB27, NB28 Jul 18, 2025
@mbien
Copy link
Member

mbien commented Oct 8, 2025

moving to NB29

@mbien mbien modified the milestones: NB28, NB29 Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Platform [ci] enable platform tests (platform/*) UI User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants