Ticket #2442: changeset-comment-patch.txt

File changeset-comment-patch.txt, 1.8 KB (added by Gubaer, 16 years ago)
Line 
1Index: OsmServerWriter.java
2===================================================================
3--- OsmServerWriter.java (revision 1545)
4+++ OsmServerWriter.java (working copy)
5@@ -74,18 +74,32 @@
6 "0.6".equals(api.getVersion()));
7
8 // solicit commit comment from user
9- String comment = null;
10- while (useChangesets && comment == null) {
11- comment = JOptionPane.showInputDialog(Main.parent,
12- tr("Provide a brief comment for the changes you are uploading:"),
13- tr("Commit comment"), JOptionPane.QUESTION_MESSAGE);
14- if (comment == null)
15+ Object userInput = null;
16+ String comment;
17+ String lastChangesetMessage = Main.pref.get("osm-server.last-changeset-message", "updating OSM data");
18+ while (useChangesets && userInput == null) {
19+ userInput = JOptionPane.showInputDialog(Main.parent,
20+ tr("Provide a brief comment for the changes you are uploading (min 3 chars):"),
21+ tr("Commit comment"), JOptionPane.QUESTION_MESSAGE,
22+ null, /* icon */
23+ null, /* selection values */
24+ lastChangesetMessage
25+ );
26+ if (userInput == null) {
27+ // input canceled by the user
28+ //
29 return;
30+ }
31+
32 // Don't let people just hit enter
33- if (comment.trim().length() >= 3)
34+ if (userInput.toString().trim().length() >= 3) {
35 break;
36- comment = null;
37+ }
38 }
39+ // remember last changeset message
40+ //
41+ comment = userInput.toString();
42+ Main.pref.put("osm-server.last-changeset-message", comment);
43
44 // create changeset if required
45 try {
46