public static <EdgeType extends ZyGraphEdge<?, ?, ?>> void handleEdgeClicks(
      final AbstractZyGraph<?, ?> graph, final EdgeType edge, final MouseEvent event) {
    Preconditions.checkNotNull(graph, "Error: Graph argument can not be null");
    Preconditions.checkNotNull(edge, "Error: Edge argument can not be null");
    Preconditions.checkNotNull(event, "Error: Event argument can not be null");

    if ((event.getButton() == MouseEvent.BUTTON1) && event.isShiftDown()) {
      // Shift-Click => Select edge

      graph.getGraph().setSelected(edge.getEdge(), !edge.isSelected());
    } else if ((event.getButton() == MouseEvent.BUTTON1) && !event.isShiftDown()) {
      if (edge.getSource() != edge.getTarget()) {
        // When the user clicks on an edge, the graph scrolls to either
        // the source node or the target node of the edge, depending on
        // their distance from the visible part of the graph.

        final double x = graph.getView().toWorldCoordX(event.getX());
        final double y = graph.getView().toWorldCoordY(event.getY());

        zoomEdgeNode(graph, edge.getEdge(), x, y);
      }
    }
  }
Handles clicks on edges.

@param graph The graph the edge belongs to.
@param edge The edge that was clicked on.
@param event Description of the click event.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/editmode/helpers/CEdgeClickHandler.java