Changeset 11343 in josm for trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
- Timestamp:
- 2016-11-29T02:22:12+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r11240 r11343 264 264 } 265 265 }); 266 list.setCellRenderer(new DefaultListCellRenderer() { 267 @Override 268 public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 269 final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 270 final String name = DefaultNameFormatter.getInstance().format((Way) value); 271 // get rid of id from DefaultNameFormatter.decorateNameWithId() 272 final String nameWithoutId = name 273 .replace(tr(" [id: {0}]", ((Way) value).getId()), "") 274 .replace(tr(" [id: {0}]", ((Way) value).getUniqueId()), ""); 275 ((JLabel) c).setText(tr("Segment {0}: {1}", index + 1, nameWithoutId)); 276 return c; 277 } 278 }); 266 list.setCellRenderer(new SegmentListCellRenderer()); 279 267 } 280 268 … … 306 294 Main.getLayerManager().getEditDataSet().setSelected(result.getNewSelection()); 307 295 } 296 } 297 } 298 299 static class SegmentListCellRenderer extends DefaultListCellRenderer { 300 @Override 301 public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 302 final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 303 final String name = DefaultNameFormatter.getInstance().format((Way) value); 304 // get rid of id from DefaultNameFormatter.decorateNameWithId() 305 final String nameWithoutId = name 306 .replace(tr(" [id: {0}]", ((Way) value).getId()), "") 307 .replace(tr(" [id: {0}]", ((Way) value).getUniqueId()), ""); 308 ((JLabel) c).setText(tr("Segment {0}: {1}", index + 1, nameWithoutId)); 309 return c; 308 310 } 309 311 }
Note:
See TracChangeset
for help on using the changeset viewer.
