Repository navigation
Find/Replace overlay: drop the branching for non-text target controls - #4507
Merged
HeikoKlare merged 1 commit intoOct 16, 2026
Conversation
The overlay distinguished two ways of being placed: inserted next to the target control, or anchored to the shell when the target was no text widget. The second case cannot occur, because the target control is obtained from the part's text viewer and is therefore always its styled text widget; where that widget is missing, construction fails before any of the branches is reached. Narrowing the target control to the type it always has removes the condition along with the unreachable branches, leaving the placement logic to express the single case that exists. Assisted-by: Claude Opus 5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The text viewer supplies a StyledText target, so removing the unreachable branches preserves existing placement behavior.
0 open findings
What changed in this PR
Simplifies Find/Replace overlay placement by removing unreachable handling for non-text target controls, with no intended functional change.
Changes:
- Narrows the target control type to
StyledText. - Removes conditional placement branches and consistently positions the overlay as a sibling of the target.
| File | Description |
|---|---|
| bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java | Narrows the target type and simplifies container creation and bounds calculation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
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.
The Find/Replace overlay distinguishes two ways of being placed: it is either inserted next to the target control and positioned relative to it, or it is anchored to its parent's origin for a target control that is no text widget. The second case cannot occur. The target control is obtained from the text viewer the part adapts to, so it is always that viewer's styled text widget, and where the widget is missing, construction already fails in the color retrieval before any of the branches is reached.
Narrowing the target control to the type it always has turns that reasoning into something the compiler knows, which lets the condition and its unreachable branches go. The placement logic is then free of a distinction it never actually made, and expresses the single case that exists.
No functional change intended.
🤖 Generated with Claude Code