- Timestamp:
- 2009-05-05T16:49:28+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r1546 r1575 9 9 import java.util.Collection; 10 10 import java.util.LinkedList; 11 import java.util.List; 11 12 12 13 import javax.swing.JLabel; … … 15 16 import javax.swing.JPanel; 16 17 import javax.swing.JScrollPane; 17 import javax.swing.JTextField;18 18 19 19 import org.openstreetmap.josm.Main; … … 22 22 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 23 23 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 24 import org.openstreetmap.josm.gui.historycombobox.StringUtils; 25 import org.openstreetmap.josm.gui.historycombobox.SuggestingJHistoryComboBox; 24 26 import org.openstreetmap.josm.io.OsmServerWriter; 25 27 import org.openstreetmap.josm.tools.GBC; 28 import org.openstreetmap.josm.tools.Shortcut; 26 29 import org.xml.sax.SAXException; 27 import org.openstreetmap.josm.tools.Shortcut;28 30 29 31 /** … … 36 38 */ 37 39 public class UploadAction extends JosmAction { 40 41 public static final String HISTORY_KEY = "upload.comment.history"; 38 42 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 way43 */44 public static String lastCommitComment;45 46 43 /** Upload Hook */ 47 44 public interface UploadHook { … … 108 105 109 106 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); 107 SuggestingJHistoryComboBox cmt = new SuggestingJHistoryComboBox(); 108 List<String> cmtHistory = StringUtils.stringToList(Main.pref.get(HISTORY_KEY), SuggestingJHistoryComboBox.DELIM); 109 cmt.setHistory(cmtHistory); 110 //final JTextField cmt = new JTextField(lastCommitComment); 111 111 p.add(cmt, GBC.eol().fill(GBC.HORIZONTAL)); 112 112 … … 124 124 if (cmt.getText().trim().length() < 3) continue; 125 125 126 lastCommitComment = cmt.getText().trim(); 126 // store the history of comments 127 cmt.addCurrentItemToHistory(); 128 Main.pref.put(HISTORY_KEY, StringUtils.listToString(cmt.getHistory(), SuggestingJHistoryComboBox.DELIM)); 129 127 130 break; 128 131 } -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r1559 r1575 6 6 import java.util.Collection; 7 7 import java.util.LinkedList; 8 import java.util.List; 8 9 9 10 import javax.swing.JOptionPane; … … 13 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 15 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; 16 import org.openstreetmap.josm.gui.historycombobox.JHistoryComboBox; 17 import org.openstreetmap.josm.gui.historycombobox.StringUtils; 15 18 16 19 /** … … 78 81 // create changeset if required 79 82 try { 80 if (useChangesets) api.createChangeset(UploadAction.lastCommitComment); 83 if (useChangesets) { 84 // add the last entered comment to the changeset 85 String cmt = ""; 86 List<String> history = StringUtils.stringToList(Main.pref.get(UploadAction.HISTORY_KEY), JHistoryComboBox.DELIM); 87 if(history.size() > 0) { 88 cmt = history.get(0); 89 } 90 api.createChangeset(cmt); 91 } 81 92 } catch (OsmTransferException ex) { 82 93 dealWithTransferException(ex);
Note:
See TracChangeset
for help on using the changeset viewer.