private void duplicateTypeToolStripMenuItem_Click(object sender, EventArgs e) { try { if (treeViewTypes.SelectedNode != null) { ParserType type = treeViewTypes.SelectedNode.Tag as ParserType; if (type != null) { ParserType newType = type.Copy(); newType.Name = "Copy_" + newType.Name; _document.AddParserType(newType); treeViewTypes.SelectedNode = AddTreeNode(newType, true); } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, Properties.Resources.MessageBox_ErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error); } }