Changeset 2372 in josm
- Timestamp:
- 2009-11-01T14:14:52+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r2371 r2372 323 323 public void save() throws IOException { 324 324 /* currently unused, but may help to fix configuration issues in future */ 325 p roperties.put("josm.version", Version.getInstance().getVersionString());325 putInteger("josm.version", Version.getInstance().getVersion()); 326 326 327 327 updateSystemProperties(); -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r2323 r2372 3 3 package org.openstreetmap.josm.gui; 4 4 5 import static org.openstreetmap.josm.tools.I18n.marktr;6 5 import static org.openstreetmap.josm.tools.I18n.tr; 7 6 … … 159 158 public final JosmAction statusreport = new ShowStatusReportAction(); 160 159 161 public final JMenu fileMenu = addMenu( marktr("File"), KeyEvent.VK_F, 0, ht("/Menu/File"));162 public final JMenu editMenu = addMenu( marktr("Edit"), KeyEvent.VK_E, 1, ht("/Menu/Edit"));163 public final JMenu viewMenu = addMenu( marktr("View"), KeyEvent.VK_V, 2, ht("/Menu/View"));164 public final JMenu toolsMenu = addMenu( marktr("Tools"), KeyEvent.VK_T, 3, ht("/Menu/Tools"));165 public final JMenu presetsMenu = addMenu( marktr("Presets"), KeyEvent.VK_P, 4, ht("/Menu/Presets"));160 public final JMenu fileMenu = addMenu(tr("File"), KeyEvent.VK_F, 0, ht("/Menu/File")); 161 public final JMenu editMenu = addMenu(tr("Edit"), KeyEvent.VK_E, 1, ht("/Menu/Edit")); 162 public final JMenu viewMenu = addMenu(tr("View"), KeyEvent.VK_V, 2, ht("/Menu/View")); 163 public final JMenu toolsMenu = addMenu(tr("Tools"), KeyEvent.VK_T, 3, ht("/Menu/Tools")); 164 public final JMenu presetsMenu = addMenu(tr("Presets"), KeyEvent.VK_P, 4, ht("/Menu/Presets")); 166 165 public JMenu audioMenu = null; 167 public final JMenu helpMenu = addMenu( marktr("Help"), KeyEvent.VK_H, 5, ht("/Menu/Help"));166 public final JMenu helpMenu = addMenu(tr("Help"), KeyEvent.VK_H, 5, ht("/Menu/Help")); 168 167 public final int defaultMenuPos = 5; 169 168 … … 185 184 return menuitem; 186 185 } 187 188 @Deprecated 189 public JMenu addMenu(String name, int mnemonicKey, int position) { 190 return addMenu(name, mnemonicKey, position, "/Menu/" + name); 191 } 192 186 193 187 public JMenu addMenu(String name, int mnemonicKey, int position, String relativeHelpTopic) { 194 JMenu menu = new JMenu( tr(name));188 JMenu menu = new JMenu(name); 195 189 Shortcut.registerShortcut("menu:" + name, tr("Menu: {0}", tr(name)), mnemonicKey, 196 190 Shortcut.GROUP_MNEMONIC).setMnemonic(menu); … … 314 308 315 309 if (!Main.pref.getBoolean("audio.menuinvisible", false)) { 316 audioMenu = addMenu( marktr("Audio"), KeyEvent.VK_A, 5, ht("/Menu/Audio"));310 audioMenu = addMenu(tr("Audio"), KeyEvent.VK_A, 5, ht("/Menu/Audio")); 317 311 add(audioMenu, audioPlayPause); 318 312 add(audioMenu, audioNext); -
trunk/src/org/openstreetmap/josm/plugins/PluginDownloader.java
r2358 r2372 39 39 private String errors = ""; 40 40 private int count = 0; 41 private boolean restart; 41 42 42 private UpdateTask(Collection<PluginInformation> toUpdate, boolean up ) {43 private UpdateTask(Collection<PluginInformation> toUpdate, boolean up, boolean restart) { 43 44 super(up ? tr("Update Plugins") : tr("Download Plugins")); 44 45 this.toUpdate = toUpdate; 46 this.restart = restart; 45 47 } 46 48 … … 58 60 ); 59 61 } else { 62 String txt = trn("{0} Plugin successfully downloaded.", "{0} Plugins successfully downloaded.", count, count); 63 if(restart) 64 txt += "\n"+tr("Please restart JOSM."); 65 60 66 JOptionPane.showMessageDialog( 61 67 Main.parent, 62 t rn("{0} Plugin successfully downloaded. Please restart JOSM.", "{0} Plugins successfully downloaded. Please restart JOSM.", count, count),68 txt, 63 69 tr("Information"), 64 70 JOptionPane.INFORMATION_MESSAGE … … 154 160 } 155 161 156 public static void update(Collection<PluginInformation> update ) {157 Main.worker.execute(new UpdateTask(update, true ));162 public static void update(Collection<PluginInformation> update, boolean restart) { 163 Main.worker.execute(new UpdateTask(update, true, restart)); 158 164 } 159 165 … … 162 168 // Waiting for result is not a good idea because the waiting thread will probably be either EDT 163 169 // or worker thread. Blocking one of these threads will cause deadlock 164 UpdateTask t = new UpdateTask(download, false );170 UpdateTask t = new UpdateTask(download, false, true); 165 171 t.run(); 166 172 return t.failed; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r2360 r2372 91 91 } 92 92 93 94 93 if (plugins.isEmpty()) 95 94 return; 95 96 if(early) 97 { 98 String doUpdate = null; 99 String check = null; 100 int v = Version.getInstance().getVersion(); 101 if(Main.pref.getInteger("pluginmanager.version", 0) < v) 102 { 103 doUpdate = tr("You updated your JOSM software\nTo prevent problems the plugins should be updated as well.\n" 104 + "Update plugins now?"); 105 check = "pluginmanger.version"; 106 } 107 else 108 { 109 long tim = System.currentTimeMillis(); 110 long last = Main.pref.getLong("pluginmanager.lastupdate", 0); 111 Integer maxTime = Main.pref.getInteger("pluginmanager.warntime", 60); 112 long d = (tim - last)/(24*60*60*1000l); 113 if ((last <= 0) || (maxTime <= 0)) { 114 Main.pref.put("pluginmanager.lastupdate",Long.toString(tim)); 115 } else if (d > maxTime) { 116 doUpdate = tr("Last plugin update more than {0} days ago.", d); 117 check = "pluginmanager.time"; 118 } 119 } 120 if(doUpdate != null) 121 { 122 ExtendedDialog dialog = new ExtendedDialog( 123 Main.parent, 124 tr("Update plugins"), 125 new String[] {tr("Update plugins"), tr("Skip update")} 126 ); 127 dialog.setContent(doUpdate); 128 dialog.toggleEnable(check); 129 dialog.setButtonIcons( new String[] {"dialogs/refresh.png", "cancel.png"}); 130 dialog.showDialog(); 131 if(dialog.getValue() == 1) 132 new PluginSelection().update(); 133 } 134 } 96 135 97 136 SortedMap<Integer, Collection<PluginInformation>> p = new TreeMap<Integer, Collection<PluginInformation>>(); … … 143 182 tr("Error"), 144 183 JOptionPane.ERROR_MESSAGE 145 );146 }147 }148 149 if (!early) {150 long tim = System.currentTimeMillis();151 long last = Main.pref.getLong("pluginmanager.lastupdate", 0);152 Integer maxTime = Main.pref.getInteger("pluginmanager.warntime", 30);153 long d = (tim - last)/(24*60*60*1000l);154 if ((last <= 0) || (maxTime <= 0)) {155 Main.pref.put("pluginmanager.lastupdate",Long.toString(tim));156 } else if (d > maxTime) {157 JOptionPane.showMessageDialog(Main.parent,158 "<html>" +159 tr("Last plugin update more than {0} days ago.", d) +160 "<br><em>" +161 tr("(You can change the number of days after which this warning appears<br>by setting the config option 'pluginmanager.warntime'.)") +162 "</html>",163 tr("Warning"),164 JOptionPane.WARNING_MESSAGE165 184 ); 166 185 } -
trunk/src/org/openstreetmap/josm/plugins/PluginSelection.java
r2152 r2372 38 38 39 39 import org.openstreetmap.josm.Main; 40 import org.openstreetmap.josm.data.Version; 40 41 import org.openstreetmap.josm.gui.ExtendedDialog; 41 42 import org.openstreetmap.josm.tools.OpenBrowser; … … 75 76 } 76 77 78 public void update() { 79 update(null); 80 } 81 77 82 public void update(JPanel pluginPanel) { 78 83 // refresh description … … 80 85 Boolean done = false; 81 86 loadPlugins(); 82 drawPanel(pluginPanel); 87 if(pluginPanel != null) 88 drawPanel(pluginPanel); 83 89 84 90 Set<PluginInformation> toUpdate = new HashSet<PluginInformation>(); … … 115 121 116 122 if (ed.getValue() == 1) { 117 PluginDownloader.update(toUpdate );123 PluginDownloader.update(toUpdate, pluginPanel != null); 118 124 done = true; 119 125 } … … 121 127 if (done && num >= 1) { 122 128 Main.pref.put("pluginmanager.lastupdate", Long.toString(System.currentTimeMillis())); 129 Main.pref.putInteger("pluginmanager.version", Version.getInstance().getVersion()); 123 130 } 124 131 loadPlugins(); 125 drawPanel(pluginPanel); 132 if(pluginPanel != null) 133 drawPanel(pluginPanel); 126 134 } 127 135
Note:
See TracChangeset
for help on using the changeset viewer.