Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 5578)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 5579)
@@ -378,4 +378,5 @@
         public String originalValue;
         public String use_last_as_default = "false";
+        public String length;
 
         private JComponent value;
@@ -387,4 +388,7 @@
             AutoCompletingTextField textField = new AutoCompletingTextField();
             initAutoCompletionField(textField, key);
+            if (length != null && !length.isEmpty()) {
+                textField.setMaxChars(new Integer(length));
+            }
             if (usage.unused()){
                 if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) {
Index: trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java	(revision 5578)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java	(revision 5579)
@@ -33,4 +33,7 @@
  */
 public class AutoCompletingTextField extends JTextField implements ComboBoxEditor, TableCellEditor {
+
+    private Integer maxChars;
+    
     /**
      * The document model for the editor
@@ -44,4 +47,15 @@
         @Override
         public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
+            
+            // If a maximum number of characters is specified, avoid to exceed it
+            if (maxChars != null && str != null && getLength() + str.length() > maxChars) {
+                int allowedLength = maxChars-getLength();
+                if (allowedLength > 0) {
+                    str = str.substring(0, allowedLength);
+                } else {
+                    return;
+                }
+            }
+            
             if (autoCompletionList == null) {
                 super.insertString(offs, str, a);
@@ -195,4 +209,13 @@
     }
 
+    /**
+     * Sets the maximum number of characters allowed.
+     * @param max maximum number of characters allowed
+     * @since 5579
+     */
+    public void setMaxChars(Integer max) {
+        maxChars = max;
+    }
+
     /* ------------------------------------------------------------------------------------ */
     /* TableCellEditor interface                                                            */
