Changeset 3479 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2010-08-29T14:55:25+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r3380 r3479 7 7 import java.io.ByteArrayInputStream; 8 8 import java.io.File; 9 import java.io.FileOutputStream; 9 10 import java.io.FilenameFilter; 10 import java.io.FileOutputStream;11 11 import java.io.IOException; 12 12 import java.io.InputStream; … … 48 48 private List<PluginInformation> availablePlugins; 49 49 50 protected enum CacheType {PLUGIN_LIST, ICON_LIST} ;50 protected enum CacheType {PLUGIN_LIST, ICON_LIST} 51 51 52 52 protected void init(Collection<String> sites){ … … 60 60 /** 61 61 * Creates the task 62 * 62 * 63 63 * @param sites the collection of download sites. Defaults to the empty collection if null. 64 64 */ … … 70 70 /** 71 71 * Creates the task 72 * 72 * 73 73 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null 74 74 * @param sites the collection of download sites. Defaults to the empty collection if null. … … 96 96 * Creates the file name for the cached plugin list and the icon cache 97 97 * file. 98 * 98 * 99 99 * @param site the name of the site 100 100 * @param type icon cache or plugin list cache … … 122 122 } 123 123 switch (type) { 124 125 126 127 128 129 124 case PLUGIN_LIST: 125 sb.append(".txt"); 126 break; 127 case ICON_LIST: 128 sb.append("-icons.zip"); 129 break; 130 130 } 131 131 name = sb.toString(); … … 138 138 /** 139 139 * Downloads the list from a remote location 140 * 140 * 141 141 * @param site the site URL 142 142 * @param monitor a progress monitor … … 150 150 String pl = Main.pref.getCollectionAsString("plugins"); 151 151 String printsite = site.replaceAll("%<(.*)>", ""); 152 if(pl != null && pl.length() != 0) 152 if(pl != null && pl.length() != 0) { 153 153 site = site.replaceAll("%<(.*)>", "$1"+pl); 154 else154 } else { 155 155 site = printsite; 156 } 156 157 157 158 monitor.beginTask(""); … … 257 258 /** 258 259 * Writes the list of plugins to a cache file 259 * 260 * 260 261 * @param site the site from where the list was downloaded 261 262 * @param list the downloaded list … … 288 289 * Filter information about deprecated plugins from the list of downloaded 289 290 * plugins 290 * 291 * 291 292 * @param plugins the plugin informations 292 293 * @return the plugin informations, without deprecated plugins … … 306 307 /** 307 308 * Parses the plugin list 308 * 309 * 309 310 * @param site the site from where the list was downloaded 310 311 * @param doc the document with the plugin list … … 335 336 for (String location : PluginInformation.getPluginLocations()) { 336 337 File [] f = new File(location).listFiles( 337 new FilenameFilter() { 338 public boolean accept(File dir, String name) { 339 return name.matches("^([0-9]+-)?site.*\\.txt$") || 340 name.matches("^([0-9]+-)?site.*-icons\\.zip$"); 338 new FilenameFilter() { 339 public boolean accept(File dir, String name) { 340 return name.matches("^([0-9]+-)?site.*\\.txt$") || 341 name.matches("^([0-9]+-)?site.*-icons\\.zip$"); 342 } 341 343 } 342 }343 344 ); 344 if(f != null && f.length > 0) 345 if(f != null && f.length > 0) { 345 346 siteCacheFiles.addAll(Arrays.asList(f)); 347 } 346 348 } 347 349 … … 382 384 /** 383 385 * Replies the list of plugins described in the downloaded plugin lists 384 * 386 * 385 387 * @return the list of plugins 386 388 */
Note:
See TracChangeset
for help on using the changeset viewer.