/// <summary> /// Adds the given constructors to the given type. /// </summary> /// <param name="type">The entity to add the constructors to.</param> /// <param name="constructors">A list of constructors to add.</param> private void AddConstructors(SingleInheritanceType type, IEnumerable <NRConstructor> constructors) { foreach (NRConstructor nrConstructor in constructors) { type.AddConstructor().InitFromString(nrConstructor.Declaration()); } }
/// <summary> /// Adds the given operators to the given type. /// </summary> /// <param name="type">The entity to add the operators to.</param> /// <param name="operators">A list of operators to add.</param> private void AddOperators(SingleInheritanceType type, IEnumerable <NROperator> operators) { foreach (NROperator nrOperator in operators) { type.AddMethod().InitFromString(nrOperator.Declaration()); } }
/// <summary> /// Adds the given fields to the given type. /// </summary> /// <param name="type">The entity to add the fields to.</param> /// <param name="fields">A list of fields to add.</param> private void AddFields(SingleInheritanceType type, IEnumerable <NRField> fields) { foreach (NRField nrField in fields) { type.AddField().InitFromString(nrField.Declaration()); } }
public DialogResult ShowDialog(SingleInheritanceType inheritedClass) { if (inheritedClass == null) { return(DialogResult.None); } OperationTree.Nodes.Clear(); AddOperations(inheritedClass, inheritedClass.Base); RemoveEmptyNodes(); return(ShowDialog()); }
private void toolOverrideList_Click(object sender, EventArgs e) { SingleInheritanceType type = shape.CompositeType as SingleInheritanceType; if (type != null) { using (OverrideDialog dialog = new OverrideDialog()) { if (dialog.ShowDialog(type) == DialogResult.OK) { foreach (Operation operation in dialog.GetSelectedOperations()) { type.Override(operation); } } } } }
private void toolOverrideList_Click(object sender, EventArgs e) { if (parent is SingleInheritanceType) { SingleInheritanceType derivedType = (SingleInheritanceType)parent; using (OverrideDialog dialog = new OverrideDialog()) { if (dialog.ShowDialog(derivedType) == DialogResult.OK) { foreach (Operation operation in dialog.GetSelectedOperations()) { Operation overridden = (derivedType).Override(operation); AddOperationToList(overridden); } OnContentsChanged(EventArgs.Empty); } } } }
private void AddOperations(SingleInheritanceType derivedClass, SingleInheritanceType baseClass) { if (derivedClass == null || baseClass == null) { return; } AddOperations(derivedClass, baseClass.Base); TreeNode node = CreateClassNode(baseClass.Name); foreach (Operation operation in baseClass.OverridableOperations) { if (derivedClass.GetDefinedOperation(operation) != null) { continue; } RemoveSimilarNode(operation); CreateOperationNode(node, operation); } }