Changeset 5464 in josm for trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
- Timestamp:
- 2012-08-20T23:06:41+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r4869 r5464 102 102 TemplateEntryProperty result = cache.get(key); 103 103 if (result == null) { 104 String defaultValue = layerName == null?getDefaultLabelPattern():""; 105 TemplateEntryProperty parent = layerName == null?null:forMarker(null); 106 result = new TemplateEntryProperty(key, defaultValue, parent); 107 cache.put(key, result); 104 String defaultValue = layerName == null ? getDefaultLabelPattern():""; 105 TemplateEntryProperty parent = layerName == null ? null : forMarker(null); 106 try { 107 result = new TemplateEntryProperty(key, defaultValue, parent); 108 cache.put(key, result); 109 } catch (ParseError e) { 110 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key)); 111 } 108 112 } 109 113 return result; … … 118 122 if (result == null) { 119 123 String defaultValue = layerName == null?"?{ '{name}' | '{desc}' | '{" + Marker.MARKER_FORMATTED_OFFSET + "}' }":""; 120 TemplateEntryProperty parent = layerName == null?null:forAudioMarker(null); 121 result = new TemplateEntryProperty(key, defaultValue, parent); 122 cache.put(key, result); 124 TemplateEntryProperty parent = layerName == null ? null : forAudioMarker(null); 125 try { 126 result = new TemplateEntryProperty(key, defaultValue, parent); 127 cache.put(key, result); 128 } catch (ParseError e) { 129 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key)); 130 } 123 131 } 124 132 return result; … … 128 136 129 137 130 private TemplateEntryProperty(String key, String defaultValue, TemplateEntryProperty parent) {131 super(key, defaultValue);138 private TemplateEntryProperty(String key, String defaultValue, TemplateEntryProperty parent) throws ParseError { 139 super(key, new TemplateParser(defaultValue).parse(), defaultValue); 132 140 this.parent = parent; 133 141 updateValue(); // Needs to be called because parent wasn't know in super constructor … … 140 148 } catch (ParseError e) { 141 149 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s. Using default ('%s') instead", 142 s, getKey(), defaultValue));150 s, getKey(), super.getDefaultValueAsString())); 143 151 return getDefaultValue(); 144 152 }
Note:
See TracChangeset
for help on using the changeset viewer.