Changeset 680 in josm


Ignore:
Timestamp:
Jul 5, 2008 3:10:14 PM (5 years ago)
Author:
stoecker
Message:

Preset buttons in toolbar work again (fixes #792)

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

Legend:

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

    r627 r680  
    129129                        HashMap<String,JMenu> submenus = new HashMap<String,JMenu>(); 
    130130                        for (final TaggingPreset p : taggingPresets) { 
    131                                 if (p.getValue(Action.NAME).equals(" ")) { 
     131                                String name = (String) p.getValue(Action.NAME); 
     132                                if (name.equals(" ")) { 
    132133                                        Main.main.menu.presetsMenu.add(new JSeparator()); 
    133134                                } else { 
    134                                         String name = (String) p.getValue(Action.NAME); 
    135135                                        String[] sp = name.split("/"); 
    136136                                        if (sp.length <= 1) { 
    137137                                                Main.main.menu.presetsMenu.add(new JMenuItem(p)); 
    138138                                        } else { 
    139                                                 p.setName(sp[1]); 
     139                                                p.setDisplayName(sp[1]); 
    140140                                                JMenu submenu = submenus.get(sp[0]); 
    141141                                                if (submenu == null) { 
     
    144144                                                        Main.main.menu.presetsMenu.add(submenu); 
    145145                                                } 
    146                                                 submenu.add(new JMenuItem(p)); 
     146                                                if (sp[1].equals(" ")) 
     147                                                        submenu.add(new JSeparator()); 
     148                                                else 
     149                                                        submenu.add(p); 
    147150                                        } 
    148151                                } 
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r679 r680  
    332332         */ 
    333333        public void setName(String name) { 
     334                setDisplayName(tr(name)); 
     335                putValue("toolbar", "tagging_"+name); 
     336        } 
     337         
     338        /** 
     339         * Change the display name without changing the toolbar value. 
     340         */ 
     341        public void setDisplayName(String name) { 
    334342                putValue(Action.NAME, tr(name)); 
    335                 putValue("toolbar", "tagging_"+name); 
    336343        } 
    337344 
Note: See TracChangeset for help on using the changeset viewer.