Changeset 1738 in josm for trunk/src


Ignore:
Timestamp:
2009-07-05T19:42:18+02:00 (15 years ago)
Author:
stoecker
Message:

plugin patch from jttt - close #2813

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginSelection.java

    r1733 r1738  
    2323import java.util.Map;
    2424import java.util.Set;
    25 import java.util.SortedMap;
    2625import java.util.TreeMap;
    2726import java.util.Map.Entry;
     
    7069            PluginInformation description = availablePlugins.get(local.name);
    7170
    72             if (description != null && (description.version == null || description.version.equals("")) ?
    73             (local.version != null && local.version.equals("")) : !description.version.equals(local.version)) {
     71            if (description.version != null && !description.version.equals(local.version)) {
    7472                toUpdate.add(description);
    7573                toUpdateStr.append(description.name+"\n");
     
    9795    public boolean finish() {
    9896        Collection<PluginInformation> toDownload = new LinkedList<PluginInformation>();
     97        Collection<String> installedPlugins = Main.pref.getCollection("plugins", null);
     98
    9999        String msg = "";
    100100        for (Entry<String, Boolean> entry : pluginMap.entrySet()) {
    101             if(entry.getValue())
     101            if(entry.getValue() && !installedPlugins.contains(entry.getKey()))
    102102            {
    103103                String name = entry.getKey();
     
    136136    /* return true when plugin list changed */
    137137    public void drawPanel(JPanel pluginPanel) {
    138         availablePlugins = getAvailablePlugins();
     138        loadPlugins();
    139139        Collection<String> enabledPlugins = Main.pref.getCollection("plugins", null);
    140140
     
    222222    }
    223223
    224     /**
    225      * Return information about a loaded plugin.
    226      *
    227      * Note that if you call this in your plugins bootstrap, you may get <code>null</code> if
    228      * the plugin requested is not loaded yet.
    229      *
    230      * @return The PluginInformation to a specific plugin, but only if the plugin is loaded.
    231      * If it is not loaded, <code>null</code> is returned.
    232      */
    233     private static PluginInformation getLoaded(String pluginName) {
    234         for (PluginProxy p : PluginHandler.pluginList)
    235             if (p.info.name.equals(pluginName))
    236                 return p.info;
    237         return null;
    238     }
    239 
    240     private Map<String, PluginInformation> getAvailablePlugins() {
    241         SortedMap<String, PluginInformation> availablePlugins = new TreeMap<String, PluginInformation>(new Comparator<String>(){
     224    private void loadPlugins() {
     225        availablePlugins = new TreeMap<String, PluginInformation>(new Comparator<String>(){
    242226            public int compare(String o1, String o2) {
    243227                return o1.compareToIgnoreCase(o2);
     
    346330                localPlugins.put(proxy.info.name, proxy.info);
    347331        }
    348         return availablePlugins;
    349332    }
    350333}
Note: See TracChangeset for help on using the changeset viewer.