Index: trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java	(revision 19413)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java	(revision 19414)
@@ -29,4 +29,5 @@
 import javax.swing.text.JTextComponent;
 
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Filter;
 import org.openstreetmap.josm.data.osm.search.SearchCompiler;
@@ -92,4 +93,18 @@
         this.searchSettings = new SearchSetting(initialValues);
         setContent(buildPanel(options));
+
+        // See #24333
+        if (!(initialValues instanceof Filter)) {
+            DataSet data = MainApplication.getLayerManager().getActiveDataSet();
+            if (data != null && data.getSelected().isEmpty()) {
+                remove.setEnabled(false);
+                inSelection.setEnabled(false);
+                if (this.searchSettings.mode == SearchMode.in_selection
+                        || this.searchSettings.mode == SearchMode.remove) {
+                    this.searchSettings.mode = SearchMode.replace;
+                    replace.setSelected(true);
+                }
+            }
+        }
     }
 
