Changeset 4508 in josm


Ignore:
Timestamp:
2011-10-09T03:05:35+02:00 (13 years ago)
Author:
Don-vip
Message:

fix #6938 - should enforce limit of 255 chars per changeset comment when uploading

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r2686 r4508  
    1717 */
    1818public final class Changeset implements Tagged {
     19   
     20    /** The maximum changeset comment text length allowed by API 0.6 **/
     21    public static final int MAX_COMMENT_LENGTH = 255;
     22   
    1923    /** the changeset id */
    2024    private int id;
  • trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

    r3530 r4508  
    2424
    2525import org.openstreetmap.josm.Main;
     26import org.openstreetmap.josm.data.osm.Changeset;
    2627import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
    2728import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    5051        hcbUploadComment = new HistoryComboBox();
    5152        hcbUploadComment.setToolTipText(tr("Enter an upload comment"));
     53        hcbUploadComment.setMaxTextLength(Changeset.MAX_COMMENT_LENGTH);
    5254        List<String> cmtHistory = new LinkedList<String>(Main.pref.getCollection(HISTORY_KEY, new LinkedList<String>()));
    5355        // we have to reverse the history, because ComboBoxHistory will reverse it again
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java

    r4176 r4508  
    1414import javax.swing.JList;
    1515import javax.swing.ListCellRenderer;
     16import javax.swing.text.AbstractDocument;
    1617import javax.swing.text.AttributeSet;
    1718import javax.swing.text.BadLocationException;
     
    2122
    2223import org.openstreetmap.josm.Main;
     24import org.openstreetmap.josm.gui.DocumentSizeFilter;
    2325
    2426/**
     
    149151        setMaximumRowCount(maxsize);
    150152    }
     153   
     154    public void setMaxTextLength(int length)
     155    {
     156        JTextComponent editor = (JTextComponent) this.getEditor().getEditorComponent();
     157        AbstractDocument doc = (AbstractDocument) editor.getDocument();
     158        doc.setDocumentFilter(new DocumentSizeFilter(length));
     159    }
    151160
    152161    /**
Note: See TracChangeset for help on using the changeset viewer.