/*
   * (non-Javadoc)
   *
   * @see org.eclipse.gef.commands.Command#undo()
   */
  @Override
  public void undo() {
    if (parentFormula instanceof UnaryFormula) {
      ((UnaryFormula) parentFormula).setChild(null);
    } else if (parentFormula instanceof BinaryFormula) {
      if (firstChild) {
        ((BinaryFormula) parentFormula).setLeft(null);
      } else {
        ((BinaryFormula) parentFormula).setRight(null);
      }
    }

    SendNotify.sendAddFormulaNotify(parentFormula, null);
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.gef.commands.Command#execute()
   */
  @Override
  public void execute() {
    if (toAdd instanceof NestedCondition) {
      final NestedCondition ac = (NestedCondition) toAdd;
      if (ac.getConclusion() == null) {
        final Graph graph = HenshinFactory.eINSTANCE.createGraph();
        graph.setName(ModelUtil.getDistinctNCName(premise));
        ac.setConclusion(graph);
      }
    }

    if (parentFormula instanceof UnaryFormula) {
      ((UnaryFormula) parentFormula).setChild(toAdd);
    } else if (parentFormula instanceof BinaryFormula) {
      if (firstChild) {
        ((BinaryFormula) parentFormula).setLeft(toAdd);
      } else {
        ((BinaryFormula) parentFormula).setRight(toAdd);
      }
    }

    SendNotify.sendAddFormulaNotify(parentFormula, toAdd);
  }