public DialogResult ShowDialog(SingleInharitanceType inheritedClass) { if (inheritedClass == null) return DialogResult.None; OperationTree.Nodes.Clear(); AddOperations(inheritedClass, inheritedClass.Base); RemoveEmptyNodes(); return ShowDialog(); }
private void AddOperations(SingleInharitanceType derivedClass, SingleInharitanceType 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); } }
/// <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(SingleInharitanceType 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(SingleInharitanceType 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(SingleInharitanceType type, IEnumerable<NRField> fields) { foreach (NRField nrField in fields) { type.AddField().InitFromString(nrField.Declaration()); } }