Changeset 1073 in josm for trunk/src/org
- Timestamp:
- 2008-11-09T22:10:39+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1062 r1073 33 33 import javax.swing.UIManager; 34 34 35 import org.openstreetmap.josm.actions.AboutAction; 35 36 import org.openstreetmap.josm.actions.downloadtasks.DownloadGpsTask; 36 37 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; … … 247 248 if (info.early != early) 248 249 continue; 250 if (info.mainversion != null && info.mainversion.compareTo(AboutAction.version) < 0) 251 { 252 JOptionPane.showMessageDialog(Main.parent, tr("Plugin requires JOSM update: {0}.", pluginName)); 253 continue; 254 } 249 255 if (!p.containsKey(info.stage)) 250 256 p.put(info.stage, new LinkedList<PluginInformation>()); … … 255 261 else 256 262 JOptionPane.showMessageDialog(Main.parent, tr("Plugin not found: {0}.", pluginName)); 263 } 264 } 265 266 if(!early) 267 { 268 long tim = System.currentTimeMillis(); 269 long last = Main.pref.getLong("pluginmanager.lastupdate", 0); 270 Integer maxTime = Main.pref.getInteger("pluginmanager.warntime", 30*24*60*60); 271 if(last <= 0) 272 { 273 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)); 257 279 } 258 280 } -
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r1066 r1073 52 52 53 53 static { 54 revision = loadFile(Main.class.getResource("/REVISION")); 54 URL u = Main.class.getResource("/REVISION"); 55 if(u == null) u = Main.class.getResource("/META-INF/MANIFEST.MF"); 56 revision = loadFile(u); 55 57 56 Pattern versionPattern = Pattern.compile(".*? Revision: ([0-9]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);58 Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); 57 59 Matcher match = versionPattern.matcher(revision.getText()); 58 60 version = match.matches() ? match.group(1) : tr("UNKNOWN"); 59 61 60 Pattern timePattern = Pattern.compile(".*? Last Changed Date: ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);62 Pattern timePattern = Pattern.compile(".*?(?:Last Changed Date|Main-Date): ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); 61 63 match = timePattern.matcher(revision.getText()); 62 64 time = match.matches() ? match.group(1) : tr("UNKNOWN"); -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r1065 r1073 388 388 } 389 389 390 synchronized public long getLong(String key, long def) { 391 putDefault(key, Long.toString(def)); 392 String v = get(key); 393 if(null == v) 394 return def; 395 396 try { 397 return Long.parseLong(v); 398 } catch(NumberFormatException e) { 399 // fall out 400 } 401 return def; 402 } 403 390 404 synchronized public double getDouble(String key, double def) { 391 405 putDefault(key, Double.toString(def)); … … 408 422 /* handle old comma separated stuff - remove in future */ 409 423 if(s.indexOf(',') >= 0) 424 return Arrays.asList(s.split(",")); 425 /* handle space separated stuff - remove in future */ 426 else if(s.indexOf(' ') >= 0) 410 427 return Arrays.asList(s.split(",")); 411 428 else -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
r794 r1073 35 35 pane.add(cancel, GBC.eol().anchor(GBC.CENTER)); 36 36 setContentPane(pane); 37 setSize( 400,100);37 setSize(Main.pref.getInteger("progressdialog.size",400),100); 38 38 setLocationRelativeTo(Main.parent); 39 39 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
r1053 r1073 198 198 private void update() { 199 199 // refresh description 200 PluginDownloader.downloadDescription(); 200 int num = PluginDownloader.downloadDescription(); 201 Boolean done = false; 201 202 refreshPluginPanel(gui); 202 203 … … 205 206 for (PluginProxy proxy : Main.plugins) { 206 207 PluginDescription description = findDescription(proxy.info.name); 207 if (description != null && (description.version == null || description.version.equals("")) ? (proxy.info.version != null && proxy.info.version.equals("")) : !description.version.equals(proxy.info.version)) { 208 if (description != null && (description.version == null || description.version.equals("")) 209 ? (proxy.info.version != null && proxy.info.version.equals("")) : !description.version.equals(proxy.info.version)) { 208 210 toUpdate.add(description); 209 211 toUpdateStr.append(description.name+"\n"); … … 212 214 if (toUpdate.isEmpty()) { 213 215 JOptionPane.showMessageDialog(Main.parent, tr("All installed plugins are up to date.")); 214 return; 215 } 216 int answer = JOptionPane.showConfirmDialog(Main.parent, tr("Update the following plugins:\n\n{0}", toUpdateStr.toString()), tr("Update"), JOptionPane.OK_CANCEL_OPTION); 217 if (answer != JOptionPane.OK_OPTION) 218 return; 219 PluginDownloader.update(toUpdate); 216 done = true; 217 } 218 else 219 { 220 int answer = JOptionPane.showConfirmDialog(Main.parent, tr("Update the following plugins:\n\n{0}", 221 toUpdateStr.toString()), tr("Update"), JOptionPane.OK_CANCEL_OPTION); 222 if (answer == JOptionPane.OK_OPTION) 223 { 224 PluginDownloader.update(toUpdate); 225 done = true; 226 } 227 } 228 if(done && num >= 1) 229 Main.pref.put("pluginmanager.lastupdate", Long.toString(System.currentTimeMillis())); 220 230 } 221 231 -
trunk/src/org/openstreetmap/josm/plugins/PluginDownloader.java
r1017 r1073 20 20 import java.net.MalformedURLException; 21 21 import java.net.URL; 22 import java.util.Arrays; 22 23 import java.util.Collection; 23 24 import java.util.regex.Matcher; … … 71 72 private static final Pattern wiki = Pattern.compile("^</td></tr><tr><td><a class=\"ext-link\" href=\"([^\"]*)\"><span class=\"icon\">([^<]*)</span></a></td><td>([^<]*)</td><td>([^<].*)</td><td>(.*)"); 72 73 74 private final static String[] pluginSites = {"http://josm.openstreetmap.de/wiki/Plugins"}; 75 76 public static Collection<String> getSites() { 77 return Main.pref.getCollection("pluginmanager.sites", Arrays.asList(pluginSites)); 78 } 79 73 80 public static int downloadDescription() { 74 81 int count = 0; … … 94 101 return count; 95 102 } 96 97 public static String[] getSites() {98 return Main.pref.get("pluginmanager.sites", "http://josm.openstreetmap.de/wiki/Plugins").split(" ");99 }100 103 101 104 private static CharSequence readXml(BufferedReader r) throws IOException { -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r873 r1073 32 32 public final File file; 33 33 public final String name; 34 public final String mainversion; 34 35 public final String className; 35 36 public final String description; … … 81 82 stage = stageStr == null ? 50 : Integer.parseInt(stageStr); 82 83 version = attr.getValue("Plugin-Version"); 84 mainversion = attr.getValue("Plugin-Mainversion"); 83 85 author = attr.getValue("Author"); 84 86 … … 101 103 // resource-only plugin 102 104 className = null; 105 mainversion = null; 103 106 description = tr("unknown"); 104 107 early = false;
Note:
See TracChangeset
for help on using the changeset viewer.