private void changeNodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currSelected == null)
            {
                return;
            }

            var node         = (ISymbolicExpressionTreeNode)currSelected.Content.Clone();
            var originalNode = currSelected.Content;

            ISymbolicExpressionTreeNode newNode = null;
            var result = DialogResult.Cancel;

            if (node is ConstantTreeNode)
            {
                using (var dialog = new ConstantNodeEditDialog(node)) {
                    dialog.ShowDialog(this);
                    newNode = dialog.NewNode;
                    result  = dialog.DialogResult;
                }
            }
            else if (node is VariableTreeNode)
            {
                using (var dialog = new VariableNodeEditDialog(node)) {
                    dialog.ShowDialog(this);
                    newNode = dialog.NewNode;
                    result  = dialog.DialogResult;
                }
            }
            if (result != DialogResult.OK)
            {
                return;
            }
            ModifyTree(Tree, originalNode.Parent, originalNode, newNode); // this will replace the original node with the new node
            currSelected = null;
        }
    private void changeNodeToolStripMenuItem_Click(object sender, EventArgs e) {
      if (currSelected == null) return;

      var node = (ISymbolicExpressionTreeNode)currSelected.Content.Clone();
      var originalNode = currSelected.Content;

      ISymbolicExpressionTreeNode newNode = null;
      var result = DialogResult.Cancel;
      if (node is ConstantTreeNode) {
        using (var dialog = new ConstantNodeEditDialog(node)) {
          dialog.ShowDialog(this);
          newNode = dialog.NewNode;
          result = dialog.DialogResult;
        }
      } else if (node is VariableTreeNode) {
        using (var dialog = new VariableNodeEditDialog(node)) {
          dialog.ShowDialog(this);
          newNode = dialog.NewNode;
          result = dialog.DialogResult;
        }
      }
      if (result != DialogResult.OK) return;
      ModifyTree(Tree, originalNode.Parent, originalNode, newNode); // this will replace the original node with the new node
      currSelected = null;
    }