- Timestamp:
- 2007-07-08T00:32:06+02:00 (17 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
r277 r282 61 61 private Box pluginPanel = Box.createVerticalBox(); 62 62 private JPanel plugin; 63 private PreferenceDialog gui; 63 64 64 65 public void addGui(final PreferenceDialog gui) { 66 this.gui = gui; 65 67 plugin = gui.createPreferenceTab("plugin", tr("Plugins"), tr("Configure available Plugins.")); 66 68 JScrollPane pluginPane = new JScrollPane(pluginPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); … … 123 125 public void actionPerformed(ActionEvent e) { 124 126 pluginMap.put(plugin, pluginCheck.isSelected()); 125 gui.requiresRestart = true;126 127 } 127 128 }); … … 189 190 else 190 191 for (PluginDescription pd : toDownload) 191 PluginDownloader.downloadPlugin(pd); 192 if (!PluginDownloader.downloadPlugin(pd)) 193 pluginMap.put(pd, false); 194 192 195 } 193 196 194 197 String plugins = ""; 195 for (Entry<PluginDescription, Boolean> entry : pluginMap.entrySet()) {196 if (entry.getValue()) {198 for (Entry<PluginDescription, Boolean> entry : pluginMap.entrySet()) 199 if (entry.getValue()) 197 200 plugins += entry.getKey().name + ","; 198 if (PluginInformation.findPlugin(entry.getKey().name) == null)199 toDownload.add(entry.getKey());200 }201 }202 201 if (plugins.endsWith(",")) 203 202 plugins = plugins.substring(0, plugins.length()-1); 204 Main.pref.put("plugins", plugins); 203 204 String oldPlugins = Main.pref.get("plugins"); 205 if (!plugins.equals(oldPlugins)) { 206 Main.pref.put("plugins", plugins); 207 gui.requiresRestart = true; 208 } 205 209 } 206 210 } -
src/org/openstreetmap/josm/plugins/PluginDownloader.java
r277 r282 75 75 } 76 76 77 public static voiddownloadPlugin(PluginDescription pd) {77 public static boolean downloadPlugin(PluginDescription pd) { 78 78 File file = new File(Main.pref.getPreferencesDir()+"plugins/"+pd.name+".jar"); 79 79 try { … … 85 85 out.close(); 86 86 in.close(); 87 try { 88 PluginInformation.findPlugin(pd.name); 89 return true; 90 } catch (Exception e) { 91 e.printStackTrace(); 92 JOptionPane.showMessageDialog(Main.parent, tr("The plugin {0} seem to be broken or could not be downloaded automatically.", pd.name)); 93 } 87 94 } catch (Exception e) { 88 if (file.exists())89 file.delete();90 95 JOptionPane.showMessageDialog(Main.parent, tr("Could not download plugin: {0} from {1}", pd.name, pd.resource)); 91 96 } 97 if (file.exists()) 98 file.delete(); 99 return false; 92 100 } 93 101 }
Note:
See TracChangeset
for help on using the changeset viewer.