Changeset 7434 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2014-08-20T03:07:15+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r7424 r7434 63 63 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 64 64 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 65 import org.openstreetmap.josm.io.OfflineAccessException; 66 import org.openstreetmap.josm.io.OnlineResource; 65 67 import org.openstreetmap.josm.tools.GBC; 66 68 import org.openstreetmap.josm.tools.I18n; … … 303 305 */ 304 306 public static boolean checkAndConfirmPluginUpdate(Component parent) { 307 if (!checkOfflineAccess()) { 308 Main.info(tr("{0} not available (offline mode)", tr("Plugin update"))); 309 return false; 310 } 305 311 String message = null; 306 312 String togglePreferenceKey = null; … … 403 409 } 404 410 return ret == 0; 411 } 412 413 private static boolean checkOfflineAccess() { 414 if (Main.isOffline(OnlineResource.ALL)) { 415 return false; 416 } 417 if (Main.isOffline(OnlineResource.JOSM_WEBSITE)) { 418 for (String updateSite : Main.pref.getPluginSites()) { 419 try { 420 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(updateSite, Main.getJOSMWebsite()); 421 } catch (OfflineAccessException e) { 422 if (Main.isTraceEnabled()) { 423 Main.trace(e.getMessage()); 424 } 425 return false; 426 } 427 } 428 } 429 return true; 405 430 } 406 431 -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r7082 r7434 60 60 protected enum CacheType {PLUGIN_LIST, ICON_LIST} 61 61 62 protected final void init(Collection<String> sites, boolean displayErrMsg){ 62 protected final void init(Collection<String> sites, boolean displayErrMsg) { 63 63 this.sites = sites; 64 64 if (sites == null) { … … 68 68 this.displayErrMsg = displayErrMsg; 69 69 } 70 /** 71 * Creates the task 70 71 /** 72 * Constructs a new {@code ReadRemotePluginInformationTask}. 72 73 * 73 74 * @param sites the collection of download sites. Defaults to the empty collection if null. … … 79 80 80 81 /** 81 * C reates the task82 * Constructs a new {@code ReadRemotePluginInformationTask}. 82 83 * 83 84 * @param monitor the progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null … … 104 105 105 106 /** 106 * Creates the file name for the cached plugin list and the icon cache 107 * file. 107 * Creates the file name for the cached plugin list and the icon cache file. 108 108 * 109 109 * @param site the name of the site … … 403 403 siteCacheFiles.remove(createSiteCacheFile(pluginDir, site, CacheType.PLUGIN_LIST)); 404 404 siteCacheFiles.remove(createSiteCacheFile(pluginDir, site, CacheType.ICON_LIST)); 405 if(list != null) 406 { 405 if (list != null) { 407 406 getProgressMonitor().worked(1); 408 407 cachePluginList(site, list); … … 416 415 downloadPluginIcons(site+"-icons.zip", createSiteCacheFile(pluginDir, site, CacheType.ICON_LIST), getProgressMonitor().createSubTaskMonitor(0, false)); 417 416 } 418 for (File file: siteCacheFiles) /*remove old stuff or whole update process is broken*/419 { 417 // remove old stuff or whole update process is broken 418 for (File file: siteCacheFiles) { 420 419 file.delete(); 421 420 }
Note:
See TracChangeset
for help on using the changeset viewer.