@Override protected boolean popupDecision(MouseEvent e) { if (filesTable.getSelectedRowCount() == 0) return false; int[] indices = filesTable.getSelectedRows(); long size = 0; for (int i : indices) { size += fs.getEntryForRow(filesTable.convertRowIndexToModel(i)).getSize(); } info.setText(Util.niceSize(size) + " in " + indices.length + " items"); return true; }
@Override protected boolean popupDecision(MouseEvent e) { int count = browseTree.getSelectionCount(); if (count == 0) return false; boolean canRemoveSearches = false; long totalSize = 0; ListableEntry lastSelected = null; for (TreePath path : browseTree.getSelectionPaths()) { lastSelected = (ListableEntry) path.getLastPathComponent(); totalSize += lastSelected.getSize(); canRemoveSearches |= ((lastSelected instanceof FileSystemEntry) && ((FileSystemEntry) lastSelected).isSearch()); } removeSearch.setEnabled(canRemoveSearches); infoItem.setText( (count == 1 ? lastSelected.getName() : "Multiple items") + ": " + Util.niceSize(totalSize)); return true; }