@Override
  public IMouseStateChange mousePressed(final MouseEvent event, final AbstractZyGraph<?, ?> graph) {
    final double x = m_graph.getEditMode().translateX(event.getX());
    final double y = m_graph.getEditMode().translateY(event.getY());

    final HitInfo hitInfo = m_graph.getGraph().getHitInfo(x, y);

    if (hitInfo.hasHitNodes()) {
      throw new IllegalStateException();
    } else if (hitInfo.hasHitNodeLabels()) {
      throw new IllegalStateException();
    } else if (hitInfo.hasHitEdges()) {
      throw new IllegalStateException();
    } else if (hitInfo.hasHitEdgeLabels()) {
      final EdgeLabel label = hitInfo.getHitEdgeLabel();

      if (label == m_label) {
        // if (SwingUtilities.isLeftMouseButton(event))
        // {
        // return new CStateChange(m_factory.createEdgeLabelPressedLeftState(label, event), true);
        // }
        // else
        // {
        // return new CStateChange(m_factory.createEdgeLabelPressedRightState(label, event), true);
        // }
        return new CStateChange(this, true);
      } else {
        throw new IllegalStateException();
      }
    } else if (hitInfo.hasHitBends()) {
      throw new IllegalStateException();
    } else if (hitInfo.hasHitPorts()) {
      return new CStateChange(this, true);
    } else {
      m_factory.createEdgeLabelExitState(m_label, event);

      return new CStateChange(this, true);
    }
  }
Creates a new state object.

@param factory Used to create the next state when a state change is necessary.
@param graph The graph for which the mouse state is tracked.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/editmode/states/CEdgeLabelHoverState.java