/// <summary> /// Generate an EA-Module into the defined package. It adds the EA Module reference if exists. /// - Component with Stereotype 'LE Modul' /// - <tbd>Tagged values are missing(ASIL level)</tbd> /// </summary> public void Generate(EA.Package pkg) { if (El == null) { // Create Module El = (EA.Element)pkg.Elements.AddNew(Name, "Component"); El.Stereotype = @"LE Modul"; El.Update(); pkg.Elements.Refresh(); } //------------------------------------------------------- // Create Ports var portNames = new List <string>(); foreach (var functionItem in RequiredFunctions) { var interfaceName = functionItem.Interface.Name; if (!portNames.Contains(interfaceName)) { portNames.Add(interfaceName); } } foreach (var functionItem in ProvidedFunctions) { var interfaceName = functionItem.Interface.Name; if (!portNames.Contains(interfaceName)) { portNames.Add(interfaceName); } } var existingPorts = EaElement.GetEmbeddedElements(El); // Create new ports var newPorts = from s in portNames where existingPorts.All(i => s != i.Name) select s; // Delete not used ports var deletePorts = from s in existingPorts where portNames.All(i => s.Name != i) orderby s.Pos descending select s; // delete not needed ports foreach (var deletePort in deletePorts) { El.EmbeddedElements.Delete(deletePort.Pos); } El.EmbeddedElements.Refresh(); // create new ports foreach (var portName in newPorts) { var newPort = (EA.Element)El.EmbeddedElements.AddNew(portName, "Port"); newPort.Name = portName; } }
public override void doEaGuiStuff() { EA.Element realelement = EaElement.getRealElement(); realelement.Visibility = "public"; if (realelement.Stereotype != ECOREModelingMain.EClassStereotype) { realelement.StereotypeEx = ECOREModelingMain.EClassStereotype; } realelement.Update(); if (Import.MainImport.ImportBusy) { foreach (EAttribute eAttr in this.EAttributes) { eAttr.updateEAGui(); } foreach (EOperation eOp in this.EOperations) { eOp.updateEAGui(); } } }