/**
   * @see
   *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#getReconnectSourceCommand(org.eclipse.gef.requests.ReconnectRequest)
   */
  protected Command getReconnectSourceCommand(ReconnectRequest request) {
    ConnectionEditPart connection = request.getConnectionEditPart();
    if (connection instanceof ComponentRealizationEditPart) {
      ComponentRealizationEditPart edit = (ComponentRealizationEditPart) connection;

      GraphElement newSource = (GraphElement) getHost().getModel();

      if (checkSource(newSource)) {
        ReconnectGraphEdgeCommand command =
            new ReconnectEdgeToSourceCommand(edit, "realizingClassifier") {
              protected EObject getObjectToUpdate() {
                return Utils.getElement(getEdge());
              }
            };
        command.setNewElement(newSource);
        return command;
      }
    }

    return null;
  }
  /**
   * @see
   *     org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy#getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest)
   */
  protected Command getReconnectTargetCommand(ReconnectRequest request) {
    ConnectionEditPart connection = request.getConnectionEditPart();
    if (connection instanceof ComponentRealizationEditPart) {
      ComponentRealizationEditPart edit = (ComponentRealizationEditPart) connection;

      GraphElement targetNode = (GraphElement) getHost().getModel();
      GraphElement sourceNode = (GraphElement) edit.getSource().getModel();

      if (targetNode != null
          && sourceNode != null
          && checkTargetForSource(sourceNode, targetNode)) {
        ReconnectGraphEdgeCommand command =
            new ReconnectTargetToEdgeCommand(edit, "realization") {
              protected EObject getObjectToUpdate() {
                return Utils.getElement(getEdge());
              }
            };
        command.setNewElement(targetNode);
        return command;
      }
    }

    return null;
  }