Changeset 34534 in osm for applications/editors/josm/plugins/no_more_mapping/src
- Timestamp:
- 2018-08-18T18:55:26+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/no_more_mapping/src/nomore/NoMorePlugin.java
r32553 r34534 9 9 import javax.swing.JOptionPane; 10 10 11 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.Preferences; 12 import org.openstreetmap.josm.gui.MainApplication; 12 13 import org.openstreetmap.josm.plugins.Plugin; 13 14 import org.openstreetmap.josm.plugins.PluginInformation; 15 import org.openstreetmap.josm.spi.preferences.Config; 14 16 15 17 /** … … 26 28 public NoMorePlugin(PluginInformation info) { 27 29 super(info); 28 long startDate = Main.pref.getLong("nomoremapping.date", 0);29 long lastHash = Math.max( Main.pref.getLong("pluginmanager.lastupdate", 0) / 1000,30 Math.max( Main.pref.getLong("cache.motd.html", 0),31 Main.pref.getLong("cache.bing.attribution.xml", 0))) + Main.pref.get("osm-download.bounds", "").hashCode();32 boolean sameHash = Main.pref.getLong("nomoremapping.hash", 0) == lastHash;30 long startDate = Config.getPref().getLong("nomoremapping.date", 0); 31 long lastHash = Math.max(Config.getPref().getLong("pluginmanager.lastupdate", 0) / 1000, 32 Math.max(Config.getPref().getLong("cache.motd.html", 0), 33 Config.getPref().getLong("cache.bing.attribution.xml", 0))) + Config.getPref().get("osm-download.bounds", "").hashCode(); 34 boolean sameHash = Config.getPref().getLong("nomoremapping.hash", 0) == lastHash; 33 35 long today = new Date().getTime() / 1000; 34 36 if (startDate == 0 || !sameHash) { 35 37 startDate = today; 36 Main.pref.putLong("nomoremapping.date", startDate);37 Main.pref.putLong("nomoremapping.hash", lastHash);38 Config.getPref().putLong("nomoremapping.date", startDate); 39 Config.getPref().putLong("nomoremapping.hash", lastHash); 38 40 } 39 41 long days = Math.max(today - startDate, 0) / (60*60*24); … … 50 52 String prefs; 51 53 try { 52 prefs = Main.pref.getPreferenceFile().getCanonicalPath();54 prefs = Preferences.main().getPreferenceFile().getCanonicalPath(); 53 55 } catch (IOException e) { 54 prefs = Main.pref.getPreferenceFile().getAbsolutePath();56 prefs = Preferences.main().getPreferenceFile().getAbsolutePath(); 55 57 } 56 58 String howto = days > 0 ? "" : "\n\n" + tr("(To miserably continue mapping, edit out no_more_mapping\nfrom {0})", prefs); 57 JOptionPane.showMessageDialog(Main.parent, intro + " " + message + howto, "No More Mapping", JOptionPane.INFORMATION_MESSAGE); 59 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), intro + " " + message + howto, 60 "No More Mapping", JOptionPane.INFORMATION_MESSAGE); 58 61 System.exit(0); 59 62 }
Note:
See TracChangeset
for help on using the changeset viewer.