public override void doRuleQuickFix(SQLElement eaElement2, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage) { EA.Element eaElement = eaElement2.getRealElement(); i = 1; if (eaElement.Stereotype == ECOREModelingMain.EClassStereotype) { List <String> referenceNames = new List <string>(); foreach (EA.Connector con in eaElement.Connectors) { if (con.Type == ECOREModelingMain.EReferenceConnectorType) { EA.ConnectorEnd otherEnd = null; if (con.ClientID == eaElement.ElementID) { otherEnd = con.SupplierEnd; } else { otherEnd = con.ClientEnd; } if (otherEnd.Role != "") { if (referenceNames.Contains(otherEnd.Role)) { otherEnd.Role = otherEnd.Role + i++; otherEnd.Update(); } else { referenceNames.Add(otherEnd.Role); } } } con.Update(); } } EA.Diagram currentDiag = repository.GetCurrentDiagram(); if (currentDiag != null) { repository.SaveDiagram(currentDiag.DiagramID); repository.ReloadDiagram(currentDiag.DiagramID); } }
public override void doRuleQuickFix(SQLConnector eaObject, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage) { if (i == 0) { String sql = "select DiagramID from t_diagramlinks where ConnectorID = " + eaObject.ConnectorID; String result = repository.SQLQuery(sql); EA.Diagram diagram = repository.GetOriginalRepository().GetDiagramByID(int.Parse(EAUtil.getXMLNodeContentFromSQLQueryString(result, "DiagramID")[0])); foreach (EA.DiagramLink link in diagram.DiagramLinks) { if (link.ConnectorID == eaObject.ConnectorID) { link.IsHidden = false; link.Update(); } } repository.OpenDiagram(diagram.DiagramID); repository.ReloadDiagram(diagram.DiagramID); } }