Changeset 8600 in josm for trunk/src/org


Ignore:
Timestamp:
2015-07-13T20:56:12+02:00 (5 years ago)
Author:
wiktorn
Message:
  • fix sonar issues
  • implement cache clear for "clear" button

Closes: #11327

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheContentsPanel.java

    r8598 r8600  
    5656
    5757    private static class ButtonColumn extends AbstractCellEditor implements TableCellRenderer, TableCellEditor, ActionListener {
    58         private Action action;
    59         private JButton renderButton;
    60 
    61         public ButtonColumn(Action action) {
     58        private final Action action;
     59        private final JButton renderButton;
     60
     61        private ButtonColumn(Action action) {
    6262            this.action = action;
    6363            renderButton = new JButton();
     
    109109    }
    110110
    111     private ExecutorService executor = Executors.newSingleThreadExecutor();
     111    private transient ExecutorService executor = Executors.newSingleThreadExecutor();
    112112
    113113    /**
     
    141141                new JScrollPane(getTableForCache(cache)),
    142142                GBC.eol().fill(GBC.BOTH));
     143
     144        executor.shutdown();
    143145    }
    144146
     
    156158            }
    157159        }
    158         return new Long(-1);
    159     }
    160 
    161     private Map<String, Integer> getCacheStats(CacheAccess<String, BufferedImageCacheEntry> cache) {
     160        return Long.valueOf(-1);
     161    }
     162
     163    private static Map<String, Integer> getCacheStats(CacheAccess<String, BufferedImageCacheEntry> cache) {
    162164        Set<String> keySet = cache.getCacheControl().getKeySet();
    163165        Map<String, int[]> temp = new ConcurrentHashMap<>(); // use int[] as a Object reference to int, gives better performance
     
    213215    }
    214216
    215     private JTable getTableForCache(CacheAccess<String, BufferedImageCacheEntry> cache) {
     217    private JTable getTableForCache(final CacheAccess<String, BufferedImageCacheEntry> cache) {
    216218        final DefaultTableModel tableModel = new DefaultTableModel(
    217219                new String[][]{{tr("Loading data"), tr("Please wait"), ""}},
     
    233235                        int row = ret.convertRowIndexToModel(ret.getEditingRow());
    234236                        tableModel.setValueAt("0", row, 1);
     237                        cache.remove(ret.getValueAt(row, 0) + ":");
    235238                    }
    236239                });
Note: See TracChangeset for help on using the changeset viewer.