Ignore:
Timestamp:
2009-04-22T02:39:47+02:00 (15 years ago)
Author:
framm
Message:
  • streamline uploading by requesting commit message as part of the upload confirmation dialog; allow user to re-use latest commit message
File:
1 edited

Legend:

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

    r1523 r1546  
    1515import javax.swing.JPanel;
    1616import javax.swing.JScrollPane;
     17import javax.swing.JTextField;
    1718
    1819import org.openstreetmap.josm.Main;
     
    3637public class UploadAction extends JosmAction {
    3738
     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   
    3846    /** Upload Hook */
    3947    public interface UploadHook {
     
    98106                    p.add(new JScrollPane(l), GBC.eol().fill());
    99107                }
     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));
    100112
    101                 return new ExtendedDialog(Main.parent,
     113                while(true) {
     114                    int result = new ExtendedDialog(Main.parent,
    102115                        tr("Upload these changes?"),
    103116                        p,
    104117                        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;
    106130            }
    107131        });
Note: See TracChangeset for help on using the changeset viewer.