- Timestamp:
- 2018-04-04T19:47:35+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r12846 r13597 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 19 import org.openstreetmap.josm.data.osm.Relation; 20 import org.openstreetmap.josm.data.osm.Tag;21 20 import org.openstreetmap.josm.gui.MainApplication; 22 21 import org.openstreetmap.josm.spi.preferences.Config; 22 import org.openstreetmap.josm.tools.Utils; 23 23 24 24 /** … … 82 82 Map<String, String> newKeys = new HashMap<>(keys); 83 83 for (Entry<String, String> e : keys.entrySet()) { 84 String v = Tag.removeWhiteSpaces(e.getValue());85 String k = Tag.removeWhiteSpaces(e.getKey());84 String v = Utils.removeWhiteSpaces(e.getValue()); 85 String k = Utils.removeWhiteSpaces(e.getKey()); 86 86 boolean drop = k.isEmpty() || v.isEmpty(); 87 87 if (!e.getKey().equals(k)) { -
trunk/src/org/openstreetmap/josm/data/osm/Tag.java
r10737 r13597 145 145 * @return The string without leading, trailing or multiple inner whitespaces 146 146 * @since 6699 147 */ 147 * @deprecated since 13597. Use {@link Utils#removeWhiteSpaces(String)} instead 148 */ 149 @Deprecated 148 150 public static String removeWhiteSpaces(String s) { 149 if (s == null || s.isEmpty()) { 150 return s; 151 } 152 return Utils.strip(s).replaceAll("\\s+", " "); 151 return Utils.removeWhiteSpaces(s); 153 152 } 154 153 -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r13507 r13597 336 336 CheckParameterUtil.ensureThat(val.contains("=>"), "Separate old from new key by '=>'!"); 337 337 final String[] x = val.split("=>", 2); 338 check.fixCommands.add(FixCommand.fixChangeKey( Tag.removeWhiteSpaces(x[0]),Tag.removeWhiteSpaces(x[1])));338 check.fixCommands.add(FixCommand.fixChangeKey(Utils.removeWhiteSpaces(x[0]), Utils.removeWhiteSpaces(x[1]))); 339 339 } else if (val != null && "fixDeleteObject".equals(ai.key)) { 340 340 CheckParameterUtil.ensureThat("this".equals(val), "fixDeleteObject must be followed by 'this'"); -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r13584 r13597 710 710 commands.add(new ChangePropertyCommand(p, key, null)); 711 711 } else if (value.startsWith(" ") || value.endsWith(" ") || value.contains(" ")) { 712 commands.add(new ChangePropertyCommand(p, key, Tag.removeWhiteSpaces(value)));712 commands.add(new ChangePropertyCommand(p, key, Utils.removeWhiteSpaces(value))); 713 713 } else if (key.startsWith(" ") || key.endsWith(" ") || key.contains(" ")) { 714 commands.add(new ChangePropertyKeyCommand(p, key, Tag.removeWhiteSpaces(key)));714 commands.add(new ChangePropertyKeyCommand(p, key, Utils.removeWhiteSpaces(key))); 715 715 } else { 716 716 String evalue = Entities.unescape(value); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java
r12758 r13597 31 31 import org.openstreetmap.josm.command.Command; 32 32 import org.openstreetmap.josm.data.osm.OsmPrimitive; 33 import org.openstreetmap.josm.data.osm.Tag;34 33 import org.openstreetmap.josm.gui.MainApplication; 35 34 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 39 38 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 40 39 import org.openstreetmap.josm.tools.ImageProvider; 40 import org.openstreetmap.josm.tools.Utils; 41 41 42 42 /** … … 197 197 if (primitives == null || primitives.isEmpty()) 198 198 return null; 199 return new ChangePropertyCommand(primitives, Tag.removeWhiteSpaces(tfKey.getText()),Tag.removeWhiteSpaces(tfValue.getText()));199 return new ChangePropertyCommand(primitives, Utils.removeWhiteSpaces(tfKey.getText()), Utils.removeWhiteSpaces(tfValue.getText())); 200 200 } 201 201 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r13453 r13597 494 494 @Override 495 495 public void performTagEdit() { 496 String value = Tag.removeWhiteSpaces(values.getEditor().getItem().toString());496 String value = Utils.removeWhiteSpaces(values.getEditor().getItem().toString()); 497 497 value = Normalizer.normalize(value, Normalizer.Form.NFC); 498 498 if (value.isEmpty()) { 499 499 value = null; // delete the key 500 500 } 501 String newkey = Tag.removeWhiteSpaces(keys.getEditor().getItem().toString());501 String newkey = Utils.removeWhiteSpaces(keys.getEditor().getItem().toString()); 502 502 newkey = Normalizer.normalize(newkey, Normalizer.Form.NFC); 503 503 if (newkey.isEmpty()) { … … 1060 1060 */ 1061 1061 public final void performTagAdding() { 1062 String key = Tag.removeWhiteSpaces(keys.getEditor().getItem().toString());1063 String value = Tag.removeWhiteSpaces(values.getEditor().getItem().toString());1062 String key = Utils.removeWhiteSpaces(keys.getEditor().getItem().toString()); 1063 String value = Utils.removeWhiteSpaces(values.getEditor().getItem().toString()); 1064 1064 if (key.isEmpty() || value.isEmpty()) 1065 1065 return; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r13483 r13597 530 530 value = ""; 531 531 } 532 value = Tag.removeWhiteSpaces(value);532 value = Utils.removeWhiteSpaces(value); 533 533 534 534 // no change if same as before -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
r13206 r13597 31 31 import org.openstreetmap.josm.tools.GBC; 32 32 import org.openstreetmap.josm.tools.Logging; 33 import org.openstreetmap.josm.tools.Utils; 33 34 34 35 /** … … 207 208 } 208 209 209 v = Tag.removeWhiteSpaces(v);210 v = Utils.removeWhiteSpaces(v); 210 211 211 212 if (!"false".equals(use_last_as_default) || auto_increment != null) { -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r13544 r13597 59 59 Matcher m = p.matcher(line); 60 60 if (m.matches()) { 61 k = m.group(1) .trim();62 v = m.group(2) .trim();61 k = Utils.removeWhiteSpaces(m.group(1)); 62 v = Utils.removeWhiteSpaces(m.group(2)); 63 63 if (unescapeTextInQuotes) { 64 64 k = unescape(k); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r13520 r13597 823 823 824 824 /** 825 * Removes leading, trailing, and multiple inner whitespaces from the given string, to be used as a key or value. 826 * @param s The string 827 * @return The string without leading, trailing or multiple inner whitespaces 828 * @since 13597 829 */ 830 public static String removeWhiteSpaces(String s) { 831 if (s == null || s.isEmpty()) { 832 return s; 833 } 834 return strip(s).replaceAll("\\s+", " "); 835 } 836 837 /** 825 838 * Runs an external command and returns the standard output. 826 839 *
Note:
See TracChangeset
for help on using the changeset viewer.