Ignore:
Timestamp:
2008-07-09T11:34:43+02:00 (16 years ago)
Author:
stoecker
Message:

fixed Preset translation error with combo boxes

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

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

    r679 r692  
    334334
    335335        public String helpTopic() {
    336                 return tr("Statusline");
     336                return "Statusline";
    337337        }
    338338       
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r680 r692  
    273273                }
    274274                @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) {
    275                         Object display = combo.getSelectedItem();
     275                        String display = combo.getSelectedItem().toString();
    276276                        String value = null;
    277                         if (display != null)
    278                                 for (String key : lhm.keySet()) {
     277                        if(display == null && combo.isEditable())
     278                                display = combo.getEditor().getItem().toString();
     279
     280                        if (display != null)
     281                        {
     282                                for (String key : lhm.keySet()) {
    279283                                        String k = lhm.get(key);
    280                                         if (k != null && k.equals(display)) value=key; 
     284                                        if (k != null && k.equals(display)) value=key;
    281285                                }
    282                         String str = combo.isEditable() ? combo.getEditor().getItem().toString() : value;
    283                        
     286                                if(value == null)
     287                                        value = display;
     288                        }
     289
    284290                        // no change if same as before
    285                         if (str.equals(originalValue) || (originalValue == null && str.length() == 0)) return;
    286                        
    287                         if (delete_if_empty && str != null && str.length() == 0)
    288                                 str = null;
    289                         cmds.add(new ChangePropertyCommand(sel, key, str));
     291                        if (value.equals(originalValue) || (originalValue == null && (value == null || value.length() == 0))) return;
     292                       
     293                        if (delete_if_empty && value != null && value.length() == 0)
     294                                value = null;
     295                        cmds.add(new ChangePropertyCommand(sel, key, value));
    290296                }
    291297                @Override boolean requestFocusInWindow() {return combo.requestFocusInWindow();}
Note: See TracChangeset for help on using the changeset viewer.