Changeset 19414 in josm for trunk/src


Ignore:
Timestamp:
2025-06-23T07:29:59+02:00 (2 weeks ago)
Author:
GerdP
Message:

fix #24333: Search dialog should not offer some options when nothing is selected and a selection is needed

  • disable radio buttons which need a selection, set mode to replace if search dialog is opened with empty collection (but not when a Filter is created)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java

    r18424 r19414  
    2929import javax.swing.text.JTextComponent;
    3030
     31import org.openstreetmap.josm.data.osm.DataSet;
    3132import org.openstreetmap.josm.data.osm.Filter;
    3233import org.openstreetmap.josm.data.osm.search.SearchCompiler;
     
    9293        this.searchSettings = new SearchSetting(initialValues);
    9394        setContent(buildPanel(options));
     95
     96        // See #24333
     97        if (!(initialValues instanceof Filter)) {
     98            DataSet data = MainApplication.getLayerManager().getActiveDataSet();
     99            if (data != null && data.getSelected().isEmpty()) {
     100                remove.setEnabled(false);
     101                inSelection.setEnabled(false);
     102                if (this.searchSettings.mode == SearchMode.in_selection
     103                        || this.searchSettings.mode == SearchMode.remove) {
     104                    this.searchSettings.mode = SearchMode.replace;
     105                    replace.setSelected(true);
     106                }
     107            }
     108        }
    94109    }
    95110
Note: See TracChangeset for help on using the changeset viewer.