List of usage examples for javax.swing.tree TreeSelectionModel isPathSelected
boolean isPathSelected(TreePath path);
path
, is in the current selection. From source file:com.mirth.connect.client.ui.DashboardPanel.java
/** * Shows the popup menu when the trigger button (right-click) has been pushed. Deselects the * rows if no row was selected.//ww w .jav a 2s. c om */ private void checkSelectionAndPopupMenu(MouseEvent event) { TreePath path = dashboardTable.getPathForLocation(event.getX(), event.getY()); /* * On mouse events we don't need to update the dashboard panel plugins. They will already * have been updated because of the ListSelectionEvent, and multiple mouse events will enter * here (as many as three, one pressed and two released) so we would basically be doing four * times the work. */ if (path == null) { deselectRows(false); } else { updatePopupMenu(false); } if (event.isPopupTrigger()) { TreeSelectionModel selectionModel = dashboardTable.getTreeSelectionModel(); if (!selectionModel.isPathSelected(path)) { deselectRows(false); selectionModel.addSelectionPath(path); } parent.dashboardPopupMenu.show(event.getComponent(), event.getX(), event.getY()); } }