Changeset 6806 in josm for trunk/src/org
- Timestamp:
- 2014-02-03T19:26:05+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r6783 r6806 211 211 private static final Collection<MapFrameListener> mapFrameListeners = new ArrayList<MapFrameListener>(); 212 212 213 protected static final Map<String, Throwable> networkErrors= new HashMap<String, Throwable>();213 protected static final Map<String, Throwable> NETWORK_ERRORS = new HashMap<String, Throwable>(); 214 214 215 215 /** … … 1449 1449 public static Throwable addNetworkError(String url, Throwable t) { 1450 1450 if (url != null && t != null) { 1451 return networkErrors.put(url, t);1451 return NETWORK_ERRORS.put(url, t); 1452 1452 } 1453 1453 return null; … … 1460 1460 */ 1461 1461 public static Map<String, Throwable> getNetworkErrors() { 1462 return new HashMap<String, Throwable>( networkErrors);1462 return new HashMap<String, Throwable>(NETWORK_ERRORS); 1463 1463 } 1464 1464 } -
trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
r6734 r6806 69 69 public void actionPerformed(ActionEvent e) { 70 70 if (!isEnabled() || relations.isEmpty()) return; 71 if (relations.size() > Main.pref.getInteger("warn.open.maxrelations", 5) ) {71 if (relations.size() > Main.pref.getInteger("warn.open.maxrelations", 5) && 72 72 /* I18N english text for value 1 makes no real sense, never called for values <= maxrel (usually 5) */ 73 if (JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent,73 JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent, 74 74 "<html>"+trn("You are about to open <b>{0}</b> different relation editor simultaneously.<br/>Do you want to continue?", 75 75 "You are about to open <b>{0}</b> different relation editors simultaneously.<br/>Do you want to continue?", 76 76 relations.size(), relations.size())+"</html>", 77 77 tr("Confirmation"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE)) { 78 return; 79 } 78 return; 80 79 } 81 80 for (Relation r : relations) { -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r6797 r6806 524 524 525 525 private boolean handleNetworkErrors() { 526 boolean condition = ! networkErrors.isEmpty();526 boolean condition = !NETWORK_ERRORS.isEmpty(); 527 527 if (condition) { 528 528 Set<String> errors = new TreeSet<String>(); 529 for (Throwable t : networkErrors.values()) {529 for (Throwable t : NETWORK_ERRORS.values()) { 530 530 errors.add(t.toString()); 531 531 } … … 537 537 "It may result of a missing proxy configuration.<br>" + 538 538 "Would you like to change your proxy settings now?", 539 Utils.joinAsHtmlUnorderedList( networkErrors.keySet()),539 Utils.joinAsHtmlUnorderedList(NETWORK_ERRORS.keySet()), 540 540 Utils.joinAsHtmlUnorderedList(errors) 541 541 )); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverModel.java
r6802 r6806 266 266 } else { 267 267 // Do not suggest to keep all values in order to reduce the wrong usage of semicolon values, see #9104! 268 //decision.keepAll();269 268 } 270 269 } -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r6743 r6806 185 185 @Override 186 186 protected String createInfoUrl(Object infoObject) { 187 HistoryOsmPrimitive primitive= (HistoryOsmPrimitive) infoObject;188 return primitive.getUser() == null ? null : getBaseBrowseUrl() + "/user/" +primitive.getUser().getName();187 HistoryOsmPrimitive hp = (HistoryOsmPrimitive) infoObject; 188 return hp.getUser() == null ? null : getBaseBrowseUrl() + "/user/" + hp.getUser().getName(); 189 189 } 190 190 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r6805 r6806 538 538 return s == null ? null : URLEncoder.encode(s, "UTF-8"); 539 539 } catch (UnsupportedEncodingException ex) { 540 throw new RuntimeException(); 540 throw new RuntimeException(ex); 541 541 } 542 542 } -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java
r6670 r6806 124 124 * The unique instance. 125 125 */ 126 public final staticRulePrefHelper INSTANCE = new RulePrefHelper();126 public static final RulePrefHelper INSTANCE = new RulePrefHelper(); 127 127 128 128 /** -
trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java
r6756 r6806 71 71 return result; 72 72 } 73 74 private static class GeometryPrimitiveVisitor implements PrimitiveVisitor { 75 76 private final JsonObjectBuilder geomObj; 77 78 public GeometryPrimitiveVisitor(JsonObjectBuilder geomObj) { 79 this.geomObj = geomObj; 80 } 81 82 @Override 83 public void visit(INode n) { 84 geomObj.add("type", "Point"); 85 LatLon ll = n.getCoor(); 86 if (ll != null) { 87 geomObj.add("coordinates", getCoorArray(n.getCoor())); 88 } 89 } 90 91 @Override 92 public void visit(IWay w) { 93 geomObj.add("type", "LineString"); 94 if (w instanceof Way) { 95 JsonArrayBuilder array = Json.createArrayBuilder(); 96 for (Node n : ((Way)w).getNodes()) { 97 LatLon ll = n.getCoor(); 98 if (ll != null) { 99 array.add(getCoorArray(ll)); 100 } 101 } 102 geomObj.add("coordinates", array); 103 } 104 } 105 106 @Override 107 public void visit(IRelation r) { 108 } 109 110 private JsonArrayBuilder getCoorArray(LatLon c) { 111 return Json.createArrayBuilder().add(c.lon()).add(c.lat()); 112 } 113 } 73 114 74 115 protected static void appendPrimitive(OsmPrimitive p, JsonArrayBuilder array) { … … 87 128 // Geometry 88 129 final JsonObjectBuilder geomObj = Json.createObjectBuilder(); 89 p.accept(new PrimitiveVisitor() { 90 @Override 91 public void visit(INode n) { 92 geomObj.add("type", "Point"); 93 LatLon ll = n.getCoor(); 94 if (ll != null) { 95 geomObj.add("coordinates", getCoorArray(n.getCoor())); 96 } 97 } 98 99 @Override 100 public void visit(IWay w) { 101 geomObj.add("type", "LineString"); 102 if (w instanceof Way) { 103 JsonArrayBuilder array = Json.createArrayBuilder(); 104 for (Node n : ((Way)w).getNodes()) { 105 LatLon ll = n.getCoor(); 106 if (ll != null) { 107 array.add(getCoorArray(ll)); 108 } 109 } 110 geomObj.add("coordinates", array); 111 } 112 } 113 114 @Override 115 public void visit(IRelation r) { 116 } 117 118 private JsonArrayBuilder getCoorArray(LatLon c) { 119 return Json.createArrayBuilder().add(c.lon()).add(c.lat()); 120 } 121 }); 130 p.accept(new GeometryPrimitiveVisitor(geomObj)); 122 131 123 132 // Build primitive JSON object -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6798 r6806 65 65 public static final Charset UTF_8 = Charset.forName("UTF-8"); 66 66 67 private static final int MILLIS_OF_SECOND = 1000; 68 private static final int MILLIS_OF_MINUTE = 60000; 69 private static final int MILLIS_OF_HOUR = 3600000; 70 private static final int MILLIS_OF_DAY = 86400000; 71 67 72 /** 68 73 * Tests whether {@code predicate} applies to at least one elements from {@code collection}. … … 830 835 */ 831 836 public static String getDurationString(long elapsedTime) throws IllegalArgumentException { 832 final int MILLIS_OF_SECOND = 1000;833 final int MILLIS_OF_MINUTE = 60000;834 final int MILLIS_OF_HOUR = 3600000;835 final int MILLIS_OF_DAY = 86400000;836 837 if (elapsedTime < 0) { 837 838 throw new IllegalArgumentException("elapsedTime must be > 0");
Note:
See TracChangeset
for help on using the changeset viewer.