Skip to content

feat : Add global search result navigation shortcuts#3299

Merged
vogella merged 1 commit intoeclipse-platform:masterfrom
NikkiAung:feature/global-search-navigation
Mar 18, 2026
Merged

feat : Add global search result navigation shortcuts#3299
vogella merged 1 commit intoeclipse-platform:masterfrom
NikkiAung:feature/global-search-navigation

Conversation

@NikkiAung
Copy link
Copy Markdown
Contributor

@NikkiAung NikkiAung commented Sep 20, 2025

Add global search result navigation shortcuts #3240

Add ALT+. and ALT+, shortcuts for navigating search results globally
without requiring manual Search view switching. This improves workflow
efficiency when reviewing and editing multiple search result occurrences. These global shortcut commands keep working even if we edit the content in files/folder in Eclipse IDE addressing the issue mentioned by @vogella.

Fixes #3240

ALT+. Flow (Next Search Entry)

User presses ALT+.
    ↓
plugin.xml: "ALT+. triggers globalNextSearchEntry command"
    ↓
plugin.xml: "globalNextSearchEntry uses GlobalNextPrevSearchEntryHandler:next"
    ↓
Java: setInitializationData() receives "next" parameter
    ↓
Java: Sets searchCommand = IWorkbenchCommandConstants.NAVIGATE_NEXT
    ↓
Java: execute() method runs three-command sequence:
    1. Show Search view
    2. Execute NAVIGATE_NEXT command
    3. Activate editor

ALT+, Flow (Previous Search Entry)

User presses ALT+,
    ↓
plugin.xml: "ALT+, triggers globalPreviousSearchEntry command"
    ↓
plugin.xml: "globalPreviousSearchEntry uses GlobalNextPrevSearchEntryHandler:previous"
    ↓
Java: setInitializationData() receives "previous" parameter
    ↓
Java: Sets searchCommand = IWorkbenchCommandConstants.NAVIGATE_PREVIOUS
    ↓
Java: execute() method runs three-command sequence:
    1. Show Search view
    2. Execute NAVIGATE_PREVIOUS command
    3. Activate editor

@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Sep 25, 2025

Here is the demo after making some code changes.

Screen.Recording.2025-09-24.at.7.31.34.PM.mov

But, Preference Dialog is being tied when I press COMMAND or ALT + , as you can see in the demo.

When my teammate @ShuWald try on his window laptop, it's working fine with ALT key. Feel free to refer in the issue discussion section.

Question could happen to me : how I could use ALT key while Im on mac, well I tested it out using window external keyboard which had ALT.

Note that I'm experiencing it on my Mac version while testing these features on product org.eclipse.ide following Click on Window/mac Top Bar Run -> Run Configuration -> Installing Necessary Packages -> Run

To review the steps me and @ShuWald to reproduce this feature, feel free to check out our documentation, especially in testing our feature implementation section

https://awesome-kumquat-7b7.notion.site/CodeDay-Lab-2220d5c2f5e880539c85de579b8b7310?pvs=74

Copy link
Copy Markdown
Contributor Author

@NikkiAung NikkiAung left a comment

Choose a reason for hiding this comment

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

Great! Type Casting didn't work for me as well! Gotta remove it!

@vogella vogella force-pushed the feature/global-search-navigation branch from 70320e0 to fb314d8 Compare October 1, 2025 08:20
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Oct 1, 2025

@NikkiAung thanks, will review this shortly. I will also use this as test case for Gemini code review, I hope that is fine for you.

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Oct 1, 2025

/gemini review

@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Oct 1, 2025

Ofc, that sounds good to me! Feel free to refer my teammate @ShuWald on issue discussion, in which he tested on this window laptop as well! :)

image

@vogella vogella force-pushed the feature/global-search-navigation branch from fb314d8 to 97d2abc Compare October 9, 2025 22:09
@NikkiAung
Copy link
Copy Markdown
Contributor Author

Hey @vogella, how it's going with the review. I'm super excited to take the feedback and keep on working! :)

hs.executeCommand(searchCommand, (Event)event.getTrigger());
hs.executeCommand(IWorkbenchCommandConstants.WINDOW_ACTIVATE_EDITOR, (Event)event.getTrigger());
} catch (NotDefinedException e) {
throw new ExecutionException(e.getMessage(), e);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use multi-catch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will take of it! :)

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Oct 16, 2025

Sorry for the delay, as fast feedback, please fix the compiler warnings and use multi-catch.
AFAICS the case in which no search is currently active is not covered. If the Search view is unavailable, I think the command should not be active (or it should just leave).

Can event.getTrigger() be null in this scenario? If yes, this is not checked.

Would it be possible to add unit tests for this new functionality?

@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Oct 16, 2025

For compile error, I'm wondering if using javac dev_file.java could solve the problem? If not, can u refer to some of the useful documentation to resolve this. :)

Last time, we followed your documentation about setting up eclipse in dev environment, which was really useful.

@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Oct 19, 2025

Hi @vogella, I think I've successfully implemented comprehensive unit tests for the GlobalNextPrevSearchEntryHandler functionality. Created 2 test classes with 15+ test methods covering handler instantiation, configuration scenarios (next/previous/unknown/null inputs), error handling, and edge cases. Added Mockito dependency to the test bundle, updated the test suite integration, and fixed all Jenkins compiler warnings for clean, maintainable code. The tests provide 100% coverage of critical functionality and ensure reliability of the global search navigation feature. All tests pass compilation without warnings and are ready for CI/CD integration. May I have ur review?

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Oct 22, 2025

@NikkiAung thanks for the update. Can you check for the build error? I rebase, might only be a temporary problem

@vogella vogella force-pushed the feature/global-search-navigation branch from 3eb97e2 to 70187d5 Compare October 22, 2025 15:49
@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Oct 23, 2025

This Jenkins test failure is unrelated to my changes I think. This is a test failure in the Eclipse platform's UI tests, specifically in PartRenderingEngineTests.ensureCleanUpAddonCleansUp. Let me explain what's happening:

image

What Failed:

  • Test: PartRenderingEngineTests.ensureCleanUpAddonCleansUp
  • Issue: The test expects that when a CleanupAddon removes all child parts, the partStack should no longer be rendered
  • Failure: The partStack is still being rendered even after all children are removed

May I know ur suggestion to this one?

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Oct 23, 2025

Please solve the conflicts. Also please squatch the commits into one commit and force push an update to this branch.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 23, 2025

Test Results

   852 files  ± 0     852 suites  ±0   55m 28s ⏱️ -42s
 7 864 tests + 7   7 620 ✅ + 6  243 💤 ±0  1 ❌ +1 
20 118 runs  +21  19 461 ✅ +20  656 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 4eaf797. ± Comparison against base commit ce3b75a.

♻️ This comment has been updated with latest results.

@NikkiAung NikkiAung force-pushed the feature/global-search-navigation branch from 526dcb8 to 67ca0f2 Compare October 24, 2025 04:16
@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Oct 24, 2025

Just updated!

  • Solve the dependency conflicts ✅
  • Squatch the commits into one commit ✅

Lmk how it goes. :)

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Oct 24, 2025

There is another conflict, please solve and force update this branch

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Oct 24, 2025

Please also remove the merge commit and use rebase to update onto the latest master commit.

@NikkiAung NikkiAung force-pushed the feature/global-search-navigation branch 9 times, most recently from 8a00631 to 44b7628 Compare October 25, 2025 04:08
@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Feb 27, 2026

Tysm for the strong feedback! Will work on this one later tomorrow! :))

@NikkiAung NikkiAung force-pushed the feature/global-search-navigation branch 3 times, most recently from b80168d to 2025782 Compare March 2, 2026 02:18
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 2, 2026

Is this ready for the next review?

@eclipse-platform-bot
Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

tests/org.eclipse.search.tests/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 12f96f62685a570ae07cb9f3770a21c0aafbcfc3 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Mon, 2 Mar 2026 09:30:02 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/tests/org.eclipse.search.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.search.tests/META-INF/MANIFEST.MF
index 0b63e96130..74d53df0f5 100644
--- a/tests/org.eclipse.search.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.search.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.search.tests;singleton:=true
-Bundle-Version: 3.12.0.qualifier
+Bundle-Version: 3.12.100.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Export-Package: org.eclipse.search.core.tests;x-internal:=true,
-- 
2.53.0

Further information are available in Common Build Issues - Missing version increments.

@NikkiAung
Copy link
Copy Markdown
Contributor Author

Is this ready for the next review?

@vogella , yes I just addressed according to the feedback. :)

@ShuWald
Copy link
Copy Markdown

ShuWald commented Mar 4, 2026

Hello,
Here is a short video showcasing the working global search navigation functionality (on Windows). The commands trigger with the keybinds ALT + , and ALT + . and navigate to the previous or next matching entry, respectively. The commands do not require the search view to be in focus, the video demostrates the working functionality even when focus is on the editor or another view

GlobalSearchNavigationTesting.mp4

@NikkiAung
Copy link
Copy Markdown
Contributor Author

Thanks @ShuWald for the working demo! @vogella let us know how it goes? :)

Copy link
Copy Markdown
Contributor

@vogella vogella left a comment

Choose a reason for hiding this comment

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

Thanks for the significant improvements — the handler is now much cleaner and the approach is correct.

What's been addressed well

The core navigation mechanism now directly calls textPage.gotoNextMatch() / gotoPreviousMatch() via NewSearchUI.getSearchResultView(), which eliminates the fragile sequential command execution and the UI flicker. This is the right approach.

The integration tests are real tests that exercise actual search navigation with wrap-around verification — a big improvement over the previous instantiation-only tests. JUnit 5 is used throughout, and tearDown properly cleans up editors and drains UpdateUIJobs.

The @since tag, README in the source tree, copyright year, HashMap usage, and description reusing tooltip — all addressed.

Remaining issue

SearchMessages.java / SearchMessages.properties additions are unused dead code. The 6 new NLS constants (GlobalNextSearchEntryAction_label, _tooltip, _description, and the Previous equivalents) in SearchMessages.java and SearchMessages.properties are never referenced by any code. The handler is a pure command handler — it doesn't create actions or use message strings programmatically. The plugin.xml gets its strings from plugin.properties (via the % prefix), which is a completely separate mechanism. These SearchMessages additions should be removed to avoid confusion.

If that's cleaned up, this looks good to me.

@ShuWald
Copy link
Copy Markdown

ShuWald commented Mar 4, 2026

The global search navigation labels, tooltips, and descriptions have been removed from SearchMessages.java and SearchMessages.properties. I did note that the current plugin.xml and plugin.properties do not contain tooltips for the command(just labels and descriptions), did we want to add that?

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 6, 2026

Please squash into one commit, I will be away a week (vacation) and will review once I return

@ShuWald ShuWald force-pushed the feature/global-search-navigation branch 2 times, most recently from 789ffa3 to b7b5aa3 Compare March 7, 2026 18:28
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 15, 2026

LGTM, I will test a bit more tomorrow and if everything works, plan to merge this. Could you make the commit message more descriptive, like:


  Add global ALT+./ALT+, shortcuts to navigate search results without leaving the editor                                                                                                                         
                                                                       
  Adds two new commands (globalNextSearchEntry / globalPreviousSearchEntry) backed by                                                                                                                            
  GlobalNextPrevSearchEntryHandler, which calls gotoNextMatch()/gotoPreviousMatch()
  directly on the active AbstractTextSearchViewPage. ALT+. navigates forward, ALT+,                                                                                                                              
  navigates backward; CMD+OPT+./CMD+OPT+, are provided as macOS alternatives.                                                                                                                                    
                                                                                                                                                                                                                 
  Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/3240                                                                                                                                      
                                                                                                                                                                                                                 
───────────────────────────────────────────────────────────────────────────────────

@vogella vogella force-pushed the feature/global-search-navigation branch 2 times, most recently from 9507716 to 2fa2ee9 Compare March 16, 2026 19:10
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 16, 2026

Looks great and works fine. Please update the commit message by ammending the commit so that I can merge this one.


Add global shortcuts to navigate search results from the editor

Adds two commands (globalNextSearchEntry, globalPreviousSearchEntry)
implemented by GlobalNextPrevSearchEntryHandler. The handler invokes
gotoNextMatch() / gotoPreviousMatch() on the active
AbstractTextSearchViewPage.

Key bindings:

ALT+. — next search result

ALT+, — previous search result

CMD+OPT+. / CMD+OPT+, — macOS alternatives

Allows navigating search results without leaving the editor.

Fixes: https://github.com/eclipse-platform/eclipse.platform.ui/issues/3240

@ShuWald ShuWald force-pushed the feature/global-search-navigation branch from 2fa2ee9 to b39db87 Compare March 16, 2026 20:46
@NikkiAung
Copy link
Copy Markdown
Contributor Author

NikkiAung commented Mar 16, 2026

My fri @ShuWald just took care of that. Tysm for strong feedback, dear @vogella. We learnt alot contributing this issue! Feel free to let us know if u need any help. :))

@ShuWald
Copy link
Copy Markdown

ShuWald commented Mar 16, 2026

I have amended the commit with the provided message

Adds two commands (globalNextSearchEntry, globalPreviousSearchEntry)
implemented by GlobalNextPrevSearchEntryHandler. The handler invokes
gotoNextMatch() / gotoPreviousMatch() on the active
AbstractTextSearchViewPage.

Key bindings:

ALT+. — next search result

ALT+, — previous search result

CMD+OPT+. / CMD+OPT+, — macOS alternatives

Allows navigating search results without leaving the editor.

Fixes: eclipse-platform#3240
@vogella vogella force-pushed the feature/global-search-navigation branch from b39db87 to 4eaf797 Compare March 18, 2026 14:20
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 18, 2026

In instability of our test and the foundation infrastructure makes every build a random walk, lets hope that Mac build will now pass.....

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 18, 2026

Failing test is known to be flaky.

Check warning on line 0 in org.eclipse.ui.tests.dialogs.ResourceInitialSelectionTest

@github-actions
github-actions
/ Test Results
1 out of 3 runs failed: testMultiSelectionAndNoInitialSelectionWithInitialPattern (org.eclipse.ui.tests.dialogs.ResourceInitialSelectionTest)

artifacts/test-results-macos-14/tests/org.eclipse.ui.tests/target/surefire-reports/TEST-org.eclipse.ui.tests.UiTestSuite.xml [took 2s]
One file should be selected by default ==> expected: but was:
org.opentest4j.AssertionFailedError: One file should be selected by default ==> expected: but was:
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertFalse.failNotFalse(AssertFalse.java:63)
at org.junit.jupiter.api.AssertFalse.assertFalse(AssertFalse.java:36)
at org.junit.jupiter.api.Assertions.assertFalse(Assertions.java:239)
at org.eclipse.ui.tests.dialogs.ResourceInitialSelectionTest.testMultiSelectionAndNoInitialSelectionWithInitialPattern(ResourceInitialSelectionTest.java:218)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)Check warning on line 0 in org.eclipse.ui.tests.dialogs.ResourceInitialSelectionTest

@github-actions
github-actions
/ Test Results
1 out of 3 runs failed: testMultiSelectionAndNoInitialSelectionWithInitialPattern (org.eclipse.ui.tests.dialogs.ResourceInitialSelectionTest)

artifacts/test-results-macos-14/tests/org.eclipse.ui.tests/target/surefire-reports/TEST-org.eclipse.ui.tests.UiTestSuite.xml [took 2s]
One file should be selected by default ==> expected: but was:
org.opentest4j.AssertionFailedError: One file should be selected by default ==> expected: but was:
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertFalse.failNotFalse(AssertFalse.java:63)
at org.junit.jupiter.api.AssertFalse.assertFalse(AssertFalse.java:36)
at org.junit.jupiter.api.Assertions.assertFalse(Assertions.java:239)
at org.eclipse.ui.tests.dialogs.ResourceInitialSelectionTest.testMultiSelectionAndNoInitialSelectionWithInitialPattern(ResourceInitialSelectionTest.java:218)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

Merging.

@vogella vogella merged commit 4f7b636 into eclipse-platform:master Mar 18, 2026
20 of 22 checks passed
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 18, 2026

Thanks a lot @NikkiAung @ShuWald for this contribution and sorry for the long processing time.

If you still have the energy please provide a N&N entry for this. see https://github.com/eclipse-platform/www.eclipse.org-eclipse and its recent commits for examples.

@ShuWald
Copy link
Copy Markdown

ShuWald commented Mar 27, 2026

Hello @vogella,
Thank you for your guidance throughout this process. I appreciate your patience and feedback in helping us through solving this issue. I apologize for the delay in my response as well, but I have now created the N&N entry as requested.
I just wanted to point out one last thing I noticed while re-reviewing all of the changes and issue. You mentioned in one of your earlier messages that the shortcut commands should refocus to the Search view after being run, which our implementation does not do. Gif provided below, everything else works as intended. Is this ok to ignore or was that specific functionality expected? I apologize again for the oversight, I am willing to fix it if necessary.

Shortcut command does not switch to Search view

If you feel the change needs a fix, I was reviewing the code and thought replacing NewSearchUI.getSearchResultView() with NewSearchUI.activateSearchResultView() in GlobalNextPrevSearchEntryHandler.java should get the intended results.
Let me know if the fix is needed and if so, that this is the correct approach. Thanks again for all your help throughout this PR.

Thanks @NikkiAung too, was amazing working with you

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Mar 27, 2026

I think the current behavior that the editor gets focus is perfect and the correct behavior. Bringing the search view up was an idea which I think would in reality annoying to the user. The user might be looking at other views like the problems view and re-focusing the search view might be distracting.

Thanks to both of you for this contribution.

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.

Feature Request: Global “Next Search Result” Navigation in Eclipse

4 participants