public void EA_OnPostNewDiagram(EA.Repository Repository, EA.EventProperties Info) { SQLRepository sqlRep = new SQLRepository(Repository, false); EA.Diagram diagram = Repository.GetDiagramByID(int.Parse((string)Info.Get(0).Value)); if (ECOREModelingMain.EcoreDiagramMetatype.Contains(diagram.MetaType)) { EA.Package package = Repository.GetPackageByID(diagram.PackageID); if (package.Diagrams.Count == 1 && (package.StereotypeEx == "" || package.StereotypeEx == "EPackage")) { EPackage epackage = new EPackage(sqlRep.GetPackageByID(package.PackageID), sqlRep); epackage.saveTreeToEATaggedValue(true); } } }
private void updateMocaTreeFragments() { // For all packages (recursively!) in TGG and Ecore projects foreach (EA.Package p in EAUtil.findAllMoflonPackages(repository)) { SQLPackage p2 = sqlRep.GetPackageByID(p.PackageID); if (p.Element.Stereotype == TGGModelingMain.TggSchemaPackageStereotype) { TGG tgg = new TGG(sqlRep, p2); tgg.loadTreeFromTaggedValue(); tgg.saveTreeToEATaggedValue(false); } else if (p.Element.Stereotype == TGGModelingMain.TggRulePackageStereotype) { TGGRulePackage package = new TGGRulePackage(p2, sqlRep); package.loadTreeFromTaggedValue(); package.saveTreeToEATaggedValue(false); } else { EPackage package = new EPackage(p2, sqlRep); package.loadTreeFromTaggedValue(); package.saveTreeToEATaggedValue(false); } } foreach (EA.Element eClassElement in EAUtil.findAllEClasses(repository)) { EClass eClass = new EClass(sqlRep.GetElementByID(eClassElement.ElementID), sqlRep); eClass.saveTreeToEATaggedValue(false); } foreach (EA.Element ruleElement in EAUtil.findAllStereotypedElements(repository, TGGModelingMain.TggRuleStereotype)) { TGGRule rule = new TGGRule(sqlRep, sqlRep.GetElementByID(ruleElement.ElementID)); rule.loadTreeFromTaggedValue(); rule.saveTreeToEATaggedValue(false); } foreach (EA.Element corrTypeElement in EAUtil.findAllStereotypedElements(repository, TGGModelingMain.TggCorrespondenceTypeStereotype)) { TGGCorrespondenceType corrType = new TGGCorrespondenceType(sqlRep.GetElementByID(corrTypeElement.ElementID), sqlRep); corrType.loadTreeFromTaggedValue(); corrType.saveTreeToEATaggedValue(false); } }
internal override void saveConstraintContainer() { package.saveTreeToEATaggedValue(true); }