Changeset 9304 in josm for trunk/src


Ignore:
Timestamp:
2016-01-04T17:23:16+01:00 (4 years ago)
Author:
simon04
Message:

fix #12237 - Preset search: JOSM remembers presets not used

Regression of r7412

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r9231 r9304  
    322322            @Override
    323323            public void actionPerformed(ActionEvent ae) {
    324                 String res = getSelectedPreset().getToolbarString();
    325                 Main.toolbar.addCustomButton(res, -1, false);
     324                final TaggingPreset preset = lsResult.getSelectedValue();
     325                if (preset != null) {
     326                    Main.toolbar.addCustomButton(preset.getToolbarString(), -1, false);
     327                }
    326328            }
    327329        });
     
    354356                text, onlyApplicable, inTags, getTypesInSelection(), selected);
    355357
    356         TaggingPreset oldPreset = getSelectedPreset();
     358        final TaggingPreset oldPreset = lsResult.getSelectedValue();
    357359        lsResultModel.setPresets(result);
    358         TaggingPreset newPreset = getSelectedPreset();
     360        final TaggingPreset newPreset = lsResult.getSelectedValue();
    359361        if (!Objects.equals(oldPreset, newPreset)) {
    360362            int[] indices = lsResult.getSelectedIndices();
     
    522524
    523525    /**
    524      * Determines, which preset is selected at the current moment
     526     * Determines, which preset is selected at the moment. Updates {@link PresetClassification#favoriteIndex}!
    525527     * @return selected preset (as action)
    526528     */
Note: See TracChangeset for help on using the changeset viewer.