コード例 #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);
        }
コード例 #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);
                    }
                }
            }
        }