/**
  * Refreshes the local version field on the modules in <code>modules</code> with the version in
  * the manifest of the downloaded "jar.new"-file for this module.
  *
  * @param modules the collections of modules to refresh
  */
 public void refreshLocalModuleVersion(Collection<ModuleInformation> modules) {
   if (modules == null) return;
   File moduleDir = OdPlugin.getInstance().getModulesDirectory();
   for (ModuleInformation pi : modules) {
     // Find the downloaded file. We have tried to install the downloaded modules
     // (ModuleHandler.installDownloadedModules). This succeeds depending on the
     // platform.
     File downloadedModuleFile = new File(moduleDir, pi.name + ".jar.new");
     if (!(downloadedModuleFile.exists() && downloadedModuleFile.canRead())) {
       downloadedModuleFile = new File(moduleDir, pi.name + ".jar");
       if (!(downloadedModuleFile.exists() && downloadedModuleFile.canRead())) {
         continue;
       }
     }
     try {
       ModuleInformation newinfo = new ModuleInformation(downloadedModuleFile, pi.name);
       ModuleInformation oldinfo = getModuleInformation(pi.name);
       if (oldinfo == null) {
         // should not happen
         continue;
       }
       oldinfo.localversion = newinfo.version;
     } catch (ModuleException e) {
       e.printStackTrace();
     }
   }
 }
 @Override
 public void actionPerformed(ActionEvent e) {
   final String baseName = OdPlugin.getInstance().getDialog().getDataLayer().getName();
   final DataSet baseDs = getCurrentDataSet();
   for (OsmPrimitive boundary : getBoundaries()) {
     DataSet data = new DataSet();
     for (OsmPrimitive p :
         NodeWayUtils.selectAllInside(Collections.singleton(boundary), baseDs)) {
       if (p instanceof Node) {
         data.addPrimitive(new Node((Node) p));
       } else if (p instanceof Way) {
         data.addPrimitive(new Way((Way) p));
       } else if (p instanceof Relation) {
         data.addPrimitive(new Relation((Relation) p));
       }
     }
     if (!data.allPrimitives().isEmpty()) {
       String name = boundary.get("name");
       if (name == null || name.isEmpty()) {
         name = boundary.get("ref");
       }
       if (name == null || name.isEmpty()) {
         name = boundary.get("description");
       }
       Main.main.addLayer(
           new OdDataLayer(data, baseName + "/" + name, null, ToulouseDataSetHandler.this));
     }
   }
 }