Changeset 5964 in josm for trunk/src/org
- Timestamp:
- 2013-05-17T01:58:59+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r5931 r5964 20 20 import java.io.Reader; 21 21 import java.io.UnsupportedEncodingException; 22 import java.lang.reflect.Method; 23 import java.lang.reflect.Modifier; 22 24 import java.text.NumberFormat; 23 25 import java.text.ParseException; … … 666 668 public String locale_text; 667 669 public String values; 670 public String values_from; 668 671 public String values_context; 669 672 public String display_values; … … 760 763 char delChar = getDelChar(); 761 764 762 String[] value_array = splitEscaped(delChar, values); 765 String[] value_array = null; 766 767 if (values_from != null) { 768 String[] class_method = values_from.split("#"); 769 if (class_method != null && class_method.length == 2) { 770 try { 771 Method method = Class.forName(class_method[0]).getMethod(class_method[1]); 772 // Check method is public static String[] methodName(); 773 int mod = method.getModifiers(); 774 if (Modifier.isPublic(mod) && Modifier.isStatic(mod) 775 && method.getReturnType().equals(String[].class) && method.getParameterTypes().length == 0) { 776 value_array = (String[]) method.invoke(null); 777 } else { 778 System.err.println(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' is not \"{2}\"", key, text, 779 "public static String[] methodName()")); 780 } 781 } catch (Exception e) { 782 System.err.println(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' threw {2} ({3})", key, text, 783 e.getClass().getName(), e.getMessage())); 784 } 785 } 786 } 787 788 if (value_array == null) { 789 value_array = splitEscaped(delChar, values); 790 } 763 791 764 792 final String displ = Utils.firstNonNull(locale_display_values, display_values);
Note:
See TracChangeset
for help on using the changeset viewer.