Changeset 13294 in josm
- Timestamp:
- 2018-01-07T22:54:01+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r13180 r13294 1226 1226 1227 1227 monitor.indeterminateSubTask(tr("Installing updated plugins")); 1228 PluginHandler.installDownloadedPlugins( true);1228 PluginHandler.installDownloadedPlugins(pluginsToLoad, true); 1229 1229 1230 1230 monitor.indeterminateSubTask(tr("Loading early plugins")); -
trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
r12794 r13294 182 182 downloaded.add(d); 183 183 } 184 PluginHandler.installDownloadedPlugins( false);184 PluginHandler.installDownloadedPlugins(toUpdate, false); 185 185 } 186 186 -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r13173 r13294 16 16 import java.io.FilenameFilter; 17 17 import java.io.IOException; 18 import java.net.MalformedURLException; 18 19 import java.net.URL; 19 20 import java.net.URLClassLoader; … … 1234 1235 1235 1236 /** 1236 * Installs downloaded plugins. Moves files with the suffix ".jar.new" to the corresponding 1237 * ".jar" files. 1237 * Installs downloaded plugins. Moves files with the suffix ".jar.new" to the corresponding ".jar" files. 1238 1238 * 1239 1239 * If {@code dowarn} is true, this methods emits warning messages on the console if a downloaded … … 1241 1241 * installation of the respective plugin is silently skipped. 1242 1242 * 1243 * @param pluginsToLoad list of plugin informations to update 1243 1244 * @param dowarn if true, warning messages are displayed; false otherwise 1244 */ 1245 public static void installDownloadedPlugins(boolean dowarn) { 1245 * @since 13294 1246 */ 1247 public static void installDownloadedPlugins(Collection<PluginInformation> pluginsToLoad, boolean dowarn) { 1246 1248 File pluginDir = Main.pref.getPluginsDirectory(); 1247 1249 if (!pluginDir.exists() || !pluginDir.isDirectory() || !pluginDir.canWrite()) … … 1274 1276 } 1275 1277 // Install plugin 1276 if (!updatedPlugin.renameTo(plugin) && dowarn) { 1278 if (updatedPlugin.renameTo(plugin)) { 1279 try { 1280 // Update plugin URL 1281 URL newPluginURL = plugin.toURI().toURL(); 1282 URL oldPluginURL = updatedPlugin.toURI().toURL(); 1283 pluginsToLoad.stream().filter(x -> x.libraries.contains(oldPluginURL)).forEach( 1284 x -> Collections.replaceAll(x.libraries, oldPluginURL, newPluginURL)); 1285 } catch (MalformedURLException e) { 1286 Logging.warn(e); 1287 } 1288 } else if (dowarn) { 1277 1289 Logging.warn(tr("Failed to install plugin ''{0}'' from temporary download file ''{1}''. Renaming failed.", 1278 1290 plugin.toString(), updatedPlugin.toString()));
Note:
See TracChangeset
for help on using the changeset viewer.