From e783f80e5551a29342097e7a56b0fc9b2a4cd301 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 1 Jun 2026 10:45:48 +0200 Subject: [PATCH] Fix empty page tree in pre-filtered preference dialog The native search field rework (PR #3925) overrode setInitialText to only set the placeholder message and stopped maintaining the inherited initialText sentinel. The pre-filter path addFilter() still wrote the hint "type filter text" into the field, which was then applied as a real filter pattern (since it no longer equalled initialText), matching no preference pages and leaving the tree empty. Keep the initialText sentinel in sync in the override and stop writing the hint into the field in addFilter(). The placeholder hint is still shown via setMessage so the field keeps signalling that it filters the pages, but it is never written into the field as an active pattern. Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/4041 --- .../ui/internal/dialogs/FilteredPreferenceDialog.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java index 9c281e7d07d..febcc4eebe3 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java @@ -126,8 +126,12 @@ protected Text doCreateFilterText(Composite parent) { @Override public void setInitialText(String text) { + // Track initialText for the empty-filter check and accessible name, and show it + // as the field's placeholder hint. Unlike the base implementation we never write + // it into the field, so addFilter() cannot turn the hint into an active pattern. + initialText = text != null ? text : ""; //$NON-NLS-1$ if (filterText != null && !filterText.isDisposed()) { - filterText.setMessage(text != null ? text : ""); //$NON-NLS-1$ + filterText.setMessage(initialText); } } @@ -140,7 +144,8 @@ protected void addFilter(ViewerFilter filter) { getViewer().addFilter(filter); if (filterText != null) { - setFilterText(WorkbenchMessages.FilteredTree_FilterMessage); + // Keep the field empty so the viewer filter narrows the pages; the + // hint text would otherwise be applied as a pattern and hide all pages. textChanged(); }