private void editNode(object sender, EventArgs e) { TreeNode selected = tree.SelectedNode; if (selected.Tag == null) { return; } if (selected.Tag is ControllerInterface) { ControllerInterface node = (ControllerInterface)selected.Tag; setCurrentEditor(node.createControl()); } }