From b39cd5480a78ddd6639c9bc81b3f8500e4f90aeb Mon Sep 17 00:00:00 2001 From: Deepika Udayagiri Date: Fri, 9 Oct 2026 12:56:52 +0530 Subject: [PATCH] Add clear button(SWT.ICON_CANCEL) to Quick Switch (Ctrl+E) filter field. --- .../eclipse/ui/internal/FilteredTableBaseHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/FilteredTableBaseHandler.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/FilteredTableBaseHandler.java index 19e7b496599..6aae67568b1 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/FilteredTableBaseHandler.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/FilteredTableBaseHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Patrik Suzzi and others. + * Copyright (c) 2017, 2026 Patrik Suzzi and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * Patrik Suzzi - Bug 368977, 504088, 504089, 504090, 504091, 509232, 506019 + * IBM Corporation - Add clear button to CTRL+E shortcut to clear filter text. ******************************************************************************/ package org.eclipse.ui.internal; @@ -169,9 +170,14 @@ public void openDialog(WorkbenchPage page, IWorkbenchPart activePart) { composite.setLayout(gl_composite); if (isFiltered()) { - text = new Text(composite, SWT.NONE); + text = new Text(composite, SWT.SEARCH | SWT.ICON_CANCEL); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); text.setBackground(getBackground()); + text.addListener(SWT.DefaultSelection, event -> { + if (event.detail == SWT.ICON_CANCEL) { + text.setText(EMPTY_STRING); + } + }); } else { /* * For issues with dark theme, don't use table.setHeaderVisible(true); and