Index: /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java	(revision 7516)
+++ /trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java	(revision 7517)
@@ -72,4 +72,5 @@
 
     private static int auto_increment_selected = 0;
+    /** Translatation of "&lt;different&gt;". Use in combo boxes to display en entry matching several different values. */
     public static final String DIFFERENT = tr("<different>");
 
@@ -86,4 +87,5 @@
     public static class PresetListEntry {
         public String value;
+        /** The context used for translating {@link #value} */
         public String value_context;
         public String display_value;
@@ -91,5 +93,7 @@
         public String icon;
         public String icon_size;
+        /** The localized version of {@link #display_value}. */
         public String locale_display_value;
+        /** The localized version of {@link #short_description}. */
         public String locale_short_description;
         private final File zipIcons = TaggingPresetReader.getZipIcons();
@@ -118,4 +122,8 @@
         }
 
+        /**
+         * Returns the entry icon, if any.
+         * @return the entry icon, or {@code null}
+         */
         public ImageIcon getIcon() {
             return icon == null ? null : loadImageIcon(icon, zipIcons, parseInteger(icon_size));
@@ -133,4 +141,7 @@
         }
 
+        /**
+         * Construxts a new {@code PresetListEntry}, uninitialized.
+         */
         public PresetListEntry() {
         }
@@ -164,6 +175,9 @@
         public EnumSet<TaggingPresetType> types;
         public String key;
+        /** The text to display */
         public String text;
+        /** The context used for translating {@link #text} */
         public String text_context;
+        /** The localized version of {@link #text}. */
         public String locale_text;
         public SearchCompiler.Match memberExpression;
@@ -211,5 +225,5 @@
         public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) {
             String cstring;
-            if(count > 0 && !required) {
+            if (count > 0 && !required) {
                 cstring = "0,"+count;
             } else if(count > 0) {
@@ -220,17 +234,11 @@
                 cstring = "1-...";
             }
-            if(locale_text == null) {
-                if (text != null) {
-                    if(text_context != null) {
-                        locale_text = trc(text_context, fixPresetString(text));
-                    } else {
-                        locale_text = tr(fixPresetString(text));
-                    }
-                }
+            if (locale_text == null) {
+                locale_text = getLocaleText(text, text_context, null);
             }
             p.add(new JLabel(locale_text+":"), GBC.std().insets(0,0,10,0));
             p.add(new JLabel(key), GBC.std().insets(0,0,10,0));
             p.add(new JLabel(cstring), types == null ? GBC.eol() : GBC.std().insets(0,0,10,0));
-            if(types != null){
+            if (types != null) {
                 JPanel pp = new JPanel();
                 for(TaggingPresetType t : types) {
@@ -248,19 +256,11 @@
     public static enum MatchType {
 
-        /**
-         * Neutral, i.e., do not consider this item for matching.
-         */
+        /** Neutral, i.e., do not consider this item for matching. */
         NONE("none"),
-        /**
-         * Positive if key matches, neutral otherwise.
-         */
+        /** Positive if key matches, neutral otherwise. */
         KEY("key"),
-        /**
-         * Positive if key matches, negative otherwise.
-         */
+        /** Positive if key matches, negative otherwise. */
         KEY_REQUIRED("key!"),
-        /**
-         * Positive if key and value matches, negative otherwise.
-         */
+        /** Positive if key and value matches, negative otherwise. */
         KEY_VALUE("keyvalue");
 
@@ -271,8 +271,17 @@
         }
 
+        /**
+         * Replies the associated textual value.
+         * @return the associated textual value
+         */
         public String getValue() {
             return value;
         }
 
+        /**
+         * Determines the {@code MatchType} for the given textual value.
+         * @param type the textual value
+         * @return the {@code MatchType} for the given textual value
+         */
         public static MatchType ofString(String type) {
             for (MatchType i : EnumSet.allOf(MatchType.class)) {
@@ -288,4 +297,5 @@
         boolean hadKeys = false;
         boolean hadEmpty = false;
+
         public boolean hasUniqueValue() {
             return values.size() == 1 && !hadEmpty;
@@ -295,4 +305,5 @@
             return values.isEmpty();
         }
+
         public String getFirst() {
             return values.first();
@@ -310,28 +321,16 @@
     public abstract static class TaggingPresetTextItem extends TaggingPresetItem {
 
-        /**
-         * The text to display
-         */
+        /** The text to display */
         public String text;
 
-        /**
-         * The context used for translating {@link #text}
-         */
+        /** The context used for translating {@link #text} */
         public String text_context;
 
-        /**
-         * The localized version of {@link #text}
-         */
+        /** The localized version of {@link #text} */
         public String locale_text;
 
         protected final void initializeLocaleText(String defaultText) {
             if (locale_text == null) {
-                if (text == null) {
-                    locale_text = defaultText;
-                } else if (text_context != null) {
-                    locale_text = trc(text_context, fixPresetString(text));
-                } else {
-                    locale_text = tr(fixPresetString(text));
-                }
+                locale_text = getLocaleText(text, text_context, defaultText);
             }
         }
@@ -353,4 +352,7 @@
     }
 
+    /**
+     * Label type.
+     */
     public static class Label extends TaggingPresetTextItem {
 
@@ -372,14 +374,13 @@
     }
 
+    /**
+     * Hyperlink type.
+     */
     public static class Link extends TaggingPresetTextItem {
 
-        /**
-         * The link to display
-         */
+        /** The link to display. */
         public String href;
 
-        /**
-         * The localized version of {@link #href}
-         */
+        /** The localized version of {@link #href}. */
         public String locale_href;
 
@@ -474,4 +475,7 @@
     }
 
+    /**
+     * Horizontal separator type.
+     */
     public static class Space extends TaggingPresetItem {
 
@@ -514,8 +518,13 @@
     }
 
+    /**
+     * Preset item associated to an OSM key.
+     */
     public abstract static class KeyedItem extends TaggingPresetItem {
 
         public String key;
+        /** The text to display */
         public String text;
+        /** The context used for translating {@link #text} */
         public String text_context;
         public String match = getDefaultMatch().getValue();
@@ -548,6 +557,10 @@
     }
 
+    /**
+     * Invisible type allowing to hardcode an OSM key/value from the preset definition.
+     */
     public static class Key extends KeyedItem {
 
+        /** The hardcoded value for key */
         public String value;
 
@@ -580,6 +593,10 @@
     }
 
+    /**
+     * Text field type.
+     */
     public static class Text extends KeyedItem {
 
+        /** The localized version of {@link #text}. */
         public String locale_text;
         public String default_;
@@ -643,11 +660,5 @@
             }
             if (locale_text == null) {
-                if (text != null) {
-                    if (text_context != null) {
-                        locale_text = trc(text_context, fixPresetString(text));
-                    } else {
-                        locale_text = tr(fixPresetString(text));
-                    }
-                }
+                locale_text = getLocaleText(text, text_context, null);
             }
 
@@ -806,10 +817,18 @@
     }
 
+    /**
+     * Checkbox type.
+     */
     public static class Check extends KeyedItem {
 
+        /** The localized version of {@link #text}. */
         public String locale_text;
+        /** the value to set when checked (default is "yes") */
         public String value_on = OsmUtils.trueval;
+        /** the value to set when unchecked (default is "no") */
         public String value_off = OsmUtils.falseval;
+        /** whether the off value is disabled in the dialog, i.e., only unset or yes are provided */
         public boolean disable_off = false;
+        /** ticked on/off (default is "off") */
         public boolean default_ = false; // only used for tagless objects
 
@@ -818,5 +837,6 @@
         private boolean def;
 
-        @Override public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
+        @Override
+        public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
 
             // find out if our key is already used in the selection.
@@ -825,10 +845,6 @@
             def = default_;
 
-            if(locale_text == null) {
-                if(text_context != null) {
-                    locale_text = trc(text_context, fixPresetString(text));
-                } else {
-                    locale_text = tr(fixPresetString(text));
-                }
+            if (locale_text == null) {
+                locale_text = getLocaleText(text, text_context, null);
             }
 
@@ -837,5 +853,5 @@
                     // default is set and filling default values feature is disabled - check if all primitives are untagged
                     for (OsmPrimitive s : sel)
-                        if(s.hasKeys()) {
+                        if (s.hasKeys()) {
                             def = false;
                         }
@@ -873,5 +889,6 @@
         }
 
-        @Override public void addCommands(List<Tag> changedTags) {
+        @Override
+        public void addCommands(List<Tag> changedTags) {
             // if the user hasn't changed anything, don't create a command.
             if (check.getState() == initialState && !def) return;
@@ -883,5 +900,7 @@
                             null));
         }
-        @Override boolean requestFocusInWindow() {return check.requestFocusInWindow();}
+
+        @Override
+        boolean requestFocusInWindow() {return check.requestFocusInWindow();}
 
         @Override
@@ -908,13 +927,20 @@
     }
 
+    /**
+     * Abstract superclass for combo box and multi-select list types.
+     */
     public abstract static class ComboMultiSelect extends KeyedItem {
 
+        /** The localized version of {@link #text}. */
         public String locale_text;
         public String values;
         public String values_from;
+        /** The context used for translating {@link #values} */
         public String values_context;
         public String display_values;
+        /** The localized version of {@link #display_values}. */
         public String locale_display_values;
         public String short_descriptions;
+        /** The localized version of {@link #short_descriptions}. */
         public String locale_short_descriptions;
         public String default_;
@@ -1000,5 +1026,5 @@
             }
             if (locale_text == null) {
-                locale_text = trc(text_context, fixPresetString(text));
+                locale_text = getLocaleText(text, text_context, null);
             }
             initialized = true;
@@ -1187,4 +1213,7 @@
     }
 
+    /**
+     * Combobox type.
+     */
     public static class Combo extends ComboMultiSelect {
 
@@ -1275,4 +1304,8 @@
         }
     }
+
+    /**
+     * Multi-select list type.
+     */
     public static class MultiSelect extends ComboMultiSelect {
 
@@ -1310,6 +1343,4 @@
             }
             p.add(sp, GBC.eol().fill(GBC.HORIZONTAL));
-
-
         }
 
@@ -1393,4 +1424,14 @@
     static String fixPresetString(String s) {
         return s == null ? s : s.replaceAll("'","''");
+    }
+
+    private static String getLocaleText(String text, String text_context, String defaultText) {
+        if (text == null) {
+            return defaultText;
+        } else if (text_context != null) {
+            return trc(text_context, fixPresetString(text));
+        } else {
+            return tr(fixPresetString(text));
+        }
     }
 
@@ -1428,5 +1469,4 @@
     }
 
-
     static Usage determineTextUsage(Collection<OsmPrimitive> sel, String key) {
         Usage returnValue = new Usage();
@@ -1445,4 +1485,5 @@
         return returnValue;
     }
+
     static Usage determineBooleanUsage(Collection<OsmPrimitive> sel, String key) {
 
@@ -1457,4 +1498,5 @@
         return returnValue;
     }
+
     protected static ImageIcon loadImageIcon(String iconName, File zipIcons, Integer maxSize) {
         final Collection<String> s = Main.pref.getCollection("taggingpreset.icon.sources", null);
