From b12ea31f8622ffa780930652a5467f057e0d8b31 Mon Sep 17 00:00:00 2001 From: Heiko Klare Date: Thu, 16 Jul 2026 23:58:55 +0200 Subject: [PATCH] Find/Replace overlay: fix content assist not available in Java files Ctrl+Space in the overlay's search/replace fields never opened content assist in Java files because ContentAssistCommandAdapter activates its handler on the workbench-root IHandlerService without an expression, while the target editor keeps a part-scoped handler for the same command permanently active via ActivePartExpression. Since handler conflicts are resolved by evaluated source priority regardless of context nesting, the editor's higher-priority activation always wins, independent of where focus actually is. Fix this by registering an ordinary FindReplaceOverlayAction for the content-assist command, the same way EDIT_FIND_AND_REPLACE is already handled: activated through registerAction()'s overlayFocusedExpression, which alone already outranks the editor's ActivePartExpression-based activation regardless of which IHandlerService the activation lives on, so no separate, part-scoped override mechanism is needed for this. Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/2651 --- .../findandreplace/overlay/FindReplaceOverlay.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java b/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java index 850eadf50c5..ed4d1fbdfd3 100644 --- a/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java +++ b/bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java @@ -501,6 +501,8 @@ private void createCloseTools() { // Also close on Ctrl+F: otherwise it would reopen (a duplicate of) this very overlay. commandSupport.registerAction( new FindReplaceOverlayAction(this::close, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE)); + commandSupport.registerAction(new FindReplaceOverlayAction(this::triggerContentAssist, + ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS)); // Close button new AccessibleToolItemBuilder(closeTools).withStyleBits(SWT.PUSH) @@ -976,6 +978,14 @@ private void updateContentAssistAvailability() { setContentAssistsEnablement(findReplaceLogic.isAvailableAndActive(SearchOptions.REGEX)); } + private void triggerContentAssist() { + if (searchBar.isFocusControl() && contentAssistSearchField.isEnabled()) { + contentAssistSearchField.openProposalPopup(); + } else if (okayToUse(replaceBar) && replaceBar.isFocusControl() && contentAssistReplaceField.isEnabled()) { + contentAssistReplaceField.openProposalPopup(); + } + } + private void decorate() { if (findReplaceLogic.isAvailableAndActive(SearchOptions.REGEX)) { SearchDecoration.validateRegex(getFindString(), searchBarDecoration);