private EA.Element getEventElement(EA.Repository rep, EA.EventProperties e) { var value = e.Get(0).Value; int intElementId = Convert.ToInt32(value); return(rep.GetElementByID(intElementId)); }
public bool EA_OnPreNewElement(EA.Repository Repository, EA.EventProperties Info) { Boolean sdmModeling_preNewElement = sdmModeling.EA_OnPreNewElement(Repository, Info); Boolean tggModeling_preNewElement = tggModeling.EA_OnPreNewElement(Repository, Info); return(sdmModeling_preNewElement && tggModeling_preNewElement); }
public Boolean EA_OnPreNewConnector(EA.Repository repository, EA.EventProperties info) { if (info.Get("Stereotype").Value.Equals(SDMModelingMain.LinkVariableStereotype)) { EA.Element client = repository.GetElementByID(Int32.Parse(info.Get("ClientID").Value as String)); EA.Element supplier = repository.GetElementByID(Int32.Parse(info.Get("SupplierID").Value as String)); if (client != null && supplier != null) { List <SQLConnector> clientToSupplierAssociations = new List <SQLConnector>(); List <SQLConnector> supplierToClientAssociations = new List <SQLConnector>(); SQLRepository sqlRepository = new SQLRepository(repository, false); SQLElement clientClassifier = sqlRepository.GetElementByID(client.ClassfierID); SQLElement supplierClassifier = sqlRepository.GetElementByID(supplier.ClassfierID); LinkVariablePropertiesForm.collectPossibleAssociations(ref clientClassifier, ref supplierClassifier, ref clientToSupplierAssociations, ref supplierToClientAssociations, ref sqlRepository); if (clientToSupplierAssociations.Count == 0 && supplierToClientAssociations.Count == 0) { System.Windows.Forms.MessageBox.Show("There is no Association between these two elements"); return(false); } } else { return(false); } } return(true); }
private Boolean sendEvent(EA.Repository Repository, EA.EventProperties Info) { string str = JsonConvert.SerializeObject(Info); sendString(str); return(true); }
public Boolean EA_OnPostNewMethod(EA.Repository Repository, EA.EventProperties Info) { EA.Method method = Repository.GetMethodByID(int.Parse((string)Info.Get(0).Value)); consistencyModule.dispatchSingleObject(Repository, method.MethodGUID, method.ObjectType); incrementalUpdateAdapter.EA_OnPostNewMethod(Repository, Info); return(true); }
public bool EA_OnPreNewConnector(EA.Repository Repository, EA.EventProperties Info) { bool connectorAllowedByEcore = true; bool connectorAllowedBySDM = sdmModeling.EA_OnPreNewConnector(Repository, Info); bool connectorAllowedByTGG = tggModeling.EA_OnPreNewConnector(Repository, Info); return(connectorAllowedByEcore && connectorAllowedBySDM && connectorAllowedByTGG); }
public void EA_OnPostNewDiagramObject(EA.Repository Repository, EA.EventProperties Info) { EA.Diagram currentDiagram = Repository.GetCurrentDiagram(); Repository.SaveDiagram(currentDiagram.DiagramID); int objectID = int.Parse(Info.Get(0).Value.ToString()); // EA.Element newElement = Repository.GetElementByID(objectID); }
public bool EA_OnPreDeleteDiagramObject(EA.Repository Repository, EA.EventProperties Info) { EA.Element element = Repository.GetElementByID(int.Parse((string)Info.Get(0).Value)); this.deletedDiagramObjectGUIDQueue.Add(element.ElementGUID); this.deletedDiagramObjectsObjectTypesQueue.Add(element.ObjectType); return(true); }
public bool EA_OnPreDeleteElement(EA.Repository repository, EA.EventProperties info) { RepositoryChanged(repository); var elementId = info.ExtractElementId(); var deleteElement = Handle(OnDeleteEntity, () => eaRepository.Val.GetElementByID(elementId)); return(deleteElement.AsBool); }
public bool EA_OnPostNewConnector(EA.Repository repository, EA.EventProperties info) { RepositoryChanged(repository); var connectorId = info.ExtractConnectorId(); var entityModified = Handle(OnEntityCreated, () => eaRepository.Val.GetConnectorByID(connectorId)); return(entityModified.AsBool); }
public bool EA_OnPreDeleteConnector(EA.Repository repository, EA.EventProperties info) { RepositoryChanged(repository); var connectorId = info.ExtractConnectorId(); var deleteConnector = Handle(OnDeleteEntity, () => eaRepository.Val.GetConnectorByID(connectorId)); return(deleteConnector.AsBool); }
public bool EA_OnPreDeleteMethod(EA.Repository Repository, EA.EventProperties Info) { bool allowed = true; EA.Method meth = Repository.GetMethodByID(int.Parse((string)Info.Get(0).Value)); allowed = allowed && sdmModeling.EA_OnPreDeleteMethod(Repository, meth); allowed = allowed && tggModeling.EA_OnPreDeleteMethod(Repository, meth); incrementalUpdateAdapter.EA_OnPreDeleteMethod(Repository, Info); return(allowed); }
public bool EA_OnPostNewPackage(EA.Repository Repository, EA.EventProperties Info) { SQLRepository sqlRep = new SQLRepository(Repository, false); EA.Package package = Repository.GetPackageByID(int.Parse((string)Info.Get(0).Value)); if (package.IsModel) { EAEcoreAddin.Util.EAUtil.setTaggedValue(sqlRep, package, MetamodelHelper.MoflonExportTaggedValueName, Main.TrueValue); } incrementalUpdateAdapter.EA_OnPostNewPackage(Repository, Info); return(false); }
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); } } }
internal bool EA_OnPreDeletePackage(EA.Repository Repository, EA.EventProperties Info) { if (!initialConnectionAvailable) { return(true); } EA.Package package = Repository.GetPackageByID(int.Parse((string)Info.Get(0).Value)); DeleteElementChange change = new DeleteElementChange(); change.elementType = ElementType.PACKAGE; change.internalID = package.PackageGUID; change.name = package.Name; return(sendObject(change)); //return sendEvent(Repository, Info); }
internal bool EA_OnPostNewElement(EA.Repository Repository, EA.EventProperties Info) { if (!initialConnectionAvailable) { return(true); } EA.Element element = Repository.GetElementByID(int.Parse((string)Info.Get(0).Value)); CreateElementChange change = new CreateElementChange(); change.elementType = ElementType.ELEMENT; change.internalID = element.ElementGUID; change.name = element.Name; return(sendObject(change)); //return sendEvent(Repository, Info); }
internal bool EA_OnPostNewMethod(EA.Repository Repository, EA.EventProperties Info) { if (!initialConnectionAvailable) { return(true); } EA.Method method = Repository.GetMethodByID(int.Parse((string)Info.Get(0).Value)); CreateElementChange change = new CreateElementChange(); change.elementType = ElementType.METHOD; change.internalID = method.MethodGUID; change.name = method.Name; return(sendObject(change)); //return sendEvent(Repository, Info); }
internal bool EA_OnPostNewAttribute(EA.Repository Repository, EA.EventProperties Info) { if (!initialConnectionAvailable) { return(true); } EA.Attribute attribute = Repository.GetAttributeByID(int.Parse((string)Info.Get(0).Value)); CreateElementChange change = new CreateElementChange(); change.elementType = ElementType.PACKAGE; change.internalID = attribute.AttributeGUID; change.name = attribute.Name; return(sendObject(change)); //return sendEvent(Repository, Info); }
internal bool EA_OnPreDeleteConnector(EA.Repository Repository, EA.EventProperties Info) { if (!initialConnectionAvailable) { return(true); } EA.Connector connector = Repository.GetConnectorByID(int.Parse((string)Info.Get(0).Value)); DeleteElementChange change = new DeleteElementChange(); change.elementType = ElementType.CONNECTOR; change.internalID = connector.ConnectorGUID; change.name = connector.Name; return(sendObject(change)); //return sendEvent(Repository, Info); }
public void EA_OnPostNewDiagram(EA.Repository Repository, EA.EventProperties Info) { int diagramID = int.Parse(Info.Get(0).Value.ToString()); SQLRepository sqlRep = new SQLRepository(Repository, false); EA.Diagram diagram = Repository.GetDiagramByID(diagramID); String diagramMetatype = diagram.MetaType; if (TGGModelingMain.TggSchemaDiagramMetatype.Contains(diagram.MetaType)) { SQLPackage newTGGProject = sqlRep.GetPackageByID(diagram.PackageID); if (EAUtil.packageIsModel(newTGGProject, sqlRep) && newTGGProject.Diagrams.Count == 1 && newTGGProject.getRealPackage().StereotypeEx == "") { NewTGGProjectDialog tggDialog = new NewTGGProjectDialog(sqlRep, newTGGProject); tggDialog.ShowDialog(); } } }
public bool EA_OnPostNewConnector(EA.Repository Repository, EA.EventProperties Info) { preventCascade = true; SQLRepository sqlRepository = new SQLRepository(Repository, false); EA.Connector connector = Repository.GetConnectorByID(int.Parse((string)Info.Get(0).Value)); EA.Diagram currentDiagram = sqlRepository.GetCurrentDiagram(); sqlRepository.SaveDiagram(currentDiagram.DiagramID); bool modifiedBySDMModeling = sdmModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram); bool modifiedByTGGModeling = tggModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram); bool modifiedByECoreModeling = ecoreModeling.EA_OnPostNewConnector(sqlRepository, connector, currentDiagram); incrementalUpdateAdapter.EA_OnPostNewConnector(Repository, Info); preventCascade = false; return(modifiedBySDMModeling || modifiedByTGGModeling || modifiedByECoreModeling); }
public bool EA_OnPostNewElement(EA.Repository repository, EA.EventProperties info) { EA.Element element = this.getEventElement(repository, info); if ("Requirement" != element.Type) { return(false); } string strReplacement = this.getReplacement(element.FQStereotype); if ("" != strReplacement) { element.Name = element.Name.Replace("req-", strReplacement + "-"); element.Update(); } //true - there are changes, false - NO changes return("" != strReplacement); }
public void EA_OnPostNewDiagram(EA.Repository Repository, EA.EventProperties Info) { if (!preventCascade) { try { Repository.GetDiagramByID(int.Parse(Info.Get(0).Value.ToString())); } catch (System.Exception) { // Sometimes, the ID is not valid. Since it is not easily possible to check // whether a diagram ID is valid, we use try-catch here. return; } preventCascade = true; tggModeling.EA_OnPostNewDiagram(Repository, Info); ecoreModeling.EA_OnPostNewDiagram(Repository, Info); preventCascade = false; } }
/// <summary> /// EA_OnPostNewConnector notifies Add-Ins that a new ///connector has been created on a diagram.It enables Add-Ins ///to modify the connector upon creation. /// ///This event occurs after a user has dragged a new ///connector from the Toolbox or Resources window onto a ///diagram.The notification is provided immediately after the ///connector is added to the model. /// </summary> /// <param name="Repository">An EA.Repository object representing the currently open Enterprise Architect model.</param> /// <param name="EventProperties">Contains the following EventProperty objects for the new connector: /// ConnectorID: Along value corresponding to Connector. ConnectorID</param> /// <returns>Return True if the connector has been updated during this notification. Return False otherwise.</returns> public bool EA_OnPostNewConnector(EA.Repository Repository, EA.EventProperties EventProperties) { if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { try { EA.Connector conn = Repository.GetConnectorByID(int.Parse(EventProperties.Get("ConnectorID").Value)); if (goatAddinMainViewModel.EditAssociationCommand.CanExecute(conn)) { goatAddinMainViewModel.EditAssociationCommand.Execute(conn); return(goatAddinMainViewModel.EditAssociationCommand.Result); } } catch (Exception e) { MessageBox.Show(e.Message); } } return(false); }
public bool EA_OnPreNewConnector(EA.Repository Repository, EA.EventProperties Info) { String type = Info.Get("Type").Value.ToString(); String stereoType = Info.Get("Stereotype").Value.ToString(); EA.Diagram curDiag = Repository.GetCurrentDiagram(); int clientId = int.Parse(Info.Get("ClientID").Value.ToString()); int supplierId = int.Parse(Info.Get("SupplierID").Value.ToString()); if (TGGModelingMain.TggSchemaDiagramMetatype.Contains(curDiag.MetaType)) { if (type == "Dependency" && stereoType == "tggLink") { createTGGLink(Repository, Info, this); return(false); } else if (type == Main.EAAssociationType) { //EA.Element client = Repository.GetElementByID(clientId); EA.Element supplier = Repository.GetElementByID(supplierId); if (supplier.Stereotype == TGGModelingMain.TggCorrespondenceTypeStereotype) { return(false); } } } else if (TGGModelingMain.TggRuleDiagramMetatype.Contains(curDiag.MetaType)) { if (type == Main.EAAssociationType && stereoType == "tggCorrLink") { createCorrespondenceObjectWithLinks(Repository, Info); return(false); } } return(true); }
public bool EA_OnPostNewElement(EA.Repository Repository, EA.EventProperties Info) { EALastBroadcastMethodId = EAOnPostNewElement; preventCascade = true; SQLRepository sqlRepository = new SQLRepository(Repository, false); EA.Diagram currentDiagram = sqlRepository.GetCurrentDiagram(); sqlRepository.SaveDiagram(currentDiagram.DiagramID); EA.Element element = Repository.GetElementByID(int.Parse((string)Info.Get(0).Value)); Boolean sdmModeling_postNewElement = sdmModeling.EA_OnPostNewElement(sqlRepository, element, currentDiagram); Boolean tggModeling_postNewElement = tggModeling.EA_OnPostNewElement(sqlRepository, element, currentDiagram); Boolean ecorePost = ecoreModeling.EA_OnPostNewElement(sqlRepository, element, currentDiagram); consistencyModule.dispatchSingleObject(Repository, element.ElementGUID, element.ObjectType); preventCascade = false; incrementalUpdateAdapter.EA_OnPostNewElement(Repository, Info); return(true); }
public static string ExtractStereotype(this EA.EventProperties info) { return(info.Get("Stereotype").Value.ToString()); }
public bool EA_OnPreNewElement(EA.Repository repository, EA.EventProperties info) { RepositoryChanged(repository); return(true); }
public static int ExtractDiagramId(this EA.EventProperties info) { return(Int32.Parse(info.Get("DiagramId").Value.ToString())); }
public bool EA_OnPreNewElement(EA.Repository Repository, EA.EventProperties Info) { return(true); }