menu.add(menuItem);
menu.show((JComponent) e.getSource(), e.getX(), e.getY());
}
private void rightClickedOnDocumentPath(MouseEvent e, DefaultMutableTreeNode node, JPopupMenu menu) {
final DocumentPath documentPath = (DocumentPath) node.getUserObject();
Object parent = ((DefaultMutableTreeNode) node.getParent()).getUserObject();
if (parent instanceof LabelPath) {
final LabelPath labelPath = (LabelPath) parent;
JMenuItem menuItem = new JMenuItem("Remove label '" + labelPath.toString() + "' from this document");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
God.archive.db.removeLabelFromDocument(documentPath.getID(), labelPath.getID());
God.appWindow.refreshLabelList();
}
catch (SQLException exception) {
SwingUtils.showError(God.appWindow.frame, "Couldn't remove label from document!");
}