Changeset 1096 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-11-28T00:08:50+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1095 r1096 181 181 182 182 /** 183 * Remove the specified layer from the map. If it is the last layer, remove the map as well. 183 * Remove the specified layer from the map. If it is the last layer, 184 * remove the map as well. 184 185 */ 185 186 public final void removeLayer(final Layer layer) { … … 217 218 218 219 /** 219 * Load all plugins specified in preferences. If the parameter is <code>true</code>, all220 *early plugins are loaded (before constructor).220 * Load all plugins specified in preferences. If the parameter is 221 * <code>true</code>, all early plugins are loaded (before constructor). 221 222 */ 222 223 public static void loadPlugins(boolean early) { … … 229 230 230 231 String [] oldplugins = new String[] {"mappaint", "unglueplugin", "lang-de","lang-en_GB","lang-fr","lang-it","lang-pl","lang-ro","lang-ru"}; 231 for(String p : oldplugins) 232 { 233 if(plugins.contains(p)) 234 { 232 for (String p : oldplugins) { 233 if (plugins.contains(p)) { 235 234 plugins.remove(p); 236 235 Main.pref.removeFromCollection("plugins", p); … … 248 247 if (info.early != early) 249 248 continue; 250 if (info.mainversion != null && info.mainversion.compareTo(AboutAction.version) > 0) 251 { 249 if (info.mainversion != null && info.mainversion.compareTo(AboutAction.version) > 0) { 252 250 JOptionPane.showMessageDialog(Main.parent, tr("Plugin requires JOSM update: {0}.", pluginName)); 253 251 continue; … … 264 262 } 265 263 266 if(!early) 267 { 264 if (!early) { 268 265 long tim = System.currentTimeMillis(); 269 266 long last = Main.pref.getLong("pluginmanager.lastupdate", 0); 270 267 Integer maxTime = Main.pref.getInteger("pluginmanager.warntime", 30); 271 if(last <= 0) 272 { 268 if (last <= 0) { 273 269 Main.pref.put("pluginmanager.lastupdate",Long.toString(tim)); 274 } 275 else if(tim - last >= maxTime*1000*24*60*60) 276 { 277 long d = (tim - last)/(24*60*60*1000); 278 JOptionPane.showMessageDialog(Main.parent, tr("Last plugin update more than {0} days ago.", d)); 270 } else if (tim - last >= maxTime*1000l*24*60*60) { 271 long d = (tim - last)/(24*60*60*1000l); 272 JOptionPane.showMessageDialog(Main.parent, 273 tr("Last plugin update more than {0} days ago.", d)); 279 274 } 280 275 } … … 348 343 } 349 344 350 351 352 353 345 /** 354 346 * Use this to register shortcuts to … … 357 349 358 350 359 /////////////////////////////////////////////////////////////////////////// /////////////351 /////////////////////////////////////////////////////////////////////////// 360 352 // Implementation part 361 /////////////////////////////////////////////////////////////////////////// /////////////353 /////////////////////////////////////////////////////////////////////////// 362 354 363 355 public static JPanel panel = new JPanel(new BorderLayout()); -
trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
r1073 r1096 12 12 import java.io.File; 13 13 import java.io.FileReader; 14 import java.io.IOException; 14 15 import java.util.Arrays; 15 16 import java.util.Collection; … … 113 114 JButton morePlugins = new JButton(tr("Download List")); 114 115 morePlugins.addActionListener(new ActionListener(){ 115 116 117 118 119 120 121 122 123 116 public void actionPerformed(ActionEvent e) { 117 int count = PluginDownloader.downloadDescription(); 118 if (count > 0) 119 JOptionPane.showMessageDialog(Main.parent, 120 trn("Downloaded plugin information from {0} site", 121 "Downloaded plugin information from {0} sites", count, count)); 122 else 123 JOptionPane.showMessageDialog(Main.parent, tr("No plugin information found.")); 124 refreshPluginPanel(gui); 124 125 } 125 126 }); … … 132 133 refreshPluginPanel(gui); 133 134 } 134 135 135 }); 136 136 plugin.add(update, GBC.std().insets(0,0,10,0)); … … 141 141 configureSites(); 142 142 } 143 144 143 }); 145 144 plugin.add(configureSites, GBC.std()); … … 286 285 pluginCheck.addActionListener(new ActionListener(){ 287 286 public void actionPerformed(ActionEvent e) { 287 // if user enabled a plugin, it is not loaded but found somewhere on disk: offer to delete jar 288 if (pluginCheck.isSelected()) { 289 PluginInformation plinfo = PluginInformation.findPlugin(plugin.name); 290 if ((PluginInformation.getLoaded(plugin.name) == null) && (plinfo != null)) { 291 try { 292 int answer = JOptionPane.showConfirmDialog(Main.parent, 293 tr("Plugin archive already available. Do you want to download current version by deleting existing archive?\n\n{0}", 294 plinfo.file.getCanonicalPath()), tr("Plugin already exists"), JOptionPane.OK_CANCEL_OPTION); 295 if (answer == JOptionPane.OK_OPTION) { 296 if (!plinfo.file.delete()) { 297 JOptionPane.showMessageDialog(Main.parent, tr("Error deleting plugin file: {0}", plinfo.file.getCanonicalPath())); 298 } 299 } 300 } catch (IOException e1) { 301 e1.printStackTrace(); 302 JOptionPane.showMessageDialog(Main.parent, tr("Error deleting plugin file: {0}", e1.getMessage())); 303 } 304 } 305 } 288 306 pluginMap.put(plugin, pluginCheck.isSelected()); 289 307 }
Note:
See TracChangeset
for help on using the changeset viewer.