Changeset 18692 in josm
- Timestamp:
- 2023-03-14T20:35:09+01:00 (20 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r18631 r18692 2 2 package org.openstreetmap.josm.gui.dialogs.properties; 3 3 4 import static org.openstreetmap.josm.actions.search.SearchAction.searchStateless; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 109 110 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetType; 110 111 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 112 import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; 111 113 import org.openstreetmap.josm.gui.util.AbstractTag2LinkPopupListener; 112 114 import org.openstreetmap.josm.gui.util.HighlightHelper; … … 355 357 tagRowSorter.setComparator(1, (o1, o2) -> { 356 358 if (o1 instanceof Map && o2 instanceof Map) { 357 final String v1 = ((Map) o1).size() == 1 ? (String) ((Map) o1).keySet().iterator().next() : tr("<different>");358 final String v2 = ((Map) o2).size() == 1 ? (String) ((Map) o2).keySet().iterator().next() : tr("<different>");359 final String v1 = ((Map) o1).size() == 1 ? (String) ((Map) o1).keySet().iterator().next() : KeyedItem.DIFFERENT_I18N; 360 final String v2 = ((Map) o2).size() == 1 ? (String) ((Map) o2).keySet().iterator().next() : KeyedItem.DIFFERENT_I18N; 359 361 return AlphanumComparator.getInstance().compare(v1, v2); 360 362 } else { … … 773 775 tagData.addRow(new Object[]{e.getKey(), e.getValue()}); 774 776 tags.put(e.getKey(), e.getValue().size() == 1 775 ? e.getValue().keySet().iterator().next() : tr("<different>"));777 ? e.getValue().keySet().iterator().next() : KeyedItem.DIFFERENT_I18N); 776 778 } 777 779 … … 1200 1202 roleString = r.getRole(); 1201 1203 } else if (!roleString.equals(r.getRole())) { 1202 roleString = tr("<different>");1204 roleString = KeyedItem.DIFFERENT_I18N; 1203 1205 break; 1204 1206 } … … 1210 1212 @Override 1211 1213 public String toString() { 1212 return "MemberInfo{" + 1213 "roles='" + roleString + '\'' + 1214 ", positions='" + positionString + '\'' + 1215 '}'; 1214 return String.format("MemberInfo{roles='%s', positions='%s'}", roleString, positionString); 1216 1215 } 1217 1216 } … … 1466 1465 return; 1467 1466 final SearchSetting ss = createSearchSetting(key, sel, sameType); 1468 org.openstreetmap.josm.actions.search.SearchAction.searchStateless(ss);1467 searchStateless(ss); 1469 1468 } 1470 1469 } … … 1489 1488 t = "type:relation "; 1490 1489 } 1491 String token = new StringBuilder(t).append(val).toString();1490 String token = t + val; 1492 1491 if (consideredTokens.add(token)) { 1493 1492 s.append(sep).append('(').append(t).append(SearchCompiler.buildSearchStringForTag(key, val)).append(')'); … … 1510 1509 try { 1511 1510 tagRowSorter.convertRowIndexToModel(tagTable.getSelectedRow()); 1512 } catch (IndexOutOfBoundsException ignore) {1513 Logging.trace( ignore);1511 } catch (IndexOutOfBoundsException e) { 1512 Logging.trace(e); 1514 1513 Logging.trace("Clearing tagTable selection"); 1515 1514 tagTable.clearSelection(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/RelationRoleEditor.java
r17557 r18692 15 15 import org.openstreetmap.josm.data.osm.RelationMember; 16 16 import org.openstreetmap.josm.gui.MainApplication; 17 import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; 17 18 import org.openstreetmap.josm.tools.Utils; 18 19 … … 42 43 formatter.formatAsHtmlUnorderedList(relation)), 43 44 oldRole); 44 if (newRole == null || oldRole.equals(newRole) || tr("<different>").equals(newRole)) {45 if (newRole == null || oldRole.equals(newRole) || KeyedItem.DIFFERENT_I18N.equals(newRole)) { 45 46 return; 46 47 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r18313 r18692 89 89 import org.openstreetmap.josm.gui.tagging.ac.AutoCompListener; 90 90 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 91 import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; 91 92 import org.openstreetmap.josm.gui.util.GuiHelper; 92 93 import org.openstreetmap.josm.gui.util.WindowGeometry; … … 538 539 List<AutoCompletionItem> valueList = autocomplete.getTagValues(getAutocompletionKeys(key), usedValuesAwareComparator); 539 540 540 final String selection = m.size() != 1 ? tr("<different>"): m.entrySet().iterator().next().getKey();541 final String selection = m.size() != 1 ? KeyedItem.DIFFERENT_I18N : m.entrySet().iterator().next().getKey(); 541 542 542 543 values = new AutoCompComboBox<>(); … … 586 587 value = null; // delete the key instead 587 588 } 588 if (key.equals(newkey) && tr("<different>").equals(value))589 if (key.equals(newkey) && KeyedItem.DIFFERENT_I18N.equals(value)) 589 590 return; 590 591 if (key.equals(newkey) || value == null) { … … 606 607 Collection<Command> commands = new ArrayList<>(); 607 608 commands.add(new ChangePropertyCommand(sel, key, null)); 608 if (value.equals( tr("<different>"))) {609 if (value.equals(KeyedItem.DIFFERENT_I18N)) { 609 610 String newKey = newkey; 610 611 sel.stream() -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/MaxLengthDocumentFilter.java
r18236 r18692 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.tagging.ac; 3 4 import static org.openstreetmap.josm.tools.I18n.tr;5 3 6 4 import javax.swing.text.AttributeSet; … … 8 6 import javax.swing.text.DocumentFilter; 9 7 import javax.swing.text.StyleConstants; 8 9 import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; 10 10 11 11 /** … … 16 16 /** the document will not accept text longer than this. -1 to disable */ 17 17 private int maxLength = -1; 18 private static final String DIFFERENT = tr("<different>");19 18 20 19 /** 21 20 * Sets the maximum text length. 22 21 * 23 * @param length the maximum no. of characte s allowed in this document. -1 to disable22 * @param length the maximum no. of characters allowed in this document. -1 to disable 24 23 */ 25 24 public void setMaxLength(int length) { … … 45 44 private boolean mustInsertOrReplace(FilterBypass fb, int length, String string, AttributeSet attr) { 46 45 int newLen = fb.getDocument().getLength() - length + ((string == null) ? 0 : string.length()); 47 return (maxLength == -1 || newLen <= maxLength || DIFFERENT.equals(string) ||46 return (maxLength == -1 || newLen <= maxLength || KeyedItem.DIFFERENT_I18N.equals(string) || 48 47 // allow longer text while composing characters or it will be hard to compose 49 48 // the last characters before the limit -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java
r18257 r18692 30 30 protected static final String DIFFERENT = "<different>"; 31 31 /** Translation of {@code "<different>"}. */ 32 p rotected static final String DIFFERENT_I18N = tr(DIFFERENT);32 public static final String DIFFERENT_I18N = tr("<different>"); 33 33 34 34 /** True if the default value should also be set on primitives that already have tags. */
Note:
See TracChangeset
for help on using the changeset viewer.