- Timestamp:
- 2016-01-12T20:12:47+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/tagging/presets
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchDialog.java
r9389 r9422 57 57 super.buttonAction(buttonIndex, evt); 58 58 if (buttonIndex == 0) { 59 TaggingPreset preset = selector.getSelectedPreset ();59 TaggingPreset preset = selector.getSelectedPresetAndUpdateClassification(); 60 60 if (preset != null) { 61 61 preset.actionPerformed(null); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java
r9389 r9422 86 86 super.buttonAction(buttonIndex, evt); 87 87 if (buttonIndex == 0) { 88 TaggingPreset preset = selector.getSelectedPreset ();88 TaggingPreset preset = selector.getSelectedPresetAndUpdateClassification(); 89 89 if (preset != null) { 90 90 final Set<OsmPrimitive> matching = new HashSet<>(Utils.filter(Main.main.getCurrentDataSet().allPrimitives(), preset)); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java
r9347 r9422 222 222 @Override 223 223 public void actionPerformed(ActionEvent ae) { 224 final TaggingPreset preset = lsResult.getSelectedValue();224 final TaggingPreset preset = getSelectedPreset(); 225 225 if (preset != null) { 226 226 Main.toolbar.addCustomButton(preset.getToolbarString(), -1, false); … … 246 246 text, onlyApplicable, inTags, getTypesInSelection(), selected); 247 247 248 final TaggingPreset oldPreset = lsResult.getSelectedValue();248 final TaggingPreset oldPreset = getSelectedPreset(); 249 249 lsResultModel.setItems(Utils.transform(result, new Utils.Function<PresetClassification, TaggingPreset>() { 250 250 @Override … … 253 253 } 254 254 })); 255 final TaggingPreset newPreset = lsResult.getSelectedValue();255 final TaggingPreset newPreset = getSelectedPreset(); 256 256 if (!Objects.equals(oldPreset, newPreset)) { 257 257 int[] indices = lsResult.getSelectedIndices(); … … 414 414 415 415 /** 416 * Determines, which preset is selected at the moment. Updates {@link PresetClassification#favoriteIndex}!416 * Determines, which preset is selected at the moment. 417 417 * @return selected preset (as action) 418 418 */ … … 423 423 idx = 0; 424 424 } 425 TaggingPreset preset = lsResultModel.getElementAt(idx); 425 return lsResultModel.getElementAt(idx); 426 } 427 428 /** 429 * Determines, which preset is selected at the moment. Updates {@link PresetClassification#favoriteIndex}! 430 * @return selected preset (as action) 431 */ 432 public synchronized TaggingPreset getSelectedPresetAndUpdateClassification() { 433 final TaggingPreset preset = getSelectedPreset(); 426 434 for (PresetClassification pc: classifications) { 427 435 if (pc.preset == preset) {
Note:
See TracChangeset
for help on using the changeset viewer.