Skip to content

Find/replace overlay: toggle replace visibility instead of recreating it - #4206

Merged
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:findreplace-overlay-always-create-replace-bar
Jul 28, 2026
Merged

HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:findreplace-overlay-always-create-replace-bar

Conversation

@HeikoKlare

@HeikoKlare HeikoKlare commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

The replace bar's widgets used to be created and disposed every time the replace toggle was clicked, which forced several call sites to guard against the bar not existing yet (open/close lifecycle methods, null-checks on replaceBar, a separate replace-action activation/deactivation path in the command support).

The replace bar is now created once, alongside the search bar, and hidden the same way narrow overlays already hide their toolbars: by toggling visibility and adapting the layout data, instead of disposing and recreating the widgets.

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Test Results

   855 files  ±0     855 suites  ±0   49m 11s ⏱️ - 11m 34s
 8 120 tests ±0   7 877 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 262 runs  ±0  19 608 ✅ ±0  654 💤 ±0  0 ❌ ±0 

Results for commit e7d345e. ± Comparison against base commit 04c96e4.

♻️ This comment has been updated with latest results.

@HeikoKlare
HeikoKlare marked this pull request as ready for review July 27, 2026 06:47
@HeikoKlare
HeikoKlare force-pushed the findreplace-overlay-always-create-replace-bar branch from 094b466 to 48990d7 Compare July 27, 2026 08:26
@HeikoKlare
HeikoKlare requested a review from Copilot July 28, 2026 11:22

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.

Pull request overview

This PR refactors the Find/Replace overlay so the replace bar is created once (alongside the search bar) and then shown/hidden via visibility + layout exclusion instead of being disposed/recreated on every toggle. This simplifies lifecycle handling across the overlay and its command infrastructure.

Changes:

  • Replace bar lifecycle changed from create/dispose-on-toggle to always-created and toggled via setVisible(...) + GridData.exclude.
  • Command support simplified by removing the separate “replace actions” registration/activation path.
  • Tests updated to treat replace widgets as always present and to use visibility rather than null checks to detect “open” state.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/OverlayAccess.java Adjusts UI test access helpers to the replace-bar-is-always-created model.
bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayCommandSupport.java Consolidates action registration/handler activation management into single lists.
bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java Implements replace bar show/hide logic and installs focus traversal handling against visibility rather than widget existence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Creating and disposing the replace bar widgets on every toggle forced
several call sites to guard against the bar not existing yet (open/close
lifecycle methods, null-checks on replaceBar, a separate replace-action
activation/deactivation path in the command support).

Instead, create the replace bar once alongside the search bar and hide
it the same way narrow overlays already hide their toolbars, via
changing visibility and adapting the layout data.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@HeikoKlare
HeikoKlare force-pushed the findreplace-overlay-always-create-replace-bar branch from 48990d7 to e7d345e Compare July 28, 2026 12:35
@HeikoKlare
HeikoKlare merged commit b968217 into eclipse-platform:master Jul 28, 2026
18 checks passed
@HeikoKlare
HeikoKlare deleted the findreplace-overlay-always-create-replace-bar branch July 28, 2026 13:31
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