Changeset 7005 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2014-04-26T17:39:23+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/plugins
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
r6883 r7005 27 27 import org.xml.sax.SAXException; 28 28 29 30 29 /** 31 30 * Asynchronous task for downloading a collection of plugins. … … 43 42 public static final String PLUGIN_MIME_TYPES = "application/java-archive, application/zip; q=0.9, application/octet-stream; q=0.5"; 44 43 45 private final Collection<PluginInformation> toUpdate = new LinkedList< PluginInformation>();46 private final Collection<PluginInformation> failed = new LinkedList< PluginInformation>();47 private final Collection<PluginInformation> downloaded = new LinkedList< PluginInformation>();44 private final Collection<PluginInformation> toUpdate = new LinkedList<>(); 45 private final Collection<PluginInformation> failed = new LinkedList<>(); 46 private final Collection<PluginInformation> downloaded = new LinkedList<>(); 48 47 private Exception lastException; 49 48 private boolean canceled; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r7004 r7005 195 195 * All installed and loaded plugins (resp. their main classes) 196 196 */ 197 public static final Collection<PluginProxy> pluginList = new LinkedList< PluginProxy>();197 public static final Collection<PluginProxy> pluginList = new LinkedList<>(); 198 198 199 199 /** 200 200 * Add here all ClassLoader whose resource should be searched. 201 201 */ 202 private static final List<ClassLoader> sources = new LinkedList< ClassLoader>();202 private static final List<ClassLoader> sources = new LinkedList<>(); 203 203 204 204 static { … … 227 227 */ 228 228 private static void filterDeprecatedPlugins(Component parent, Collection<String> plugins) { 229 Set<DeprecatedPlugin> removedPlugins = new TreeSet< DeprecatedPlugin>();229 Set<DeprecatedPlugin> removedPlugins = new TreeSet<>(); 230 230 for (DeprecatedPlugin depr : DEPRECATED_PLUGINS) { 231 231 if (plugins.contains(depr.name)) { … … 461 461 462 462 // Add all plugins already loaded (to include early plugins when checking late ones) 463 Collection<PluginInformation> allPlugins = new HashSet< PluginInformation>(plugins);463 Collection<PluginInformation> allPlugins = new HashSet<>(plugins); 464 464 for (PluginProxy proxy : pluginList) { 465 465 allPlugins.add(proxy.getPluginInformation()); … … 487 487 // 488 488 if (requires != null) { 489 Set<String> pluginNames = new HashSet< String>();489 Set<String> pluginNames = new HashSet<>(); 490 490 for (PluginInformation pi: plugins) { 491 491 pluginNames.add(pi.name); 492 492 } 493 Set<String> missingPlugins = new HashSet< String>();493 Set<String> missingPlugins = new HashSet<>(); 494 494 List<String> requiredPlugins = local ? plugin.getLocalRequiredPlugins() : plugin.getRequiredPlugins(); 495 495 for (String requiredPlugin : requiredPlugins) { … … 515 515 public static ClassLoader createClassLoader(Collection<PluginInformation> plugins) { 516 516 // iterate all plugins and collect all libraries of all plugins: 517 List<URL> allPluginLibraries = new LinkedList< URL>();517 List<URL> allPluginLibraries = new LinkedList<>(); 518 518 File pluginDir = Main.pref.getPluginsDirectory(); 519 519 520 520 // Add all plugins already loaded (to include early plugins in the classloader, allowing late plugins to rely on early ones) 521 Collection<PluginInformation> allPlugins = new HashSet< PluginInformation>(plugins);521 Collection<PluginInformation> allPlugins = new HashSet<>(plugins); 522 522 for (PluginProxy proxy : pluginList) { 523 523 allPlugins.add(proxy.getPluginInformation()); … … 592 592 monitor.beginTask(tr("Loading plugins ...")); 593 593 monitor.subTask(tr("Checking plugin preconditions...")); 594 List<PluginInformation> toLoad = new LinkedList< PluginInformation>();594 List<PluginInformation> toLoad = new LinkedList<>(); 595 595 for (PluginInformation pi: plugins) { 596 596 if (checkLoadPreconditions(parent, plugins, pi)) { … … 636 636 */ 637 637 public static void loadEarlyPlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) { 638 List<PluginInformation> earlyPlugins = new ArrayList< PluginInformation>(plugins.size());638 List<PluginInformation> earlyPlugins = new ArrayList<>(plugins.size()); 639 639 for (PluginInformation pi: plugins) { 640 640 if (pi.early) { … … 654 654 */ 655 655 public static void loadLatePlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) { 656 List<PluginInformation> latePlugins = new ArrayList< PluginInformation>(plugins.size());656 List<PluginInformation> latePlugins = new ArrayList<>(plugins.size()); 657 657 for (PluginInformation pi: plugins) { 658 658 if (!pi.early) { … … 688 688 return null; 689 689 } 690 HashMap<String, PluginInformation> ret = new HashMap< String, PluginInformation>();690 HashMap<String, PluginInformation> ret = new HashMap<>(); 691 691 for (PluginInformation pi: task.getAvailablePlugins()) { 692 692 ret.put(pi.name, pi); … … 733 733 try { 734 734 monitor.beginTask(tr("Determine plugins to load...")); 735 Set<String> plugins = new HashSet< String>();735 Set<String> plugins = new HashSet<>(); 736 736 plugins.addAll(Main.pref.getCollection("plugins", new LinkedList<String>())); 737 737 if (System.getProperty("josm.plugins") != null) { … … 743 743 filterUnmaintainedPlugins(parent, plugins); 744 744 Map<String, PluginInformation> infos = loadLocallyAvailablePluginInformation(monitor.createSubTaskMonitor(1,false)); 745 List<PluginInformation> ret = new LinkedList< PluginInformation>();745 List<PluginInformation> ret = new LinkedList<>(); 746 746 for (Iterator<String> it = plugins.iterator(); it.hasNext();) { 747 747 String plugin = it.next(); … … 791 791 private static Set<PluginInformation> findRequiredPluginsToDownload( 792 792 Collection<PluginInformation> pluginsToUpdate, List<PluginInformation> allPlugins, Set<PluginInformation> pluginsToDownload) { 793 Set<PluginInformation> result = new HashSet< PluginInformation>();793 Set<PluginInformation> result = new HashSet<>(); 794 794 for (PluginInformation pi : pluginsToUpdate) { 795 795 for (String name : pi.getRequiredPlugins()) { … … 880 880 // filter plugins which actually have to be updated 881 881 // 882 Collection<PluginInformation> pluginsToUpdate = new ArrayList< PluginInformation>();882 Collection<PluginInformation> pluginsToUpdate = new ArrayList<>(); 883 883 for (PluginInformation pi: plugins) { 884 884 if (pi.isUpdateRequired()) { … … 889 889 if (!pluginsToUpdate.isEmpty()) { 890 890 891 Set<PluginInformation> pluginsToDownload = new HashSet< PluginInformation>(pluginsToUpdate);891 Set<PluginInformation> pluginsToDownload = new HashSet<>(pluginsToUpdate); 892 892 893 893 if (allPlugins != null) { … … 1150 1150 1151 1151 try { 1152 FutureTask<Integer> task = new FutureTask< Integer>(new Callable<Integer>() {1152 FutureTask<Integer> task = new FutureTask<>(new Callable<Integer>() { 1153 1153 @Override 1154 1154 public Integer call() { … … 1218 1218 return null; 1219 1219 1220 Set<String> plugins = new HashSet< String>(1220 Set<String> plugins = new HashSet<>( 1221 1221 Main.pref.getCollection("plugins",Collections.<String> emptySet()) 1222 1222 ); … … 1260 1260 public static String getBugReportText() { 1261 1261 StringBuilder text = new StringBuilder(); 1262 LinkedList <String> pl = new LinkedList< String>(Main.pref.getCollection("plugins", new LinkedList<String>()));1262 LinkedList <String> pl = new LinkedList<>(Main.pref.getCollection("plugins", new LinkedList<String>())); 1263 1263 for (final PluginProxy pp : pluginList) { 1264 1264 PluginInformation pi = pp.getPluginInformation(); -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r7004 r7005 75 75 /** The plugin icon. */ 76 76 public ImageIcon icon; 77 public List<URL> libraries = new LinkedList< URL>();78 public final Map<String, String> attr = new TreeMap< String, String>();77 public List<URL> libraries = new LinkedList<>(); 78 public final Map<String, String> attr = new TreeMap<>(); 79 79 80 80 private static final ImageIcon emptyIcon = new ImageIcon(new BufferedImage(24, 24, BufferedImage.TYPE_INT_ARGB)); … … 401 401 public static Collection<String> getPluginLocations() { 402 402 Collection<String> locations = Main.pref.getAllPossiblePreferenceDirs(); 403 Collection<String> all = new ArrayList< String>(locations.size());403 Collection<String> all = new ArrayList<>(locations.size()); 404 404 for (String s : locations) { 405 405 all.add(s+"plugins"); … … 497 497 498 498 private static List<String> getRequiredPlugins(String pluginList) { 499 List<String> requiredPlugins = new ArrayList< String>();499 List<String> requiredPlugins = new ArrayList<>(); 500 500 if (pluginList != null) { 501 501 for (String s : pluginList.split(";")) { -
trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java
r6920 r7005 58 58 */ 59 59 public List<PluginInformation> parse(InputStream in) throws PluginListParseException{ 60 List<PluginInformation> ret = new LinkedList< PluginInformation>();60 List<PluginInformation> ret = new LinkedList<>(); 61 61 BufferedReader r = null; 62 62 try { -
trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java
r6920 r7005 45 45 public ReadLocalPluginInformationTask() { 46 46 super(tr("Reading local plugin information.."), false); 47 availablePlugins = new HashMap< String, PluginInformation>();47 availablePlugins = new HashMap<>(); 48 48 } 49 49 50 50 public ReadLocalPluginInformationTask(ProgressMonitor monitor) { 51 51 super(tr("Reading local plugin information.."),monitor, false); 52 availablePlugins = new HashMap< String, PluginInformation>();52 availablePlugins = new HashMap<>(); 53 53 } 54 54 … … 237 237 */ 238 238 public List<PluginInformation> getAvailablePlugins() { 239 return new ArrayList< PluginInformation>(availablePlugins.values());239 return new ArrayList<>(availablePlugins.values()); 240 240 } 241 241 -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r6890 r7005 64 64 this.sites = Collections.emptySet(); 65 65 } 66 this.availablePlugins = new LinkedList< PluginInformation>();66 this.availablePlugins = new LinkedList<>(); 67 67 this.displayErrMsg = displayErrMsg; 68 68 } … … 350 350 */ 351 351 protected List<PluginInformation> filterDeprecatedPlugins(List<PluginInformation> plugins) { 352 List<PluginInformation> ret = new ArrayList< PluginInformation>(plugins.size());353 HashSet<String> deprecatedPluginNames = new HashSet< String>();352 List<PluginInformation> ret = new ArrayList<>(plugins.size()); 353 HashSet<String> deprecatedPluginNames = new HashSet<>(); 354 354 for (PluginHandler.DeprecatedPlugin p : PluginHandler.DEPRECATED_PLUGINS) { 355 355 deprecatedPluginNames.add(p.name); … … 389 389 390 390 // collect old cache files and remove if no longer in use 391 List<File> siteCacheFiles = new LinkedList< File>();391 List<File> siteCacheFiles = new LinkedList<>(); 392 392 for (String location : PluginInformation.getPluginLocations()) { 393 393 File [] f = new File(location).listFiles(
Note:
See TracChangeset
for help on using the changeset viewer.