Ignore:
Timestamp:
2016-11-29T02:22:12+01:00 (9 years ago)
Author:
Don-vip
Message:

findbugs - disable SE_TRANSIENT_FIELD_NOT_RESTORED, fix some SIC_INNER_SHOULD_BE_STATIC_ANON

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r11240 r11343  
    264264                }
    265265            });
    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());
    279267        }
    280268
     
    306294                Main.getLayerManager().getEditDataSet().setSelected(result.getNewSelection());
    307295            }
     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;
    308310        }
    309311    }
Note: See TracChangeset for help on using the changeset viewer.