Changeset 1860 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2009-07-27T18:36:17+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/plugins
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginDownloader.java
r1811 r1860 28 28 import org.openstreetmap.josm.actions.AboutAction; 29 29 import org.openstreetmap.josm.gui.ExtendedDialog; 30 import org.openstreetmap.josm.gui.OptionPaneUtil; 30 31 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 31 32 import org.xml.sax.SAXException; … … 49 50 50 51 @Override protected void finish() { 51 if (errors.length() > 0) 52 JOptionPane.showMessageDialog(Main.parent, tr("There were problems with the following plugins:\n\n {0}",errors)); 53 else 54 JOptionPane.showMessageDialog(Main.parent, trn("{0} Plugin successfully downloaded. Please restart JOSM.", "{0} Plugins successfully downloaded. Please restart JOSM.", count, count)); 52 if (errors.length() > 0) { 53 OptionPaneUtil.showMessageDialog( 54 Main.parent, 55 tr("There were problems with the following plugins:\n\n {0}",errors), 56 tr("Error"), 57 JOptionPane.ERROR_MESSAGE 58 ); 59 } else { 60 OptionPaneUtil.showMessageDialog( 61 Main.parent, 62 trn("{0} Plugin successfully downloaded. Please restart JOSM.", "{0} Plugins successfully downloaded. Please restart JOSM.", count, count), 63 tr("Information"), 64 JOptionPane.INFORMATION_MESSAGE 65 ); 66 } 55 67 } 56 68 57 69 @Override protected void realRun() throws SAXException, IOException { 58 70 File pluginDir = Main.pref.getPluginsDirFile(); 59 if (!pluginDir.exists()) 71 if (!pluginDir.exists()) { 60 72 pluginDir.mkdirs(); 73 } 61 74 progressMonitor.setTicksCount(toUpdate.size()); 62 75 for (PluginInformation d : toUpdate) { … … 64 77 progressMonitor.worked(1); 65 78 File pluginFile = new File(pluginDir, d.name + ".jar.new"); 66 if(download(d, pluginFile)) 79 if(download(d, pluginFile)) { 67 80 count++; 68 else81 } else 69 82 { 70 83 errors += d.name + "\n"; … … 88 101 int count = 0; 89 102 for (String site : getSites()) { 90 /* TODO: remove old site files (everything except .jar) */103 /* TODO: remove old site files (everything except .jar) */ 91 104 try { 92 105 BufferedReader r = new BufferedReader(new InputStreamReader(new URL(site).openStream(), "utf-8")); 93 106 new File(Main.pref.getPreferencesDir()+"plugins").mkdir(); 94 107 BufferedWriter out = new BufferedWriter(new OutputStreamWriter( 95 new FileOutputStream(new File(Main.pref.getPluginsDirFile(),96 count + "-site-" + site.replaceAll("[/:\\\\ <>|]", "_") + ".txt")), "utf-8"));97 for (String line = r.readLine(); line != null; line = r.readLine()) 108 new FileOutputStream(new File(Main.pref.getPluginsDirFile(), 109 count + "-site-" + site.replaceAll("[/:\\\\ <>|]", "_") + ".txt")), "utf-8")); 110 for (String line = r.readLine(); line != null; line = r.readLine()) { 98 111 out.append(line+"\n"); 112 } 99 113 r.close(); 100 114 out.close(); … … 110 124 { 111 125 int answer = new ExtendedDialog(Main.parent, 112 113 114 115 126 tr("Skip download"), 127 tr("JOSM version {0} required for plugin {1}.", pd.mainversion, pd.name), 128 new String[] {tr("Download Plugin"), tr("Skip Download")}, 129 new String[] {"download.png", "cancel.png"}).getValue(); 116 130 if (answer != 1) 117 131 return false; … … 122 136 OutputStream out = new FileOutputStream(file); 123 137 byte[] buffer = new byte[8192]; 124 for (int read = in.read(buffer); read != -1; read = in.read(buffer)) 138 for (int read = in.read(buffer); read != -1; read = in.read(buffer)) { 125 139 out.write(buffer, 0, read); 140 } 126 141 out.close(); 127 142 in.close(); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r1837 r1860 34 34 import org.openstreetmap.josm.gui.ExtendedDialog; 35 35 import org.openstreetmap.josm.gui.MapFrame; 36 import org.openstreetmap.josm.gui.OptionPaneUtil; 36 37 import org.openstreetmap.josm.gui.download.DownloadSelection; 37 38 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; … … 51 52 List<String> plugins = new LinkedList<String>(); 52 53 Collection<String> cp = Main.pref.getCollection("plugins", null); 53 if (cp != null) 54 if (cp != null) { 54 55 plugins.addAll(cp); 55 if (System.getProperty("josm.plugins") != null) 56 } 57 if (System.getProperty("josm.plugins") != null) { 56 58 plugins.addAll(Arrays.asList(System.getProperty("josm.plugins").split(","))); 59 } 57 60 58 61 String [] oldplugins = new String[] {"mappaint", "unglueplugin", 59 "lang-de", "lang-en_GB", "lang-fr", "lang-it", "lang-pl", "lang-ro",60 "lang-ru", "ewmsplugin", "ywms", "tways-0.2", "geotagged", "landsat",61 "namefinder", "waypoints", "slippy_map_chooser", "tcx-support"};62 "lang-de", "lang-en_GB", "lang-fr", "lang-it", "lang-pl", "lang-ro", 63 "lang-ru", "ewmsplugin", "ywms", "tways-0.2", "geotagged", "landsat", 64 "namefinder", "waypoints", "slippy_map_chooser", "tcx-support"}; 62 65 for (String p : oldplugins) { 63 66 if (plugins.contains(p)) { 64 67 plugins.remove(p); 65 68 Main.pref.removeFromCollection("plugins", p); 66 JOptionPane.showMessageDialog(Main.parent, tr("Warning - loading of {0} plugin was requested. This plugin is no longer required.", p)); 69 OptionPaneUtil.showMessageDialog( 70 Main.parent, 71 tr("Loading of {0} plugin was requested. This plugin is no longer required.", p), 72 tr("Warning"), 73 JOptionPane.WARNING_MESSAGE 74 ); 67 75 } 68 76 } … … 75 83 PluginInformation info = PluginInformation.findPlugin(pluginName); 76 84 if (info != null) { 77 if (info.early != early) 85 if (info.early != early) { 78 86 continue; 87 } 79 88 if (info.mainversion > AboutAction.getVersionNumber()) { 80 JOptionPane.showMessageDialog(Main.parent, tr("Plugin {0} requires JOSM update to version {1}.", pluginName, 81 info.mainversion)); 89 OptionPaneUtil.showMessageDialog( 90 Main.parent, 91 tr("Plugin {0} requires JOSM update to version {1}.", pluginName, 92 info.mainversion), 93 tr("Warning"), 94 JOptionPane.WARNING_MESSAGE 95 ); 82 96 continue; 83 97 } … … 92 106 if(warn != null) 93 107 { 94 JOptionPane.showMessageDialog(Main.parent, 95 tr("Plugin {0} is required by plugin {1} but was not found.", 96 warn, pluginName)); 108 OptionPaneUtil.showMessageDialog(Main.parent, 109 tr("Plugin {0} is required by plugin {1} but was not found.", 110 warn, pluginName), 111 tr("Error"), 112 JOptionPane.ERROR_MESSAGE 113 ); 97 114 continue; 98 115 } 99 116 } 100 if (!p.containsKey(info.stage)) 117 if (!p.containsKey(info.stage)) { 101 118 p.put(info.stage, new LinkedList<PluginInformation>()); 119 } 102 120 p.get(info.stage).add(info); 103 121 } else if(early) { 104 JOptionPane.showMessageDialog(Main.parent, tr("Plugin not found: {0}.", pluginName)); 122 OptionPaneUtil.showMessageDialog( 123 Main.parent, 124 tr("Plugin not found: {0}.", pluginName), 125 tr("Error"), 126 JOptionPane.ERROR_MESSAGE 127 ); 105 128 } 106 129 } … … 114 137 Main.pref.put("pluginmanager.lastupdate",Long.toString(tim)); 115 138 } else if (d > maxTime) { 116 JOptionPane.showMessageDialog(Main.parent, 117 "<html>" + 118 tr("Last plugin update more than {0} days ago.", d) + 119 "<br><em>" + 120 tr("(You can change the number of days after which this warning appears<br>by setting the config option 'pluginmanager.warntime'.)") + 121 "</html>"); 139 OptionPaneUtil.showMessageDialog(Main.parent, 140 "<html>" + 141 tr("Last plugin update more than {0} days ago.", d) + 142 "<br><em>" + 143 tr("(You can change the number of days after which this warning appears<br>by setting the config option 'pluginmanager.warntime'.)") + 144 "</html>", 145 tr("Warning"), 146 JOptionPane.WARNING_MESSAGE 147 ); 122 148 } 123 149 } … … 125 151 // iterate all plugins and collect all libraries of all plugins: 126 152 List<URL> allPluginLibraries = new ArrayList<URL>(); 127 for (Collection<PluginInformation> c : p.values()) 128 for (PluginInformation info : c) 153 for (Collection<PluginInformation> c : p.values()) { 154 for (PluginInformation info : c) { 129 155 allPluginLibraries.addAll(info.libraries); 156 } 157 } 130 158 // create a classloader for all plugins: 131 159 URL[] jarUrls = new URL[allPluginLibraries.size()]; … … 146 174 147 175 int result = new ExtendedDialog(Main.parent, 148 tr("Disable plugin"),149 tr("Could not load plugin {0}. Delete from preferences?", info.name),150 new String[] {tr("Disable plugin"), tr("Keep plugin")},151 new String[] {"dialogs/delete.png", "cancel.png"}).getValue();176 tr("Disable plugin"), 177 tr("Could not load plugin {0}. Delete from preferences?", info.name), 178 new String[] {tr("Disable plugin"), tr("Keep plugin")}, 179 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 152 180 153 181 if(result == 1) … … 161 189 } 162 190 public static void setMapFrame(MapFrame old, MapFrame map) { 163 for (PluginProxy plugin : pluginList) 191 for (PluginProxy plugin : pluginList) { 164 192 plugin.mapFrameInitialized(old, map); 193 } 165 194 } 166 195 … … 174 203 public static void addDownloadSelection(List<DownloadSelection> downloadSelections) 175 204 { 176 for (PluginProxy p : pluginList) 205 for (PluginProxy p : pluginList) { 177 206 p.addDownloadSelection(downloadSelections); 207 } 178 208 } 179 209 public static void getPreferenceSetting(Collection<PreferenceSettingFactory> settings) … … 187 217 { 188 218 if (!PluginDownloader.moveUpdatedPlugins()) { 189 JOptionPane.showMessageDialog(null, 219 OptionPaneUtil.showMessageDialog( 220 Main.parent, 190 221 tr("Activating the updated plugins failed. Check if JOSM has the permission to overwrite the existing ones."), 191 222 tr("Plugins"), JOptionPane.ERROR_MESSAGE); … … 197 228 198 229 // Check for an explicit problem when calling a plugin function 199 if (e instanceof PluginException) 230 if (e instanceof PluginException) { 200 231 plugin = ((PluginException)e).plugin; 232 } 201 233 202 234 if (plugin == null) … … 204 236 String name = null; 205 237 /** 206 * Analyze the stack of the argument and find a name of a plugin, if207 * some known problem pattern has been found.208 *209 * Note: This heuristic is not meant as discrimination against specific210 * plugins, but only to stop the flood of similar bug reports about plugins.211 * Of course, plugin writers are free to install their own version of212 * an exception handler with their email address listed to receive213 * bug reports ;-).214 */238 * Analyze the stack of the argument and find a name of a plugin, if 239 * some known problem pattern has been found. 240 * 241 * Note: This heuristic is not meant as discrimination against specific 242 * plugins, but only to stop the flood of similar bug reports about plugins. 243 * Of course, plugin writers are free to install their own version of 244 * an exception handler with their email address listed to receive 245 * bug reports ;-). 246 */ 215 247 for (StackTraceElement element : e.getStackTrace()) { 216 248 String c = element.getClassName(); 217 249 218 if (c.contains("wmsplugin.") || c.contains(".WMSLayer")) 250 if (c.contains("wmsplugin.") || c.contains(".WMSLayer")) { 219 251 name = "wmsplugin"; 220 if (c.contains("livegps.")) 252 } 253 if (c.contains("livegps.")) { 221 254 name = "livegps"; 222 if (c.startsWith("UtilsPlugin.")) 255 } 256 if (c.startsWith("UtilsPlugin.")) { 223 257 name = "UtilsPlugin"; 258 } 224 259 225 260 if (c.startsWith("org.openstreetmap.josm.plugins.")) { … … 229 264 } 230 265 } 231 if(name != null) 232 break; 266 if(name != null) { 267 break; 268 } 233 269 } 234 270 for (PluginProxy p : pluginList) … … 244 280 if (plugin != null) { 245 281 int answer = new ExtendedDialog(Main.parent, 246 tr("Disable plugin"),247 tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", plugin.info.name)282 tr("Disable plugin"), 283 tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", plugin.info.name) 248 284 + "\n" 249 285 + (plugin.info.author != null 250 ? tr("According to the information within the plugin, the author is {0}.", plugin.info.author)251 : "")252 + "\n"253 + tr("Try updating to the newest version of this plugin before reporting a bug.")254 + "\n"255 + tr("Should the plugin be disabled?"),256 new String[] {tr("Disable plugin"), tr("Cancel")},257 new String[] {"dialogs/delete.png", "cancel.png"}).getValue();286 ? tr("According to the information within the plugin, the author is {0}.", plugin.info.author) 287 : "") 288 + "\n" 289 + tr("Try updating to the newest version of this plugin before reporting a bug.") 290 + "\n" 291 + tr("Should the plugin be disabled?"), 292 new String[] {tr("Disable plugin"), tr("Cancel")}, 293 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 258 294 if (answer == 1) { 259 295 List<String> plugins = new ArrayList<String>(Main.pref.getCollection("plugins", Collections.<String>emptyList())); … … 261 297 while (plugins.remove(plugin.info.name)) {} 262 298 Main.pref.putCollection("plugins", plugins); 263 JOptionPane.showMessageDialog(Main.parent, 264 tr("The plugin has been removed from the configuration. Please restart JOSM to unload the plugin.")); 299 OptionPaneUtil.showMessageDialog(Main.parent, 300 tr("The plugin has been removed from the configuration. Please restart JOSM to unload the plugin."), 301 tr("Information"), 302 JOptionPane.INFORMATION_MESSAGE); 265 303 } else { 266 JOptionPane.showMessageDialog(Main.parent, 267 tr("The plugin could not be removed. Probably it was already disabled")); 304 OptionPaneUtil.showMessageDialog( 305 Main.parent, 306 tr("The plugin could not be removed. Probably it was already disabled"), 307 tr("Error"), 308 JOptionPane.ERROR_MESSAGE 309 ); 268 310 } 269 311 return true; … … 276 318 String text = ""; 277 319 String pl = Main.pref.get("plugins"); 278 if(pl != null && pl.length() != 0) 320 if(pl != null && pl.length() != 0) { 279 321 text += "Plugins: "+pl+"\n"; 322 } 280 323 for (final PluginProxy pp : pluginList) { 281 324 text += "Plugin " + pp.info.name + (pp.info.version != null && !pp.info.version.equals("") ? " Version: "+pp.info.version+"\n" : "\n"); … … 302 345 a.setEditable(false); 303 346 a.setText(b.toString()); 304 JOptionPane.showMessageDialog(Main.parent, new JScrollPane(a)); 347 OptionPaneUtil.showMessageDialog( 348 Main.parent, 349 new JScrollPane(a), 350 tr("Plugin information"), 351 JOptionPane.INFORMATION_MESSAGE 352 ); 305 353 } 306 354 }), GBC.eol()); -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r1767 r1860 8 8 import java.io.IOException; 9 9 import java.io.InputStream; 10 import java.net.MalformedURLException; 10 11 import java.net.URL; 11 import java.net.MalformedURLException;12 12 import java.util.ArrayList; 13 13 import java.util.Collection; … … 15 15 import java.util.List; 16 16 import java.util.Map; 17 import java.util.Set;18 17 import java.util.TreeMap; 19 18 import java.util.jar.Attributes; … … 86 85 Manifest manifest = new Manifest(); 87 86 manifest.read(manifestStream); 88 if(url != null) 87 if(url != null) { 89 88 downloadlink = url; 89 } 90 90 scanManifest(manifest, url != null); 91 91 } catch (IOException e) { … … 100 100 className = attr.getValue("Plugin-Class"); 101 101 String s = attr.getValue(lang+"Plugin-Link"); 102 if(s == null) 102 if(s == null) { 103 103 s = attr.getValue("Plugin-Link"); 104 } 104 105 link = s; 105 106 requires = attr.getValue("Plugin-Requires"); … … 108 109 { 109 110 s = attr.getValue("Plugin-Description"); 110 if(s != null) 111 if(s != null) { 111 112 s = tr(s); 113 } 112 114 } 113 115 description = s; … … 151 153 for (String entry : classPath.split(" ")) { 152 154 File entryFile; 153 if (new File(entry).isAbsolute()) 155 if (new File(entry).isAbsolute()) { 154 156 entryFile = new File(entry); 155 else157 } else { 156 158 entryFile = new File(file.getParent(), entry); 159 } 157 160 158 161 libraries.add(fileToURL(entryFile)); 159 162 } 160 163 } 161 for (Object o : attr.keySet()) 164 for (Object o : attr.keySet()) { 162 165 this.attr.put(o.toString(), attr.getValue(o.toString())); 166 } 163 167 } 164 168 … … 166 170 { 167 171 String d = description == null ? tr("no description available") : description; 168 if(link != null) 172 if(link != null) { 169 173 d += " <A HREF=\""+link+"\">"+tr("More details")+"</A>"; 174 } 170 175 return d; 171 176 } … … 262 267 Collection<String> locations = Main.pref.getAllPossiblePreferenceDirs(); 263 268 Collection<String> all = new ArrayList<String>(locations.size()); 264 for (String s : locations) 269 for (String s : locations) { 265 270 all.add(s+"plugins"); 271 } 266 272 return all; 267 273 } -
trunk/src/org/openstreetmap/josm/plugins/PluginSelection.java
r1818 r1860 38 38 import org.openstreetmap.josm.Main; 39 39 import org.openstreetmap.josm.gui.ExtendedDialog; 40 import org.openstreetmap.josm.gui.OptionPaneUtil; 40 41 import org.openstreetmap.josm.tools.OpenBrowser; 41 42 … … 48 49 public void updateDescription(JPanel pluginPanel) { 49 50 int count = PluginDownloader.downloadDescription(); 50 if (count > 0) 51 JOptionPane.showMessageDialog(Main.parent, 52 trn("Downloaded plugin information from {0} site", 53 "Downloaded plugin information from {0} sites", count, count)); 54 else 55 JOptionPane.showMessageDialog(Main.parent, tr("No plugin information found.")); 51 if (count > 0) { 52 OptionPaneUtil.showMessageDialog(Main.parent, 53 trn("Downloaded plugin information from {0} site", 54 "Downloaded plugin information from {0} sites", count, count), 55 tr("Information"), 56 JOptionPane.INFORMATION_MESSAGE 57 ); 58 } else { 59 OptionPaneUtil.showMessageDialog( 60 Main.parent, 61 tr("No plugin information found."), 62 tr("Error"), 63 JOptionPane.ERROR_MESSAGE 64 ); 65 } 56 66 drawPanel(pluginPanel); 57 67 } … … 80 90 } 81 91 if (toUpdate.isEmpty()) { 82 JOptionPane.showMessageDialog(Main.parent, tr("All installed plugins are up to date.")); 92 OptionPaneUtil.showMessageDialog( 93 Main.parent, 94 tr("All installed plugins are up to date."), 95 tr("Information"), 96 JOptionPane.INFORMATION_MESSAGE 97 ); 83 98 done = true; 84 99 } else { 85 100 int answer = new ExtendedDialog(Main.parent, 86 87 88 89 101 tr("Update"), 102 tr("Update the following plugins:\n\n{0}", toUpdateStr.toString()), 103 new String[] {tr("Update Plugins"), tr("Cancel")}, 104 new String[] {"dialogs/refresh.png", "cancel.png"}).getValue(); 90 105 if (answer == 1) { 91 106 PluginDownloader.update(toUpdate); … … 93 108 } 94 109 } 95 if (done && num >= 1) 110 if (done && num >= 1) { 96 111 Main.pref.put("pluginmanager.lastupdate", Long.toString(System.currentTimeMillis())); 112 } 97 113 drawPanel(pluginPanel); 98 114 } … … 110 126 PluginInformation pi = localPlugins.get(name); 111 127 if(pi == null || (pi.version == null && ap.version != null) 112 || (pi.version != null && !pi.version.equals(ap.version)))128 || (pi.version != null && !pi.version.equals(ap.version))) 113 129 { 114 130 toDownload.add(ap); … … 119 135 if (!toDownload.isEmpty()) { 120 136 int answer = new ExtendedDialog(Main.parent, 121 122 123 124 137 tr("Download missing plugins"), 138 tr("Download the following plugins?\n\n{0}", msg), 139 new String[] {tr("Download Plugins"), tr("Cancel")}, 140 new String[] {"download.png", "cancel.png"}).getValue(); 125 141 Collection<PluginInformation> error = 126 (answer != 1 ? toDownload : new PluginDownloader().download(toDownload));127 for (PluginInformation pd : error) 142 (answer != 1 ? toDownload : new PluginDownloader().download(toDownload)); 143 for (PluginInformation pd : error) { 128 144 pluginMap.put(pd.name, false); 145 } 129 146 130 147 } 131 148 LinkedList<String> plugins = new LinkedList<String>(); 132 149 for (Map.Entry<String, Boolean> d : pluginMap.entrySet()) { 133 if (d.getValue()) 150 if (d.getValue()) { 134 151 plugins.add(d.getKey()); 152 } 135 153 } 136 154 … … 144 162 Collection<String> enabledPlugins = Main.pref.getCollection("plugins", null); 145 163 146 if (pluginMap == null) 164 if (pluginMap == null) { 147 165 pluginMap = new HashMap<String, Boolean>(); 148 else {166 } else { 149 167 // Keep the map in bounds; possibly slightly pointless. 150 168 Set<String> pluginsToRemove = new HashSet<String>(); 151 169 for (final String pname : pluginMap.keySet()) { 152 if (availablePlugins.get(pname) == null) pluginsToRemove.add(pname); 170 if (availablePlugins.get(pname) == null) { 171 pluginsToRemove.add(pname); 172 } 153 173 } 154 174 … … 167 187 for (final PluginInformation plugin : availablePlugins.values()) { 168 188 boolean enabled = (enabledPlugins != null) && enabledPlugins.contains(plugin.name); 169 if (pluginMap.get(plugin.name) == null) 189 if (pluginMap.get(plugin.name) == null) { 170 190 pluginMap.put(plugin.name, enabled); 191 } 171 192 172 193 String remoteversion = plugin.version; 173 if ((remoteversion == null) || remoteversion.equals("")) 194 if ((remoteversion == null) || remoteversion.equals("")) { 174 195 remoteversion = tr("unknown"); 175 else if(plugin.oldmode)196 } else if(plugin.oldmode) { 176 197 remoteversion += "*"; 198 } 177 199 178 200 String localversion = ""; … … 180 202 if(p != null) 181 203 { 182 if (p.version != null && !p.version.equals("")) 204 if (p.version != null && !p.version.equals("")) { 183 205 localversion = p.version; 184 else206 } else { 185 207 localversion = tr("unknown"); 208 } 186 209 localversion = " (" + localversion + ")"; 187 210 } … … 245 268 Arrays.sort(pluginFiles); 246 269 for (File f : pluginFiles) { 247 if (!f.isFile()) 270 if (!f.isFile()) { 248 271 continue; 272 } 249 273 String fname = f.getName(); 250 274 if (fname.endsWith(".jar")) { 251 275 try { 252 276 PluginInformation info = new PluginInformation(f,fname.substring(0,fname.length()-4)); 253 if (!availablePlugins.containsKey(info.name)) 277 if (!availablePlugins.containsKey(info.name)) { 254 278 availablePlugins.put(info.name, info); 255 if (!localPlugins.containsKey(info.name)) 279 } 280 if (!localPlugins.containsKey(info.name)) { 256 281 localPlugins.put(info.name, info); 282 } 257 283 } catch (PluginException x) { 258 284 } … … 290 316 { 291 317 PluginInformation info = new PluginInformation( 292 new ByteArrayInputStream(manifest.getBytes("utf-8")),293 name.substring(0,name.length()-4), url);294 if(!availablePlugins.containsKey(info.name)) 318 new ByteArrayInputStream(manifest.getBytes("utf-8")), 319 name.substring(0,name.length()-4), url); 320 if(!availablePlugins.containsKey(info.name)) { 295 321 availablePlugins.put(info.name, info); 322 } 296 323 } 297 324 catch (Exception e) … … 310 337 { 311 338 PluginInformation info = new PluginInformation( 312 new ByteArrayInputStream(manifest.getBytes("utf-8")),313 name.substring(0,name.length()-4), url);314 if(!availablePlugins.containsKey(info.name)) 339 new ByteArrayInputStream(manifest.getBytes("utf-8")), 340 name.substring(0,name.length()-4), url); 341 if(!availablePlugins.containsKey(info.name)) { 315 342 availablePlugins.put(info.name, info); 343 } 316 344 } 317 345 r.close(); … … 322 350 if(err > 0) 323 351 { 324 JOptionPane.showMessageDialog(Main.parent, tr("Error reading plugin information file: {0}", f.getName())); 352 OptionPaneUtil.showMessageDialog( 353 Main.parent, 354 tr("Error reading plugin information file: {0}", f.getName()), 355 tr("Error"), 356 JOptionPane.ERROR_MESSAGE 357 ); 325 358 } 326 359 } … … 330 363 for (PluginProxy proxy : PluginHandler.pluginList) 331 364 { 332 if (!availablePlugins.containsKey(proxy.info.name)) 365 if (!availablePlugins.containsKey(proxy.info.name)) { 333 366 availablePlugins.put(proxy.info.name, proxy.info); 334 if (!localPlugins.containsKey(proxy.info.name)) 367 } 368 if (!localPlugins.containsKey(proxy.info.name)) { 335 369 localPlugins.put(proxy.info.name, proxy.info); 370 } 336 371 } 337 372 }
Note:
See TracChangeset
for help on using the changeset viewer.