public void Initialize(UmlClassifierSpec spec) { eaElement.Stereotype = spec.Stereotype; eaElement.Update(); if (spec.TaggedValues != null) { foreach (UmlTaggedValueSpec taggedValueSpec in spec.TaggedValues) { CreateTaggedValue(taggedValueSpec); } eaElement.TaggedValues.Refresh(); } if (spec.Attributes != null) { foreach (UmlAttributeSpec attributeSpec in spec.Attributes) { CreateAttribute(attributeSpec); } } if (spec is UmlEnumerationSpec) { var enumSpec = (UmlEnumerationSpec)spec; if (enumSpec.EnumerationLiterals != null) { foreach (UmlEnumerationLiteralSpec enumerationLiteralSpec in enumSpec.EnumerationLiterals) { CreateEnumerationLiteral(enumerationLiteralSpec); } } } eaElement.Attributes.Refresh(); if (spec.Associations != null) { foreach (UmlAssociationSpec associationSpec in spec.Associations) { CreateAssociation(associationSpec); } } if (spec.Dependencies != null) { foreach (UmlDependencySpec dependencySpec in spec.Dependencies) { CreateDependency(dependencySpec); } } eaElement.Connectors.Refresh(); }
private EaUmlClassifier CreateEaUmlClassifier(UmlClassifierSpec spec) { var eaElement = (Element)eaPackage.Elements.AddNew(spec.Name, "Class"); eaElement.PackageID = Id; var eaUmlClassifier = new EaUmlClassifier(eaRepository, eaElement); eaUmlClassifier.Initialize(spec); AddToClassDiagram(eaElement); eaPackage.Update(); eaPackage.Elements.Refresh(); return(eaUmlClassifier); }
public void Update(UmlClassifierSpec spec) { eaElement.Name = spec.Name; eaElement.Stereotype = spec.Stereotype; eaElement.Update(); foreach (UmlTaggedValueSpec taggedValueSpec in spec.TaggedValues) { IUmlTaggedValue taggedValue = GetTaggedValue(taggedValueSpec.Name); if (taggedValue.IsDefined) { taggedValue.Update(taggedValueSpec); } else { CreateTaggedValue(taggedValueSpec); } } eaElement.TaggedValues.Refresh(); for (var i = (short)(eaElement.Attributes.Count - 1); i >= 0; i--) { eaElement.Attributes.Delete(i); } eaElement.Attributes.Refresh(); if (spec.Attributes != null) { foreach (UmlAttributeSpec attributeSpec in spec.Attributes) { CreateAttribute(attributeSpec); } } if (spec is UmlEnumerationSpec) { var enumSpec = (UmlEnumerationSpec)spec; if (enumSpec.EnumerationLiterals != null) { foreach (UmlEnumerationLiteralSpec enumerationLiteralSpec in enumSpec.EnumerationLiterals) { CreateEnumerationLiteral(enumerationLiteralSpec); } } } eaElement.Attributes.Refresh(); for (var i = (short)(eaElement.Connectors.Count - 1); i >= 0; i--) { if (DeleteConnectorOnUpdate((Connector)eaElement.Connectors.GetAt(i))) { eaElement.Connectors.Delete(i); } } if (spec.Associations != null) { foreach (UmlAssociationSpec associationSpec in spec.Associations) { CreateAssociation(associationSpec); } } if (spec.Dependencies != null) { foreach (UmlDependencySpec dependencySpec in spec.Dependencies) { CreateDependency(dependencySpec); } } eaElement.Connectors.Refresh(); }
private static void UpdateEaUmlClassifier(EaUmlClassifier classifier, UmlClassifierSpec spec) { classifier.Update(spec); }