Left mouse click on a JGoPort

I’m trying to run an action on a left click on a node port. I derive my class from JGoPort and override the method doMouseClick to do it, but it seems I can only recieve the right click. How to get the left click ?

That’s because a left click is interpreted as a draw-a-new-link gesture, when it occurs on a port that is found by JGoView.pickPort and JGoView.startNewLink returns true. By default startNewLink starts drawing a new link if JGoView.validSourcePort or JGoView.validDestinationPort are true. These predicates will be false if JGoPort.isValidSource or JGoPort.isValidDestination are false, respectively.
But what do you really want to do when the user clicks on a port, if it isn’t starting to draw a new link?

A port is a point in the graph. In our application, we can activate a port to display the information at this point in another window. That is why we want to intercept a left click and not a left drag.

The easiest thing to do is to make each JGoPort Selectable and not a ValidSource or a ValidDestination, or to make each JGoPort Selectable and to override JGoView.pickPort to return false.