public ClassSelectionForm(ClassBase godzClass) { InitializeComponent(); mClassType = godzClass; //initialize the tree with all subclasses of this type.... List <ClassBase> list = new List <ClassBase>(); mClassType.getSubClasses(list); //Add the class if its not abstract.... if (!godzClass.isAbstract()) { TreeNode n = new TreeNode(godzClass.ClassName); n.Tag = godzClass; treeView1.Nodes.Add(n); } foreach (ClassBase classRef in list) { TreeNode n = new TreeNode(classRef.ClassName); n.Tag = classRef; treeView1.Nodes.Add(n); } }
// PropertyArray list --> Add private void addToolStripMenuItem_Click(object sender, EventArgs e) { ClassBase godzClass = mValue.mPropertySelection.cp.mClassType; //check to see if there are any subclasses.... List <ClassBase> list = new List <ClassBase>(); godzClass.getSubClasses(list); ObjectBase newObj = null; if (list.Count == 0) { // Make sure its not abstract before we instance it.... // Otherwise, just do nothing if (!godzClass.isAbstract()) { newObj = godzClass.newInstance(); newObj.setPackage(mSelectedPackage); } } else { ClassSelectionForm form = new ClassSelectionForm(godzClass); if (form.ShowDialog() == DialogResult.OK) { newObj = form.mSelectedType.newInstance(); newObj.setPackage(mSelectedPackage); } } if (newObj != null) { PropertyArray vector = mValue.mPropertySelection.cp.mArray; PropertyObject po = new PropertyObject(newObj); vector.add(po); Editor.AddObjectReference(newObj.getPackage().GetName(), mValue.mPropertySelection.cp.mPropertyNameHash, newObj, mValue.mPropertySelection.obj); //Now add the node to the tree.... addSubObject(newObj, mValue.mPropertySelection.treeNode); } }