Repository navigation
Do not block the UI thread on the workspace lock when opening a match - #4563
Open
fedejeanne wants to merge 1 commit into
Open
fedejeanne wants to merge 1 commit into
fedejeanne wants to merge 1 commit into
Conversation
Opening a search match in an editor that is not a text editor (for example the plug-in manifest editor) froze the UI for as long as another thread held the workspace lock, up to several tens of seconds during startup. The search selected the match through a temporary marker and created, changed and deleted that marker on the UI thread. Each of these steps waited for the workspace lock, so a slow resource change listener, such as the Java model update after a classpath change, blocked the UI up to three times per click. Opening a match no longer waits for the workspace lock. Editors that provide a text editor through an adapter, like many multi-page and wrapper editors, select the match directly, without a marker. In multi-page editors this selects in the active text page. All other editors open at once and show the selection as soon as the workspace allows it. When the user opens several matches in a row, only the latest one is selected, and nothing is selected in an editor that was closed or shows another input meanwhile. A failure to create the marker is now logged instead of shown in a dialog. The marker is created in one workspace operation by a background job, and the editor reveals it asynchronously in the UI thread. The jobs share one scheduling rule, so pending requests that are superseded are cancelled before they touch the workspace. Contributes to: eclipse-pde/eclipse.pde#1715 Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the search-result navigation changes.
No open issues 🎉
What changed in this PR
This PR updates search-result navigation to avoid blocking the UI thread on workspace-locked marker operations when opening non-text editors.
Changes:
- Selects matches directly in editors that adapt to
ITextEditor. - Moves temporary marker creation and deletion to background jobs, with checks for superseded requests and closed or changed editors.
- Adds regression tests, supporting test editors, and localized job names.
| File | Description |
|---|---|
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/TextEditorWrapper.java |
Adds a wrapper editor for testing direct text selection. |
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/GotoMarkerOnlyEditor.java |
Adds an editor that records marker-based navigation. |
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/EditorOpenerTest.java |
Tests responsiveness, request cancellation, editor closure, and marker cleanup. |
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AllFileSearchTests.java |
Includes the new regression tests in the suite. |
tests/org.eclipse.search.tests/plugin.xml |
Registers both test editors. |
bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java |
Adds adapter-based selection and asynchronous marker handling. |
bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties |
Defines localized marker-job labels. |
bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java |
Exposes the new job-label message fields. |
Review effort: Balanced
Contributor
fedejeanne
marked this pull request as ready for review
November 13, 2026 12:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to: eclipse-pde/eclipse.pde#1715
Problem
Opening a search match in an editor that is not a text editor (for example the plug-in manifest editor) freezes the UI while another thread holds the workspace lock. The search selects the match through a temporary marker and creates, changes and deletes that marker on the UI thread. Each of these steps waits for the workspace lock, so a slow resource change listener blocks the UI up to three times per click. CPU samples of real IDEs during startup show waits of 4 s, 44 s (14 s + 30 s) and 52 s, while JDT's
DeltaProcessor.resourceChangedheld the lock in aPOST_CHANGEnotification:How to reproduce it manually
I observed this UI freeze when I did this in my Committer IDE (m2e is necessary for the reproduction) version I20261025-2300 :
Ctrl + h) and search forprofilesinpom.xmlWhat it does
Opening a match no longer waits for the workspace lock. Editors that provide a text editor through an adapter, like many multi-page and wrapper editors, select the match directly without a marker; in a multi-page editor this selects in the active text page. All other editors open at once and show the selection as soon as the workspace allows it. When the user opens several matches in a row, only the latest one is selected, and nothing is selected in an editor that was closed or shows another input meanwhile. A failure to create the marker is now logged instead of shown in a dialog.
Technical concept
The marker is created in one workspace operation (
createMarker(type, attributes)) by a background job, and the editor reveals it asynchronously in the UI thread; the marker is deleted in the background afterwards. All these jobs share one scheduling rule, so pending requests that are superseded are cancelled before they touch the workspace instead of each waiting for the lock.How to test
Locally
org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged..classpathof a Java project. The notification stops at the breakpoint and holds the workspace lock.Bundle-SymbolicName, and double-click the match inMETA-INF/MANIFEST.MF.Automated
EditorOpenerTestholds the workspace lock in a blockingPOST_CHANGElistener (aWorkspaceJobdoes not hold the lock whilerunInWorkspaceruns) and opens matches in two test editors. Without the fix, the UI thread waits about 5 s in each test; with it,AllSearchTestspasses.🤖 Generated with Claude Code