}
TreePath path = ((JTree) e.getSource()).getClosestPathForLocation(e.getX(), e.getY());
((TreeView) WorkspaceController.getCurrentModeExtension().getView()).addSelectionPath(path);
if (path != null) {
AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();
// encode buttons
int eventType = 0;
if (e.getButton() == MouseEvent.BUTTON1) {
eventType += WorkspaceActionEvent.MOUSE_LEFT;
}
if (e.getButton() == MouseEvent.BUTTON3) {
eventType += WorkspaceActionEvent.MOUSE_RIGHT;
}
if (e.getClickCount() % 2 == 0) {
eventType += WorkspaceActionEvent.MOUSE_DBLCLICK;
} else {
eventType += WorkspaceActionEvent.MOUSE_CLICK;
}
if (e.isPopupTrigger()) {
eventType += WorkspaceActionEvent.POPUP_TRIGGER;
}
WorkspaceActionEvent event = new WorkspaceActionEvent(node, eventType, e.getX(), e.getY(), e.getComponent());
List<IWorkspaceNodeActionListener> nodeEventListeners = WorkspaceController.getCurrentModeExtension().getIOController()
.getNodeActionListeners(node.getClass(), eventType);
if (nodeEventListeners != null) {
for (IWorkspaceNodeActionListener listener : nodeEventListeners) {
if (event.isConsumed()) {
break;
}