// {{{ mousePressed() method @Override public void mousePressed(MouseEvent evt) { Point p = evt.getPoint(); if (evt.getSource() != table) { p.x -= table.getX(); p.y -= table.getY(); } int row = table.rowAtPoint(p); int column = table.columnAtPoint(p); if (column == 0 && row != -1) { VFSDirectoryEntryTableModel.Entry entry = (VFSDirectoryEntryTableModel.Entry) table.getModel().getValueAt(row, 0); if (FileCellRenderer.ExpansionToggleBorder.isExpansionToggle(entry.level, p.x)) { table.toggleExpanded(row); return; } } if (GUIUtilities.isMiddleButton(evt.getModifiers())) { if (row == -1) /* nothing */ ; else if (evt.isShiftDown()) table.getSelectionModel().addSelectionInterval(row, row); else table.getSelectionModel().setSelectionInterval(row, row); } else if (GUIUtilities.isPopupTrigger(evt)) { if (popup != null && popup.isVisible()) { popup.setVisible(false); popup = null; return; } if (row == -1) showFilePopup(null, table, evt.getPoint()); else { if (!table.getSelectionModel().isSelectedIndex(row)) table.getSelectionModel().setSelectionInterval(row, row); showFilePopup(getSelectedFiles(), table, evt.getPoint()); } } } // }}}
// {{{ mouseClicked() method @Override public void mouseClicked(MouseEvent evt) { Point p = evt.getPoint(); int row = table.rowAtPoint(p); int column = table.columnAtPoint(p); if (row == -1) return; if (column == 0) { VFSDirectoryEntryTableModel.Entry entry = (VFSDirectoryEntryTableModel.Entry) table.getModel().getValueAt(row, 0); if (FileCellRenderer.ExpansionToggleBorder.isExpansionToggle(entry.level, p.x)) { return; } } if ((evt.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && evt.getClickCount() % 2 == 0) { browser.filesActivated( evt.isShiftDown() ? VFSBrowser.M_OPEN_NEW_VIEW : VFSBrowser.M_OPEN, true); } else if (GUIUtilities.isMiddleButton(evt.getModifiers())) { if (evt.isShiftDown()) table.getSelectionModel().addSelectionInterval(row, row); else table.getSelectionModel().setSelectionInterval(row, row); browser.filesActivated( evt.isShiftDown() ? VFSBrowser.M_OPEN_NEW_VIEW : VFSBrowser.M_OPEN, true); } } // }}}