From fc02d37898ef31e77340d6e321a7723b637cebd5 Mon Sep 17 00:00:00 2001 From: Deepika Udayagiri Date: Mon, 10 Aug 2026 19:00:52 +0530 Subject: [PATCH 1/2] Fix misleading match count label in File Search --- .../search/internal/ui/SearchMessages.java | 3 +- .../internal/ui/SearchMessages.properties | 3 +- .../internal/ui/text/FileSearchPage.java | 33 +++++++++++++++++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java b/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java index 8862ace200e..c82179ba3c8 100644 --- a/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java +++ b/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2023 IBM Corporation and others. + * Copyright (c) 2000, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -176,6 +176,7 @@ private SearchMessages() { public static String FileSearchPage_sort_by_label; public static String FileSearchPage_limited_format_files; public static String FileSearchPage_limited_format_matches; + public static String FileSearchPage_matches_on_lines_format; public static String FileSearchPage_filtered_message; public static String FileSearchPage_filteredWithCount_message; public static String WorkspaceScope; diff --git a/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties b/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties index 83e2c53cbb2..9477be37ccf 100644 --- a/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties +++ b/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2023 IBM Corporation and others. +# Copyright (c) 2000, 2026 IBM Corporation and others. # # This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -182,6 +182,7 @@ FileSearchPage_error_marker=Could not create marker FileSearchPage_sort_by_label=Sort By FileSearchPage_limited_format_files={0} (showing {1} of {2} files) FileSearchPage_limited_format_matches={0} (showing {1} of {2} matches) +FileSearchPage_matches_on_lines_format={0} (found on {1} lines) FileSearchPage_open_file_dialog_title=Open File FileSearchPage_filtered_message={0} (Filtered) FileSearchPage_filteredWithCount_message={0} ({1} matches filtered from view) diff --git a/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java b/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java index c894ae2581d..e8d5c009ded 100644 --- a/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java +++ b/bundles/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2023 IBM Corporation and others. + * Copyright (c) 2000, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -450,9 +450,15 @@ public String getLabel() { int itemCount = fContentProvider.getLeafCount(result); if (showLineMatches()) { int matchCount = result.getMatchCount(); - if (itemCount < matchCount) { + int visibleMatchCount = getVisibleMatchCount(result); + if (visibleMatchCount < matchCount) { + // real truncation happened so some matches are not represented at all msg = Messages.format(SearchMessages.FileSearchPage_limited_format_matches, - new Object[] { label, Integer.valueOf(itemCount), Integer.valueOf(matchCount) }); + new Object[] { label, Integer.valueOf(visibleMatchCount), Integer.valueOf(matchCount) }); + } else if (itemCount < matchCount) { + // all matches shown, just spread across fewer lines + msg = Messages.format(SearchMessages.FileSearchPage_matches_on_lines_format, + new Object[] { label, Integer.valueOf(itemCount) }); } } else { int fileCount = result.getElementsCount(); @@ -476,6 +482,27 @@ public String getLabel() { return msg; } + private int getVisibleMatchCount(AbstractTextSearchResult result) { + StructuredViewer viewer = getViewer(); + if (viewer instanceof TreeViewer treeViewer) { + ITreeContentProvider cp = (ITreeContentProvider) treeViewer.getContentProvider(); + return getVisibleMatchCount(cp, getRootElements(treeViewer), result); + } + return result.getMatchCount(); + } + + private int getVisibleMatchCount(ITreeContentProvider cp, Object[] elements, AbstractTextSearchResult result) { + int count = 0; + for (Object element : elements) { + if (element instanceof LineElement lineElement) { + count += lineElement.getNumberOfMatches(result); + } else { + count += getVisibleMatchCount(cp, cp.getChildren(element), result); + } + } + return count; + } + private int getFilteredMatchCount() { StructuredViewer viewer = getViewer(); if (viewer instanceof TreeViewer) { From 7cd923cb8079c3da2d12dee37bc997a4a93eaaf4 Mon Sep 17 00:00:00 2001 From: Eclipse Platform Bot Date: Tue, 11 Aug 2026 06:40:42 +0000 Subject: [PATCH 2/2] Version bump(s) for 4.41 stream --- bundles/org.eclipse.search/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.search/META-INF/MANIFEST.MF b/bundles/org.eclipse.search/META-INF/MANIFEST.MF index 726e86f7caf..969c9033d31 100644 --- a/bundles/org.eclipse.search/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.search/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.search; singleton:=true -Bundle-Version: 3.19.0.qualifier +Bundle-Version: 3.19.100.qualifier Bundle-Activator: org.eclipse.search.internal.ui.SearchPlugin Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName