Changeset 1546 in josm for trunk/src/org
- Timestamp:
- 2009-04-22T02:39:47+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r1523 r1546 15 15 import javax.swing.JPanel; 16 16 import javax.swing.JScrollPane; 17 import javax.swing.JTextField; 17 18 18 19 import org.openstreetmap.josm.Main; … … 36 37 public class UploadAction extends JosmAction { 37 38 39 /** 40 * Last commit message used for uploading changes. 41 * FIXME save this in preferences, or even offer list of 10 last recently used comments? 42 * FIXME ugly hack; value is filled here and retrieved in the OsmApi class; find better way 43 */ 44 public static String lastCommitComment; 45 38 46 /** Upload Hook */ 39 47 public interface UploadHook { … … 98 106 p.add(new JScrollPane(l), GBC.eol().fill()); 99 107 } 108 109 p.add(new JLabel(tr("Provide a brief comment for the changes you are uploading:")), GBC.eol().insets(0, 5, 10, 3)); 110 final JTextField cmt = new JTextField(lastCommitComment); 111 p.add(cmt, GBC.eol().fill(GBC.HORIZONTAL)); 100 112 101 return new ExtendedDialog(Main.parent, 113 while(true) { 114 int result = new ExtendedDialog(Main.parent, 102 115 tr("Upload these changes?"), 103 116 p, 104 117 new String[] {tr("Upload Changes"), tr("Cancel")}, 105 new String[] {"upload.png", "cancel.png"}).getValue() == 1; 118 new String[] {"upload.png", "cancel.png"}).getValue(); 119 120 // cancel pressed 121 if (result != 1) return false; 122 123 // don't allow empty commit message 124 if (cmt.getText().trim().length() < 3) continue; 125 126 lastCommitComment = cmt.getText().trim(); 127 break; 128 } 129 return true; 106 130 } 107 131 }); -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r1541 r1546 6 6 import java.io.BufferedReader; 7 7 import java.io.BufferedWriter; 8 import java.io.ByteArrayOutputStream;9 8 import java.io.InputStreamReader; 10 9 import java.io.OutputStream; … … 20 19 import java.util.ArrayList; 21 20 import java.util.Collection; 21 import java.util.HashMap; 22 22 import java.util.Properties; 23 import java.util.HashMap;24 23 import java.util.StringTokenizer; 25 24 -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r1523 r1546 7 7 import java.util.LinkedList; 8 8 9 import javax.swing.JOptionPane;10 11 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.actions.UploadAction; 12 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 12 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; … … 30 29 */ 31 30 public Collection<OsmPrimitive> processed; 31 32 32 33 33 private OsmApi api = new OsmApi(); … … 74 74 "0.6".equals(api.getVersion())); 75 75 76 // solicit commit comment from user77 String comment = null;78 while (useChangesets && comment == null) {79 comment = JOptionPane.showInputDialog(Main.parent,80 tr("Provide a brief comment for the changes you are uploading:"),81 tr("Commit comment"), JOptionPane.QUESTION_MESSAGE);82 if (comment == null)83 return;84 // Don't let people just hit enter85 if (comment.trim().length() >= 3)86 break;87 comment = null;88 }89 90 76 // create changeset if required 91 77 try { 92 if (useChangesets) api.createChangeset( comment);78 if (useChangesets) api.createChangeset(UploadAction.lastCommitComment); 93 79 } catch (OsmTransferException ex) { 94 80 dealWithTransferException(ex);
Note:
See TracChangeset
for help on using the changeset viewer.