Ejemplo n.º 1
0
        private static int markConnectorOnDiagram(SQLConnector connector, SQLRepository repository)
        {
            int count = 0;

            try
            {
                List <String> diagramIdsOfClient   = EAUtil.getDiagramIDsOfObject(repository.GetElementByID(connector.ClientID), repository);
                List <String> diagramIdsOfSupplier = EAUtil.getDiagramIDsOfObject(repository.GetElementByID(connector.SupplierID), repository);
                List <int>    diagramIds           = new List <int>();
                foreach (String clientDiagId in diagramIdsOfClient)
                {
                    foreach (String suppDiagId in diagramIdsOfSupplier)
                    {
                        if (clientDiagId != "" && suppDiagId != "")
                        {
                            if (clientDiagId == suppDiagId)
                            {
                                diagramIds.Add(int.Parse(clientDiagId));
                                count++;
                            }
                        }
                    }
                }
                if (diagramIds.Count == 0)
                {
                    return(0);
                }

                foreach (int diagramId in diagramIds)
                {
                    EA.Diagram     diagram       = repository.GetOriginalRepository().GetDiagramByID(diagramId);
                    EA.DiagramLink diagramObject = null;
                    foreach (EA.DiagramLink diagLink in diagram.DiagramLinks)
                    {
                        if (diagLink.ConnectorID == connector.ConnectorID && diagLink.IsHidden == false)
                        {
                            diagramObject = diagLink;
                        }
                    }
                    if (diagramObject != null)
                    {
                        repository.OpenDiagram(diagramObject.DiagramID);
                        repository.GetCurrentDiagram().SelectedConnector = connector.getRealConnector();
                        repository.SaveDiagram(diagramObject.DiagramID);
                        break;
                        //repository.ReloadDiagram(diagramObject.DiagramID);
                    }
                }
            }
            catch
            {
            }

            return(count);
        }
Ejemplo n.º 2
0
        public static void updateStereotypeEx(EA.Repository repository, String newStereo, String oldStereo)
        {
            String result = repository.SQLQuery("select ea_guid from t_object where Stereotype = '" + oldStereo + "'");

            foreach (String row in EAUtil.getXMLNodeContentFromSQLQueryString(result, "ea_guid"))
            {
                if (row != "")
                {
                    EA.Element element = repository.GetElementByGuid(row);
                    if (element != null)
                    {
                        element.StereotypeEx = newStereo;
                        element.Update();
                    }
                }
            }
        }