/** * 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(); } } }