Changeset 19120 in josm
- Timestamp:
- 2024-06-20T15:55:07+02:00 (5 months ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r18871 r19120 113 113 if (dm != null) { 114 114 AffineTransform transform = gd.getDefaultConfiguration().getDefaultTransform(); 115 // Java 11: use DisplayMode#toString 116 text.format(Locale.ROOT, " %d\u00D7%d (scaling %.2f\u00D7%.2f)", 117 dm.getWidth(), dm.getHeight(), transform.getScaleX(), transform.getScaleY()); 115 text.format(Locale.ROOT, " %s (scaling %.2f\u00D7%.2f)", 116 dm, transform.getScaleX(), transform.getScaleY()); 118 117 } 119 118 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r17455 r19120 49 49 /** 50 50 * Panel to inspect one or more OsmPrimitives. 51 * 51 * <p> 52 52 * Gives an unfiltered view of the object's internal state. 53 53 * Might be useful for power users to give more detailed bug reports and … … 129 129 String heading = tr("Styles for \"{0}\":", osm.getDisplayName(DefaultNameFormatter.getInstance())); 130 130 txtMappaint.println(heading); 131 txtMappaint.println( repeatString("=",heading.length()));131 txtMappaint.println("=".repeat(heading.length())); 132 132 133 133 MultiCascade mc = new MultiCascade(); … … 137 137 heading = tr("{0} style \"{1}\"", getSort(s), s.getDisplayString()); 138 138 txtMappaint.println(heading); 139 txtMappaint.println( repeatString("-",heading.length()));139 txtMappaint.println("-".repeat(heading.length())); 140 140 s.apply(mc, osm, scale, false); 141 141 txtMappaint.println(tr("Display range: {0}", mc.range)); … … 150 150 heading = tr("List of generated Styles:"); 151 151 txtMappaint.println(heading); 152 txtMappaint.println( repeatString("-",heading.length()));152 txtMappaint.println("-".repeat(heading.length())); 153 153 StyleElementList sl = elemstyles.get(osm, scale, nc); 154 154 for (StyleElement s : sl) { … … 177 177 } 178 178 return stringWriter.toString(); 179 }180 181 private static String repeatString(String string, int count) {182 // Java 11: use String.repeat183 return new String(new char[count]).replace("\0", string);184 179 } 185 180 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerModel.java
r18338 r19120 90 90 */ 91 91 public List<Changeset> getSelectedChangesets() { 92 return Arrays.stream( TableHelper.getSelectedIndices(selectionModel))92 return Arrays.stream(selectionModel.getSelectedIndices()) 93 93 .map(sorter::convertRowIndexToModel).mapToObj(data::get).collect(Collectors.toList()); 94 94 } -
trunk/src/org/openstreetmap/josm/gui/util/ReorderableTableModel.java
r17773 r19120 42 42 */ 43 43 default int[] getSelectedIndices() { 44 return TableHelper.getSelectedIndices(getSelectionModel());44 return getSelectionModel().getSelectedIndices(); 45 45 } 46 46 -
trunk/src/org/openstreetmap/josm/gui/util/TableHelper.java
r17778 r19120 123 123 * Unfortunately this method is not available in OpenJDK before version 11, see 124 124 * https://bugs.openjdk.java.net/browse/JDK-8199395 125 * 125 * <p> 126 126 * To be removed when we switch to Java 11 or later. 127 127 * … … 132 132 * @see #selectedIndices(ListSelectionModel) 133 133 * @since 15226 134 * @deprecated Use {@link ListSelectionModel#getSelectedIndices()} instead 134 135 */ 136 @Deprecated(since = "19120") 135 137 public static int[] getSelectedIndices(ListSelectionModel selectionModel) { 136 return select edIndices(selectionModel).toArray();138 return selectionModel.getSelectedIndices(); 137 139 } 138 140 -
trunk/src/org/openstreetmap/josm/tools/PlatformHook.java
r19105 r19120 248 248 /** 249 249 * Returns extended modifier key used as the appropriate accelerator key for menu shortcuts. 250 * It is advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but:250 * It was advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but: 251 251 * <ul> 252 252 * <li>it returns KeyEvent.CTRL_MASK instead of KeyEvent.CTRL_DOWN_MASK. We used the extended … … 258 258 */ 259 259 default int getMenuShortcutKeyMaskEx() { 260 // To remove when switching to Java 10+, and use Toolkit.getMenuShortcutKeyMaskEx instead 260 if (!GraphicsEnvironment.isHeadless()) { 261 return Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(); 262 } 261 263 return InputEvent.CTRL_DOWN_MASK; 262 264 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r19103 r19120 104 104 return !("true".equals(getSystemProperty("apple.laf.useScreenMenuBar")) 105 105 && ("Aqua".equals(laf) || laf.contains("Mac"))); 106 }107 108 @Override109 public int getMenuShortcutKeyMaskEx() {110 return InputEvent.META_DOWN_MASK;111 106 } 112 107 -
trunk/src/org/openstreetmap/josm/tools/StreamUtils.java
r17333 r19120 68 68 */ 69 69 public static <T> Collector<T, ?, List<T>> toUnmodifiableList() { 70 // Java 10: use java.util.stream.Collectors.toUnmodifiableList 70 // Java 10: use java.util.stream.Collectors.toUnmodifiableList (note: does not like null checks OR null entries) 71 71 return Collectors.collectingAndThen(Collectors.toList(), Utils::toUnmodifiableList); 72 72 } -
trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergerTestFT.java
r17275 r19120 3 3 4 4 import java.awt.BorderLayout; 5 import java.util.stream.Collectors;6 import java.util.stream.IntStream;7 5 8 6 import javax.swing.JFrame; … … 24 22 n1.put("key" + i, "value" + i); 25 23 } 26 // Java 11: use String.repeat 27 String note = IntStream.range(0, 50).mapToObj(i -> " A very long text ").collect(Collectors.joining()); 24 String note = " A very long text ".repeat(50); 28 25 n1.put("note", note); 29 26 w1.addNode(new Node(2)); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java
r18853 r19120 14 14 import java.util.HashMap; 15 15 import java.util.Map; 16 import java.util.stream.Collectors;17 import java.util.stream.IntStream;18 16 19 17 import org.junit.jupiter.api.Test; … … 57 55 // Add a map with too long values => IllegalArgumentException 58 56 keys = new HashMap<>(); 59 // Java 11: use String.repeat 60 keys.put("test", IntStream.range(0, MAX_CHANGESET_TAG_LENGTH + 1).mapToObj(i -> "x").collect(Collectors.joining())); 57 keys.put("test", "x".repeat(MAX_CHANGESET_TAG_LENGTH + 1)); 61 58 try { 62 59 cs.setKeys(keys);
Note:
See TracChangeset
for help on using the changeset viewer.