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); }
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 ConvertEnum(MetaNamespaceBuilder parentNs, EEnum eenm) { var menm = _factory.MetaEnum(); menm.Name = eenm.Name.ToPascalCase(); parentNs.Declarations.Add(menm); _map.Add(eenm, menm); foreach (var elit in eenm.ELiterals) { var mlit = _factory.MetaEnumLiteral(); mlit.Name = elit.Name.ToPascalCase(); menm.EnumLiterals.Add(mlit); _map.Add(elit, mlit); } }
private void importEEnum(SQLPackage parentPackage, MocaNode eEnumNode) { EA.Element eenumElement = getOrCreateElement(parentPackage, eEnumNode, "Enumeration"); foreach (MocaNode literalNode in eEnumNode.getChildNodeWithName("literals").Children) { String literalName = literalNode.getAttributeOrCreate("name").Value; if (literalName != "" && !literalExist(eenumElement, literalName)) { EA.Attribute literalAtt = eenumElement.Attributes.AddNew(literalName, "") as EA.Attribute; literalAtt.Update(); } } eenumElement.Attributes.Refresh(); EEnum eenum = new EEnum(sqlRep.GetElementByID(eenumElement.ElementID), sqlRep); eenum.deserializeFromMocaTree(eEnumNode); MainImport.getInstance().ElementGuidToElement.Add(eenumElement.ElementGUID, eenumElement); MainImport.getInstance().MocaTaggableElements.Add(eenum); MainImport.getInstance().OldGuidToNewGuid.Add(eenum.Guid, eenumElement.ElementGUID); }
public bool validateEEnum(EEnum obj, DiagnosticChain diagnostics, Dictionary <object, object> context) { if (!validate_NoCircularContainment(obj, diagnostics, context)) { return(false); } bool result = validate_EveryMultiplicityConforms(obj, diagnostics, context); if (result || diagnostics != null) { result &= validate_EveryDataValueConforms(obj, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryReferenceIsContained(obj, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryBidirectionalReferenceIsPaired(obj, diagnostics, context); } //if (result || diagnostics != null) result &= validate_EveryProxyResolves(obj, diagnostics, context); if (result || diagnostics != null) { result &= validate_UniqueID(obj, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryKeyUnique(obj, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryMapEntryUnique(obj, diagnostics, context); } return(result); }
protected EEnum initEEnum(EEnum e, Type instanceClass, string name) { initEClassifier(e, ecorePackage.getEEnum(), instanceClass, name, true); return(e); }
public NotificationChain basicSetEEnum(EEnum newobj, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newobj, EcorePackageImpl.EENUMLITERAL_EENUM, msgs); return(msgs); }
public virtual T caseEEnum(EEnum theEObject) { return(default(T)); }