Changeset 28784 in osm for applications
- Timestamp:
- 2012-10-07T16:02:46+02:00 (12 years ago)
- Location:
- applications/editors/josm
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/no_more_mapping/src/nomore/NoMorePlugin.java
r28783 r28784 1 1 package nomore; 2 2 3 import java.util.Date; 4 import javax.swing.JOptionPane; 5 import org.openstreetmap.josm.Main; 3 6 import org.openstreetmap.josm.plugins.Plugin; 4 7 import org.openstreetmap.josm.plugins.PluginInformation; 8 import static org.openstreetmap.josm.tools.I18n.tr; 5 9 6 10 /** … … 13 17 public NoMorePlugin(PluginInformation info) { 14 18 super(info); 19 long startDate = Main.pref.getLong("nomoremapping.date", 0); 20 long lastHash = Math.max(Main.pref.getLong("pluginmanager.lastupdate", 0) / 1000, 21 Math.max(Main.pref.getLong("cache.motd.html", 0), 22 Main.pref.getLong("cache.bing.attribution.xml", 0))) + Main.pref.get("osm-download.bounds", "").hashCode(); 23 boolean sameHash = Main.pref.getLong("nomoremapping.hash", 0) == lastHash; 24 long today = new Date().getTime() / 1000; 25 if( startDate == 0 || !sameHash ) { 26 startDate = today; 27 Main.pref.putLong("nomoremapping.date", startDate); 28 Main.pref.putLong("nomoremapping.hash", lastHash); 29 } 30 long days = Math.max(today - startDate, 0) / (60*60*24); 31 String message; 32 if( days == 0 ) 33 message = "Make it one!"; 34 else if( days < 7 ) 35 message = "Keep going!"; 36 else if( days < 31 ) 37 message = "You're good. Keep on!"; 38 else 39 message = "You don't use Potlach instead, do you?"; 40 String intro = tr("Days without mapping: {0}.", days); 41 String prefs; 42 try { 43 prefs = Main.pref.getPreferenceFile().getCanonicalPath(); 44 } catch( Exception e ) { 45 prefs = Main.pref.getPreferenceFile().getAbsolutePath(); 46 } 47 String howto = days > 0 ? "" : "\n\n" + tr("(To miserably continue mapping, edit out no_more_mapping\nfrom {0})", prefs); 48 JOptionPane.showMessageDialog(Main.parent, intro + " " + message + howto, "No More Mapping", JOptionPane.INFORMATION_MESSAGE); 15 49 System.exit(0); 16 50 }
Note:
See TracChangeset
for help on using the changeset viewer.