Changeset 2278 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2009-10-12T08:04:09+02:00 (15 years ago)
Author:
jttt
Message:

Force update of validator plugin

File:
1 edited

Legend:

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

    r2270 r2278  
    1313import java.util.Collection;
    1414import java.util.Collections;
     15import java.util.HashMap;
    1516import java.util.LinkedList;
    1617import java.util.List;
     18import java.util.Map;
    1719import java.util.SortedMap;
    1820import java.util.TreeMap;
     
    4042
    4143public class PluginHandler {
     44
    4245    /**
    4346     * All installed and loaded plugins (resp. their main classes)
     
    6366                "namefinder", "waypoints", "slippy_map_chooser", "tcx-support"};
    6467        String [] unmaintained = new String[] {"gpsbabelgui", "Intersect_way"};
     68        Map<String, Integer> requiredUpdate = new HashMap<String, Integer>();
     69        requiredUpdate.put("validator", 18092);
     70
    6571        for (String p : oldplugins) {
    6672            if (plugins.contains(p)) {
     
    7985            for (String p : unmaintained) {
    8086                if (plugins.contains(p) && disablePlugin(tr("<html>Loading of {0} plugin was requested."
    81                 +"<br>This plugin is no longer developed and very likely will produce errors."
    82                 +"<br>It should be disabled.<br>Delete from preferences?</html>", p), p))
     87                        +"<br>This plugin is no longer developed and very likely will produce errors."
     88                        +"<br>It should be disabled.<br>Delete from preferences?</html>", p), p)) {
    8389                    plugins.remove(p);
    84             }
    85         }
     90                }
     91            }
     92        }
     93
    8694
    8795        if (plugins.isEmpty())
     
    105113                    continue;
    106114                }
     115                if (requiredUpdate.containsKey(info.name)) {
     116                    int minimumVersion = requiredUpdate.get(info.name);
     117                    boolean badVersion;
     118                    try {
     119                        badVersion = Integer.parseInt(info.version) < minimumVersion;
     120                    } catch (NumberFormatException e) {
     121                        badVersion = true;
     122                    }
     123                    if (badVersion) {
     124                        JOptionPane.showMessageDialog(
     125                                Main.parent,
     126                                tr("Plugin {0} version {1} found but for this version of JOSM is at least version {2} required. "
     127                                        + "Please update the plugin.", info.name, info.version, String.valueOf(minimumVersion)),
     128                                        tr("Warning"),
     129                                        JOptionPane.WARNING_MESSAGE
     130                        );
     131                        continue;
     132                    }
     133                }
     134
    107135                if(info.requires != null)
    108136                {
     
    252280        if (plugin == null)
    253281        {
    254             String name = null;
    255282            /**
    256283             * Analyze the stack of the argument and find a name of a plugin, if
     
    271298                    }
    272299                }
    273                 if(plugin != null)
     300                if(plugin != null) {
    274301                    break;
     302                }
    275303            }
    276304        }
Note: See TracChangeset for help on using the changeset viewer.