Ignore:
Timestamp:
2016-06-01T23:17:40+02:00 (3 years ago)
Author:
Don-vip
Message:

sonar - squid:S1854 - Dead stores should be removed

Location:
trunk/src/org/openstreetmap/josm/gui/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java

    r10021 r10308  
    3232/**
    3333 * Display and edit layer name and file path in a <code>JTable</code>.
    34  * 
     34 *
    3535 * Note: Do not use the same object both as <code>TableCellRenderer</code> and
    3636 * <code>TableCellEditor</code> - this can mess up the current editor component
     
    3939class LayerNameAndFilePathTableCell extends JPanel implements TableCellRenderer, TableCellEditor {
    4040    private static final Color colorError = new Color(255, 197, 197);
    41     private static final String separator = System.getProperty("file.separator");
    42     private static final String ellipsis = '…' + separator;
     41    private static final String ELLIPSIS = '…' + File.separator;
    4342
    4443    private final JLabel lblLayerName = new JLabel();
     
    151150     */
    152151    private String addLblFilename(SaveLayerInfo info) {
    153         String tooltip = "";
     152        String tooltip;
    154153        boolean error = false;
    155154        if (info.getFile() == null) {
     
    185184        while (t != null && !t.isEmpty()) {
    186185            int txtwidth = lblFilename.getFontMetrics(lblFilename.getFont()).stringWidth(t);
    187             if (txtwidth < lblFilename.getWidth() || t.lastIndexOf(separator) < ellipsis.length()) {
     186            if (txtwidth < lblFilename.getWidth() || t.lastIndexOf(File.separator) < ELLIPSIS.length()) {
    188187                break;
    189188            }
    190189            // remove ellipsis, if present
    191             t = hasEllipsis ? t.substring(ellipsis.length()) : t;
     190            t = hasEllipsis ? t.substring(ELLIPSIS.length()) : t;
    192191            // cut next block, and re-add ellipsis
    193             t = ellipsis + t.substring(t.indexOf(separator) + 1);
     192            t = ELLIPSIS + t.substring(t.indexOf(File.separator) + 1);
    194193            hasEllipsis = true;
    195194        }
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersTableColumnModel.java

    r9754 r10308  
    8383
    8484    protected void build() {
    85         TableColumn col = null;
    86 
    8785        // column 0 - layer name, save path editor
    8886        LayerNameAndFilePathTableCell lnfpRenderer = new LayerNameAndFilePathTableCell();
    8987        LayerNameAndFilePathTableCell lnfpEditor = new LayerNameAndFilePathTableCell();
    90         col = new TableColumn(0); // keep in sync with SaveLayersModel#columnFilename
     88        TableColumn col = new TableColumn(0); // keep in sync with SaveLayersModel#columnFilename
    9189        col.setHeaderValue(tr("Layer Name and File Path"));
    9290        col.setResizable(true);
Note: See TracChangeset for help on using the changeset viewer.