Ignore:
Timestamp:
2009-05-05T16:49:28+02:00 (16 years ago)
Author:
stoecker
Message:

close #2443 - patch by Henrik Niehaus - History for commit dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r1546 r1575  
    99import java.util.Collection;
    1010import java.util.LinkedList;
     11import java.util.List;
    1112
    1213import javax.swing.JLabel;
     
    1516import javax.swing.JPanel;
    1617import javax.swing.JScrollPane;
    17 import javax.swing.JTextField;
    1818
    1919import org.openstreetmap.josm.Main;
     
    2222import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    2323import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     24import org.openstreetmap.josm.gui.historycombobox.StringUtils;
     25import org.openstreetmap.josm.gui.historycombobox.SuggestingJHistoryComboBox;
    2426import org.openstreetmap.josm.io.OsmServerWriter;
    2527import org.openstreetmap.josm.tools.GBC;
     28import org.openstreetmap.josm.tools.Shortcut;
    2629import org.xml.sax.SAXException;
    27 import org.openstreetmap.josm.tools.Shortcut;
    2830
    2931/**
     
    3638 */
    3739public class UploadAction extends JosmAction {
     40   
     41    public static final String HISTORY_KEY = "upload.comment.history";
    3842
    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    
    4643    /** Upload Hook */
    4744    public interface UploadHook {
     
    108105               
    109106                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);
    111111                p.add(cmt, GBC.eol().fill(GBC.HORIZONTAL));
    112112
     
    124124                    if (cmt.getText().trim().length() < 3) continue;
    125125                   
    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                   
    127130                    break;
    128131                }
Note: See TracChangeset for help on using the changeset viewer.