Jface TreeViewer add right click menu, depending on clicked node
问题 There is a good thread on how to correctly hook up a right-click menu to a Jface TreeViewer depending on the selected item. I would like to show the right click menu depending on: if the right-click was on a node or into "empty space". The problem is that TreeViewer does not automatically clear the selection if you click into empty space. Is there any clean way how to achieve this? My current approach would be to simply hook up a MouseListener to the tree with the following mouseDown method: