// 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); } }
private void addTemplateToolStripMenuItem_Click(object sender, EventArgs e) { // Ask the user to select the type of Template ClassBase godzClass = ClassBase.findClass("ObjectTemplate"); ClassSelectionForm form = new ClassSelectionForm(godzClass); if (form.ShowDialog() == DialogResult.OK) { //open up the template editor for this type... mTemplate = form.mSelectedType.newInstance(); mTemplate.setPackage(mSelectedPackage); //Assign this object a package... mTemplate.setPackage(mSelectedPackage); object proxy = Editor.GetNewObjectProxy(mTemplate); propertyGrid1.SelectedObject = proxy; AddTemplateToTree(mPackageNode, mTemplate); Editor.AddEntity(mSelectedPackage.GetName(), mTemplate); } }