Ignore:
Timestamp:
2009-07-08T15:26:12+02:00 (15 years ago)
Author:
stoecker
Message:

close #2874 (NPE), improved external style handling

File:
1 edited

Legend:

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

    r1743 r1747  
    9595    }
    9696
    97     public StyleSources(String pref, String iconpref, String url, boolean named, final String name)
     97    public StyleSources(String pref, String iconpref, final String url, boolean named, final String name)
    9898    {
    9999        sourcesList = new JList(new DefaultListModel());
     
    199199                    ((DefaultListModel)sourcesList.getModel()).addElement(
    200200                    ((SourceInfo)sourcesDefaults.getSelectedValue()).url);
     201                }
     202            }
     203        });
     204
     205        JButton update = new JButton(tr("Update"));
     206        update.addActionListener(new ActionListener(){
     207            public void actionPerformed(ActionEvent e) {
     208                MirroredInputStream.cleanup(url);
     209                getDefaults(url);
     210                int num = sourcesList.getModel().getSize();
     211                if (num > 0)
     212                {
     213                    ArrayList<String> l = new ArrayList<String>();
     214                    for (int i = 0; i < num; ++i)
     215                        MirroredInputStream.cleanup((String)sourcesList.getModel().getElementAt(i));
    201216                }
    202217            }
     
    219234        buttonPanel.add(edit, GBC.std().insets(5,5,5,0));
    220235        buttonPanel.add(delete, GBC.std().insets(0,5,5,0));
    221         buttonPanel.add(copy, GBC.std().insets(0,5,0,0));
     236        buttonPanel.add(copy, GBC.std().insets(0,5,5,0));
     237        buttonPanel.add(update, GBC.std().insets(0,5,0,0));
    222238        if(iconsList != null)
    223239        {
     
    265281    public void getDefaults(String name)
    266282    {
     283        ((DefaultListModel)sourcesDefaults.getModel()).removeAllElements();
    267284        String lang = Main.getLanguageCode()+"_";
    268285        try
Note: See TracChangeset for help on using the changeset viewer.