Skip to content

Select the best match in the quick selection mode of FilteredTree - #4580

Open
anydoby wants to merge 3 commits into
eclipse-platform:masterfrom
anydoby:quick-selection-best-match
Open

anydoby wants to merge 3 commits into
eclipse-platform:masterfrom
anydoby:quick-selection-best-match

Conversation

@anydoby

@anydoby anydoby commented Nov 18, 2026 •

Copy link
Copy Markdown

In the New wizard dialog (Ctrl+N), the filter text "File" selects "Java Project from Existing Ant Buildfile" (anyone using ant today?) and not the "File" wizard for many years. It used to be correct a long time ago (maybe back it 2009 ;).

quick-selection-before

Cause: in the quick selection mode, FilteredTree selects the first match in tree order.

Fix: the quick selection mode now selects the best match. A label equal to the filter text is first, then a label that starts with the filter text, then all other matches. Equal matches keep the tree order. When the filter text gets longer, the selection moves to a better match. When it gets shorter, a matching selection stays. Other modes do not change.

Tests: three new tests in FilteredTreeTests; all 20 tests pass. I also tested the change in my Eclipse IDE.

🤖 Generated with Claude Code

In the quick selection mode, FilteredTree selected the first match in
the tree. In the New wizard dialog, the filter text "File" selected
"Java Project from Existing Ant Buildfile" and not the "File" wizard.

Now an item with a label equal to the filter text is the best match,
then an item with a label that starts with the filter text, then all
other matches. When the filter text gets longer, the selection moves
to a better match. When the filter text gets shorter, the selection
stays while it matches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@anydoby
anydoby marked this pull request as ready for review November 18, 2026 20:30
@anydoby

anydoby commented Nov 18, 2026

Copy link
Copy Markdown
Author

Good evening, @merks. Could you review this one? It's been bugging me for many years. I fixed it for myself, but maybe community will also find saving a couple finger movements to create a file useful ;)

@merks
merks requested a balanced review from Copilot November 19, 2026 09:33
@merks
merks requested a review from vogella November 19, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Quick selection can replace matching selected views, miss exact matches in unexpanded branches or after rapid edits, and cause unnecessary UI-thread work in large trees.

4 open issues
What changed in this PR

Updates the workbench’s FilteredTree quick-selection mode to prefer more relevant results, addressing cases where typing “File” in the New wizard dialog selects a weaker match.

Changes:

  • Ranks exact label matches ahead of prefixes and other matches.
  • Adds selection-retention logic as the filter changes, without changing other selection modes.
  • Updates documentation and adds three regression tests.
File Description
tests/​org.eclipse.ui.tests/​Eclipse UI Tests/​org/​eclipse/​ui/​tests/​filteredtree/​FilteredTreeTests.java Tests exact-match priority, selection movement, and retention while typing.
bundles/​org.eclipse.ui.workbench/​eclipseui/​org/​eclipse/​ui/​dialogs/​FilteredTree.java Implements ranked quick selection and documents the matching order.

Review effort: Balanced

@vogella

vogella commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

That looks like a nice enhancement, thanks @anydoby. Please handle the Copilot feedback and ping me once done. We are currently in the release freeze for 2026-12 so this will have to wait a few weeks, IIRC master is supposed to open end of November again. Please also check the e4 variant (which is more modern one of the dialogs) and also see my pending change here: #4493

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   867 files  ±0     867 suites  ±0   43m 43s ⏱️ - 7m 16s
 8 551 tests +3   8 311 ✅ +3  240 💤 ±0  0 ❌ ±0 
21 525 runs  +9  20 852 ✅ +9  673 💤 ±0  0 ❌ ±0 

Results for commit f2890e0. ± Comparison against base commit b5dd338.

Search the filtered model, not the tree items, so a match in a branch
that the refresh job did not expand is also found. Stop the search
after the expand time limit and skip cycles. Compare the text of the
first column. Keep a matching selection only when the filter text was
made shorter than the text of the last quick selection, and reveal it.
Compare the items of a multi-selection. Get the rank before the more
costly match check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@anydoby

anydoby commented Nov 20, 2026

Copy link
Copy Markdown
Author

@vogella, thanks. I fixed the Copilot comments in 9c9c2c0, with a test for each one. The search now also finds matches in collapsed branches, with the same time limit as the expand step.

e4 variant: I put the same change on top of #4493, with two tests in E4FilteredTreeTests: https://github.com/anydoby/eclipse.platform.ui/commits/e4-quick-selection-best-match (commits 38186cd and c5ee509). You can take it into #4493, or I can open a PR when #4493 is merged. I will wait for the end of the freeze.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants