(MouseEvent e)
| 262 | if(e.isPopupTrigger()) { processMouseEvent(e); } |
| 263 | } |
| 264 | private void processMouseEvent(MouseEvent e) { |
| 265 | int row = docTable.rowAtPoint(e.getPoint()); |
| 266 | if(row == -1) { return; } |
| 267 | |
| 268 | if(e.isPopupTrigger()) { |
| 269 | // context menu |
| 270 | if(!docTable.isRowSelected(row)) { |
| 271 | // if right click outside the selection then reset selection |
| 272 | docTable.getSelectionModel().setSelectionInterval(row, row); |
| 273 | } |
| 274 | JPopupMenu popup = new XJPopupMenu(); |
| 275 | popup.add(openDocumentsAction); |
| 276 | popup.add(removeDocumentsAction); |
| 277 | popup.show(docTable, e.getPoint().x, e.getPoint().y); |
| 278 | |
| 279 | } else if(e.getID() == MouseEvent.MOUSE_CLICKED |
| 280 | && e.getClickCount() == 2) { |
| 281 | // open document on double-click |
| 282 | openDocumentsAction.actionPerformed(null); |
| 283 | } |
| 284 | } |
| 285 | }); |
| 286 | |
| 287 | // Enter key opens the selected documents |
no test coverage detected