public static void editConnectionEditor(
      DiagramDesignerView view, GestureEvent motion, TouchGesture gesture) {
    DesignerVector newPoint = view.getDesignerPoint(motion.getPosition(), true);

    if (!gesture.contextExists(DoAddAndSelectConnectorEditorGestureAction.CONNECTOR_EDITOR)) {
      Log.i("DoEditConnectorEditorGestureAction", "context CONNECTOR_EDITOR does not exist");
      return;
    }

    DiagramDesignerConnectionEditor connectionEditor =
        (DiagramDesignerConnectionEditor)
            gesture.getContext(DoAddAndSelectConnectorEditorGestureAction.CONNECTOR_EDITOR);
    connectionEditor.addConnectorDragPoint(newPoint);

    List<HitDefinition> hitItems = view.hitTest(motion.getPosition());
    HitDefinition connectionPointHit = null;
    for (HitDefinition hitDefinition : hitItems) {
      if (hitDefinition.isOnConnectionPoint()) {
        connectionPointHit = hitDefinition;
      }
    }
    if (connectionPointHit != null) {
      if (connectionPointHit.connectionPoint.direction == Direction.In
          || connectionPointHit.connectionPoint.direction == Direction.InOut) {
        if (!gesture.contextExists(
            DoAddAndSelectConnectorEditorGestureAction.CONNECTOR_STARTITEM)) {
          Log.i("DoEditConnectorEditorGestureAction", "context CONNECTOR_STARTITEM does not exist");
        }
        Integer sourceNodeId = (Integer) gesture.getContext("CONNECTOR_STARTITEM");
        if (!gesture.contextExists(
            DoAddAndSelectConnectorEditorGestureAction.CONNECTOR_STARTCONNECTIONPOINT)) {
          Log.i(
              "DoEditConnectorEditorGestureAction",
              "context CONNECTOR_STARTCONNECTIONPOINT does not exist");
        }
        ConnectionPoint sourceConnectionPoint =
            (ConnectionPoint) gesture.getContext("CONNECTOR_STARTCONNECTIONPOINT");
        if (view.addingConnection(
            sourceNodeId,
            sourceConnectionPoint,
            connectionPointHit.nodeId,
            connectionPointHit.connectionPoint)) {
          connectionEditor.setCanConnect(
              DiagramDesignerConnectionEditor.CanConnectEnum.OnConnectorCanConnect);
        } else {
          connectionEditor.setCanConnect(
              DiagramDesignerConnectionEditor.CanConnectEnum.OnConnectorCanNotConnect);
        }
      } else {
        connectionEditor.setCanConnect(
            DiagramDesignerConnectionEditor.CanConnectEnum.OnConnectorCanNotConnect);
      }
    } else {
      connectionEditor.setCanConnect(DiagramDesignerConnectionEditor.CanConnectEnum.NotOnConnector);
    }
  }
  public static void createAndSaveConnectorEditor(
      DiagramDesignerView view, ScreenVector position, TouchGesture gesture) {
    List<HitDefinition> hitResult = view.hitTest(position);

    DiagramDesignerConnectionEditor connectionEditor =
        view.getConnectionEditor(hitResult.get(0).nodeId, hitResult.get(0).connectionPoint);

    gesture.addContext(CONNECTOR_STARTITEM, hitResult.get(0).nodeId);
    gesture.addContext(CONNECTOR_STARTCONNECTIONPOINT, hitResult.get(0).connectionPoint);
    gesture.addContext(CONNECTOR_EDITOR, connectionEditor);
  }