Skip to content

Find/Replace overlay: drop the branching for non-text target controls - #4507

Merged
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:findreplace-overlay-simplify-target-control
Oct 16, 2026
Merged

HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:findreplace-overlay-simplify-target-control

Conversation

@HeikoKlare

Copy link
Copy Markdown
Contributor

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

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]>
@HeikoKlare
HeikoKlare marked this pull request as ready for review October 16, 2026 14:38
@HeikoKlare
HeikoKlare requested a balanced review from Copilot October 16, 2026 14:38

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.

🟢 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.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   867 files  ±0     867 suites  ±0   52m 42s ⏱️ - 1m 9s
 8 463 tests ±0   8 221 ✅ ±0  242 💤 ±0  0 ❌ ±0 
21 267 runs  ±0  20 584 ✅ ±0  683 💤 ±0  0 ❌ ±0 

Results for commit 95f49ec. ± Comparison against base commit 2738b40.

@HeikoKlare
HeikoKlare merged commit 3faf11c into eclipse-platform:master Oct 16, 2026
18 checks passed
@HeikoKlare
HeikoKlare deleted the findreplace-overlay-simplify-target-control branch October 16, 2026 16:26
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.

2 participants