Beispiel #1
0
        public bool EA_OnPostNewElement(SQLRepository sqlRepository, EA.Element newElement2, EA.Diagram currentDiagram)
        {
            SQLElement newElement = sqlRepository.GetElementByID(newElement2.ElementID);

            if (ECOREModelingMain.EcoreDiagramMetatype.Contains(currentDiagram.MetaType) || TGGModelingMain.TggSchemaDiagramMetatype.Contains(currentDiagram.MetaType))
            {
                if (newElement.Stereotype.ToLower() == EClassStereotype.ToLower())
                {
                    EClass eClass = new EClass(newElement, sqlRepository);
                    eClass.saveTreeToEATaggedValue(false);
                    return(true);
                }
                else if (newElement.Stereotype.ToLower() == EDatatypeStereotype.ToLower())
                {
                    EDatatype eDataType = new EDatatype(newElement, sqlRepository);
                    eDataType.saveTreeToEATaggedValue(false);
                    return(true);
                }
                else if (newElement.Stereotype.ToLower() == EEnumStereotype.ToLower())
                {
                    EEnum eEnum = new EEnum(newElement, sqlRepository);
                    eEnum.saveTreeToEATaggedValue(false);
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
        public void EA_OnNotifyContextItemModified(EA.Repository Repository, String GUID, EA.ObjectType ot)
        {
            SQLRepository sqlRepository = new SQLRepository(Repository, false);

            if (ot == EA.ObjectType.otPackage)
            {
                EA.Package eaPackage = Repository.GetPackageByGuid(GUID);
                if (eaPackage.Element.Stereotype.ToLower() == ECOREModelingMain.EPackageStereotype.ToLower())
                {
                    EPackage ePackage = new EPackage(sqlRepository.GetPackageByID(eaPackage.PackageID), sqlRepository);
                    Main.addToTreeQueue(GUID, ePackage);
                }

                // track changes for metamodelevolution
                savePackageChangesToEATaggedValue(sqlRepository, GUID);
            }
            if (ot == EA.ObjectType.otElement)
            {
                SQLElement eaElement = sqlRepository.GetElementByGuid(GUID);

                if (eaElement.Stereotype.ToLower() == EClassStereotype.ToLower() && eaElement.Type == Main.EAClassType)
                {
                    EClass eClass = new EClass(eaElement, sqlRepository);
                    eClass.saveTreeToEATaggedValue(false);

                    // track changes for metamodelevolution
                    saveElementChangesToEATaggedValue(eaElement, GUID, sqlRepository);
                }
                else if (eaElement.Stereotype.ToLower() == EDatatypeStereotype.ToLower())
                {
                    EDatatype eDataType = new EDatatype(eaElement, sqlRepository);
                    eDataType.saveTreeToEATaggedValue(false);
                }
                else if (eaElement.Stereotype.ToLower() == EEnumStereotype.ToLower())
                {
                    EEnum eEnum = new EEnum(eaElement, sqlRepository);
                    eEnum.saveTreeToEATaggedValue(false);
                }
            }

            if (ot == EA.ObjectType.otConnector)
            {
                SQLConnector eaConnector = sqlRepository.GetConnectorByGuid(GUID);
                if (eaConnector.Type == EReferenceConnectorType && (eaConnector.Stereotype == "" || eaConnector.Stereotype.ToLower() == "ereference"))
                {
                    EReference clientReference = new EReference(eaConnector, sqlRepository);
                    clientReference.saveTreeToEATaggedValue(false);
                }
                else if (eaConnector.Type == InheritanceConnectorType)
                {
                    SQLElement connectorSource = sqlRepository.GetElementByID(eaConnector.ClientID);
                    if (connectorSource.Stereotype == EClassStereotype)
                    {
                        EClass eClass = new EClass(connectorSource, sqlRepository);
                        eClass.saveTreeToEATaggedValue(false);
                    }
                }
            }
        }
        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);
            }
        }
        public override void doRuleQuickFix(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository, int i, String errorMessage)
        {
            if (i == 0)
            {
                if (eaElement.Stereotype == ECOREModelingMain.EClassStereotype)
                {
                    EClass eclass = new EClass(eaElement, repository);
                    eclass.saveTreeToEATaggedValue(true);
                }

                else if (eaElement.Stereotype == SDMModelingMain.StartNodeStereotype || eaElement.Stereotype == SDMModelingMain.StopNodeStereotype ||
                         eaElement.Stereotype == SDMModelingMain.StoryNodeStereotype || eaElement.Stereotype == SDMModelingMain.StatementNodeStereotype)
                {
                    ActivityNode aNode = SDMUtil.createCorrectActivityNode(repository, eaElement);
                    aNode.loadTreeFromTaggedValue();
                    aNode.saveTreeToEATaggedValue(true);
                }
            }
        }