当前位置: 首页>>代码示例>>C#>>正文


C# Repository.GetContextItemType方法代码示例

本文整理汇总了C#中Repository.GetContextItemType方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.GetContextItemType方法的具体用法?C# Repository.GetContextItemType怎么用?C# Repository.GetContextItemType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


在下文中一共展示了Repository.GetContextItemType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetParentPackageIdFromContextElement

        /// <summary>
        /// Get containing Package ID from context element of Package, Element, Diagram, Attribute, Operation
        /// </summary>
        /// <param name="rep"></param>
        /// <returns></returns>
        static int GetParentPackageIdFromContextElement(Repository rep)
        {
            ObjectType objectType = rep.GetContextItemType();
            int id = 0;
            switch (objectType)
            {
                case ObjectType.otDiagram:
                    Diagram dia = (Diagram)rep.GetContextObject();
                    id = dia.PackageID;
                    break;
                case ObjectType.otElement:
                    EA.Element el = (EA.Element)rep.GetContextObject();
                    id = el.PackageID;
                    break;
                case ObjectType.otPackage:
                    EA.Package pkg = (EA.Package)rep.GetContextObject();
                    id = pkg.PackageID;
                    break;
                case ObjectType.otAttribute:
                    EA.Attribute attr = (EA.Attribute)rep.GetContextObject();
                    EA.Element elOfAttr = rep.GetElementByID(attr.ParentID);
                    id = elOfAttr.PackageID;
                    break;
                case ObjectType.otMethod:
                    Method meth = (Method)rep.GetContextObject();
                    EA.Element elOfMeth = rep.GetElementByID(meth.ParentID);
                    id = elOfMeth.PackageID;
                    break;
            }

            return id;
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:37,代码来源:SqlTemplates.cs

示例2: ShowSpecification

 public static void ShowSpecification(Repository rep)
 {
     ObjectType oType = rep.GetContextItemType();
     if (oType.Equals(ObjectType.otElement))
     {
         var el = (Element) rep.GetContextObject();
         //over all file
         foreach (File f in el.Files)
         {
             if (f.Name.Length > 2)
             {
                 Process.Start(f.Name);
             }
         }
     }
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:16,代码来源:EaServices.cs

示例3: AddDiagramNote

        public static void AddDiagramNote(Repository rep)
        {
            ObjectType oType = rep.GetContextItemType();
            if (oType.Equals(ObjectType.otDiagram))
            {
                Diagram dia = rep.GetCurrentDiagram();
                if (dia == null) return;
                Package pkg = rep.GetPackageByID(dia.PackageID);
                if (pkg.IsProtected || dia.IsLocked) return;

                // save diagram
                rep.SaveDiagram(dia.DiagramID);

                Element elNote;
                try
                {
                    elNote = (Element) pkg.Elements.AddNew("", "Note");
                    elNote.Update();
                    pkg.Update();
                }
                catch
                {
                    return;
                }

                // add element to diagram
                // "l=200;r=400;t=200;b=600;"

                // get the position of the Element

                int left = (dia.cx/2) - 100;
                int right = left + 200;
                int top = dia.cy - 150;
                int bottom = top + 120;
                //int right = diaObj.right + 2 * (diaObj.right - diaObj.left);

                string position = "l=" + left + ";r=" + right + ";t=" + top + ";b=" + bottom + ";";

                var diaObject = (DiagramObject) dia.DiagramObjects.AddNew(position, "");
                dia.Update();
                diaObject.ElementID = elNote.ElementID;
                diaObject.Update();
                pkg.Elements.Refresh();

                Util.SetDiagramHasAttchaedLink(rep, elNote);
                rep.ReloadDiagram(dia.DiagramID);
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:48,代码来源:EaServices.cs

示例4: ShowFolder

        public static void ShowFolder(Repository rep, bool isTotalCommander = false)
        {
            string path;
            ObjectType oType = rep.GetContextItemType();
            switch (oType)
            {
                case ObjectType.otPackage:
                    var pkg = (Package) rep.GetContextObject();
                    path = Util.GetVccFilePath(rep, pkg);
                    // remove filename
                    path = Regex.Replace(path, @"[a-zA-Z0-9\s_:.]*\.xml", "");

                    if (isTotalCommander)
                        Util.StartApp(@"totalcmd.exe", "/o " + path);
                    else
                        Util.StartApp(@"Explorer.exe", "/e, " + path);
                    break;

                case ObjectType.otElement:
                    var el = (Element) rep.GetContextObject();
                    path = Util.GetGenFilePath(rep, el);
                    // remove filename
                    path = Regex.Replace(path, @"[a-zA-Z0-9\s_:.]*\.[a-zA-Z0-9]{0,4}$", "");

                    if (isTotalCommander)
                        Util.StartApp(@"totalcmd.exe", "/o " + path);
                    else
                        Util.StartApp(@"Explorer.exe", "/e, " + path);

                    break;
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:32,代码来源:EaServices.cs

示例5: NavigateComposite

        public static void NavigateComposite(Repository repository)
        {
            ObjectType oType = repository.GetContextItemType();
            // find composite element of diagram
            if (oType.Equals(ObjectType.otDiagram))
            {
                var d = (Diagram) repository.GetContextObject();
                string guid = Util.GetElementFromCompositeDiagram(repository, d.DiagramGUID);
                if (guid != "")
                {
                    repository.ShowInProjectView(repository.GetElementByGuid(guid));
                }
            }
            // find composite diagram of element of element
            if (oType.Equals(ObjectType.otElement))
            {
                var e = (Element) repository.GetContextObject();
                // locate text or frame
                if (LocateTextOrFrame(repository, e)) return;

                repository.ShowInProjectView(e.CompositeDiagram);
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:23,代码来源:EaServices.cs

示例6: GetContextPackage

        //--------------------------------------------------------------------------------
        /// <summary>
        /// Get context Package from Package, Element, Diagram
        /// </summary>
        /// <param name="rep"></param>
        /// <returns></returns>
        static Package GetContextPackage(Repository rep)
        {
            switch (rep.GetContextItemType())
            {
                case ObjectType.otPackage:
                    return (Package) rep.GetContextObject();

                case ObjectType.otElement:
                    Element el = (Element) rep.GetContextObject();
                    return rep.GetPackageByID(el.PackageID);

                case ObjectType.otDiagram:
                    Diagram dia = (Diagram) rep.GetContextObject();
                    return rep.GetPackageByID(dia.PackageID);

                default:
                    return null;
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:25,代码来源:EaServices.cs

示例7: GetGuidfromSelectedItem

 private static string GetGuidfromSelectedItem(Repository rep)
 {
     ObjectType objectType = rep.GetContextItemType();
     string guid = "";
     switch (objectType)
     {
         case ObjectType.otAttribute:
             var a = (EA.Attribute) rep.GetContextObject();
             guid = a.AttributeGUID;
             break;
         case ObjectType.otMethod:
             var m = (Method) rep.GetContextObject();
             guid = m.MethodGUID;
             break;
         case ObjectType.otElement:
             var el = (Element) rep.GetContextObject();
             guid = el.ElementGUID;
             break;
         case ObjectType.otDiagram:
             var dia = (Diagram) rep.GetContextObject();
             guid = dia.DiagramGUID;
             break;
         case ObjectType.otPackage:
             var pkg = (Package) rep.GetContextObject();
             guid = pkg.PackageGUID;
             break;
         default:
             MessageBox.Show(@"Nothing useful selected");
             break;
     }
     return guid;
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:32,代码来源:EaServices.cs

示例8: GetVcLatestRecursive

        public static void GetVcLatestRecursive(Repository rep)
        {
            ObjectType oType = rep.GetContextItemType();
            if (oType.Equals(ObjectType.otPackage) || oType.Equals(ObjectType.otNone))
            {
                // start preparation
                int count = 0;
                int errorCount = 0;
                DateTime startTime = DateTime.Now;

                rep.CreateOutputTab("Debug");
                rep.EnsureOutputVisible("Debug");
                rep.WriteOutput("Debug", "Start GetLatestRecursive", 0);
                var pkg = (Package) rep.GetContextObject();
                Util.GetLatest(rep, pkg, true, ref count, 0, ref errorCount);
                string s = "";
                if (errorCount > 0) s = " with " + errorCount + " errors";

                // finished
                TimeSpan span = DateTime.Now - startTime;
                rep.WriteOutput("Debug", "End GetLatestRecursive in " + span.Hours + ":" + span.Minutes + " hh:mm. " + s,
                    0);
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:24,代码来源:EaServices.cs

示例9: CopyGuidSqlToClipboard

        public static void CopyGuidSqlToClipboard(Repository rep)
        {
            string str = @"";
            string str1;
            ObjectType oType = rep.GetContextItemType();
            Diagram diaCurrent = rep.GetCurrentDiagram();
            Connector conCurrent = null;

            if (diaCurrent != null)
            {
                conCurrent = diaCurrent.SelectedConnector;
            }

            if (conCurrent != null)
            {
// Connector 
                Connector con = conCurrent;
                str = con.ConnectorGUID + " " + con.Name + ' ' + con.Type + "\r\n" +
                      "\r\n Connector: Select ea_guid As CLASSGUID, connector_type As CLASSTYPE,* from t_connector con where ea_guid = '" +
                      con.ConnectorGUID + "'" +
                      "\r\n\r\nSelect o.ea_guid As CLASSGUID, o.object_type As CLASSTYPE,o.name As Name, o.object_type AS ObjectType, o.PDATA1, o.Stereotype, " +
                      "\r\n                       con.Name, con.connector_type, con.Stereotype, con.ea_guid As ConnectorGUID, dia.Name As DiagrammName, dia.ea_GUID As DiagramGUID," +
                      "\r\n                       o.ea_guid, o.Classifier_GUID,o.Classifier " +
                      "\r\nfrom (((t_connector con INNER JOIN t_object o              on con.start_object_id   = o.object_id) " +
                      "\r\nINNER JOIN t_diagramlinks diaLink  on con.connector_id      = diaLink.connectorid ) " +
                      "\r\nINNER JOIN t_diagram dia           on diaLink.DiagramId     = dia.Diagram_ID) " +
                      "\r\nINNER JOIN t_diagramobjects diaObj on diaObj.diagram_ID     = dia.Diagram_ID and o.object_id = diaObj.object_id " +
                      "\r\nwhere         con.ea_guid = '" + con.ConnectorGUID + "' " +
                      "\r\nAND dialink.Hidden  = 0 ";
                Clipboard.SetText(str);
                return;
            }
            if (oType.Equals(ObjectType.otElement))
            {
// Element 
                var el = (Element) rep.GetContextObject();
                string pdata1 = el.MiscData[0];
                string pdata1String;
                if (pdata1.EndsWith("}", StringComparison.Ordinal))
                {
                    pdata1String = "/" + pdata1;
                }
                else
                {
                    pdata1 = "";
                    pdata1String = "";
                }
                string classifier = Util.GetClassifierGuid(rep, el.ElementGUID);
                str = el.ElementGUID + ":" + classifier + pdata1String + " " + el.Name + ' ' + el.Type + "\r\n" +
                      "\r\nSelect ea_guid As CLASSGUID, object_type As CLASSTYPE,* from t_object o where ea_guid = '" +
                      el.ElementGUID + "'";
                if (classifier != "")
                {
                    if (el.Type.Equals("ActionPin"))
                    {
                        str = str +
                              "\r\n Type:\r\nSelect ea_guid As CLASSGUID, 'Parameter' As CLASSTYPE,* from t_operationparams op where ea_guid = '" +
                              classifier + "'";
                    }
                    else
                    {
                        str = str +
                              "\r\n Type:\r\nSelect ea_guid As CLASSGUID, object_type As CLASSTYPE,* from t_object o where ea_guid = '" +
                              classifier + "'";
                    }
                }
                if (pdata1 != "")
                {
                    str = str +
                          "\r\n PDATA1:  Select ea_guid As CLASSGUID, object_type As CLASSTYPE,* from t_object o where ea_guid = '" +
                          pdata1 + "'";
                }

                // Look for diagram object
                Diagram curDia = rep.GetCurrentDiagram();
                if (curDia != null)
                {
                    foreach (DiagramObject diaObj in curDia.DiagramObjects)
                    {
                        if (diaObj.ElementID == el.ElementID)
                        {
                            str = str + "\r\n\r\n" +
                                  "select * from t_diagramobjects where object_id = " + diaObj.ElementID;
                            break;
                        }
                    }
                }
            }

            if (oType.Equals(ObjectType.otDiagram))
            {
// Element 
                var dia = (Diagram) rep.GetContextObject();
                str = dia.DiagramGUID + " " + dia.Name + ' ' + dia.Type + "\r\n" +
                      "\r\nSelect ea_guid As CLASSGUID, diagram_type As CLASSTYPE,* from t_diagram dia where ea_guid = '" +
                      dia.DiagramGUID + "'";
            }
            if (oType.Equals(ObjectType.otPackage))
            {
// Element 
//.........这里部分代码省略.........
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:101,代码来源:EaServices.cs

示例10: LocateType

        /// <summary>
        /// Locate the type for Connector, Method, Attribute, Diagram, Element, Package
        /// </summary>
        /// <param name="rep"></param>
        public static void LocateType(Repository rep)
        {
            ObjectType oType = rep.GetContextItemType();
            Element el;
            int id;
            string triggerGuid;
            // connector
            // links to trigger
            switch (oType)
            {
                case ObjectType.otConnector:
                    var con = (Connector) rep.GetContextObject();
                    triggerGuid = Util.GetTrigger(rep, con.ConnectorGUID);
                    if (triggerGuid.StartsWith("{", StringComparison.Ordinal) &&
                        triggerGuid.EndsWith("}", StringComparison.Ordinal))
                    {
                        Element trigger = rep.GetElementByGuid(triggerGuid);

                        if (trigger != null) rep.ShowInProjectView(trigger);
                    }
                    else
                    {
                        SelectBehaviorFromConnector(rep, con, DisplayMode.Method);
                    }
                    break;


                case ObjectType.otMethod:
                    var m = (Method) rep.GetContextObject();
                    if (m.ClassifierID != "")
                    {
                        id = Convert.ToInt32(m.ClassifierID);
                        // get type
                        if (id > 0)
                        {
                            el = rep.GetElementByID(id);
                            rep.ShowInProjectView(el);
                        }
                    }
                    break;

                case ObjectType.otAttribute:
                    var attr = (EA.Attribute) rep.GetContextObject();
                    id = attr.ClassifierID;
                    // get type
                    if (id > 0)
                    {
                        el = rep.GetElementByID(attr.ClassifierID);
                        if (el.Type.Equals("Package"))
                        {
                            Package pkg = rep.GetPackageByID(Convert.ToInt32(el.MiscData[0]));
                            rep.ShowInProjectView(pkg);
                        }
                        else
                        {
                            rep.ShowInProjectView(el);
                        }
                    }
                    break;

                // Locate Diagram (e.g. from Search Window)
                case ObjectType.otDiagram:
                    var d = (Diagram) rep.GetContextObject();
                    rep.ShowInProjectView(d);
                    break;


                case ObjectType.otElement:
                    el = (Element) rep.GetContextObject();
                    if (el.ClassfierID > 0)
                    {
                        el = rep.GetElementByID(el.ClassfierID);
                        rep.ShowInProjectView(el);
                    }
                    else
                    {
//MiscData(0) PDATA1,PDATA2,
                        // pdata1 Id for parts, UmlElement
                        // object_id   for text with Hyper link to diagram

                        // locate text or frame
                        if (LocateTextOrFrame(rep, el)) return;

                        string guid = el.MiscData[0];
                        if (guid.EndsWith("}", StringComparison.Ordinal))
                        {
                            el = rep.GetElementByGuid(guid);
                            rep.ShowInProjectView(el);
                        }
                        else
                        {
                            if (el.Type.Equals("Action"))
                            {
                                foreach (CustomProperty custproperty in el.CustomProperties)
                                {
                                    if (custproperty.Name.Equals("kind") && custproperty.Value.Contains("AcceptEvent"))
//.........这里部分代码省略.........
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:101,代码来源:EaServices.cs

示例11: CreateNoteFromText

 // ReSharper disable once UnusedMember.Local
 static void CreateNoteFromText(Repository rep, string text)
 {
     if (rep.GetContextItemType().Equals(ObjectType.otElement))
     {
         var el = (Element) rep.GetContextObject();
         string s0 = CallOperationAction.RemoveUnwantedStringsFromText(text.Trim(), false);
         s0 = Regex.Replace(s0, @"\/\*", "//"); // /* ==> //
         s0 = Regex.Replace(s0, @"\*\/", ""); // delete */
         el.Notes = s0;
         el.Update();
     }
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:13,代码来源:EaServices.cs

示例12: UpdateActivityParameter

        public static void UpdateActivityParameter(Repository rep)
        {
            ObjectType oType = rep.GetContextItemType();
            if (oType.Equals(ObjectType.otElement))
            {
                var el = (Element) rep.GetContextObject();
                if (el.Type.Equals("Activity"))
                {
                    // get the associated operation
                    Method m = Util.GetOperationFromBrehavior(rep, el);
                    if (el.Locked) return;
                    if (m == null) return;
                    ActivityPar.UpdateParameterFromOperation(rep, el, m); // get parameters from Operation for Activity
                    Diagram dia = rep.GetCurrentDiagram();
                    if (dia == null) return;

                    DiagramObject diaObj = Util.GetDiagramObjectById(rep, dia, el.ElementID);
                    //EA.DiagramObject diaObj = dia.GetDiagramObjectByID(el.ElementID,"");
                    if (diaObj == null) return;

                    int pos = 0;
                    rep.SaveDiagram(dia.DiagramID);
                    foreach (Element actPar in el.EmbeddedElements)
                    {
                        if (!actPar.Type.Equals("ActivityParameter")) continue;
                        Util.VisualizePortForDiagramobject(pos, dia, diaObj, actPar, null);
                        pos = pos + 1;
                    }
                    rep.ReloadDiagram(dia.DiagramID);
                }
                if (el.Type.Equals("Class") | el.Type.Equals("Interface"))
                {
                    UpdateActivityParameterForElement(rep, el);
                }
            }
            if (oType.Equals(ObjectType.otMethod))
            {
                var m = (Method) rep.GetContextObject();
                Element act = Appl.GetBehaviorForOperation(rep, m);
                if (act == null) return;
                if (act.Locked) return;
                ActivityPar.UpdateParameterFromOperation(rep, act, m); // get parameters from Operation for Activity
            }
            if (oType.Equals(ObjectType.otPackage))
            {
                var pkg = (Package) rep.GetContextObject();
                UpdateActivityParameterForPackage(rep, pkg);
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:49,代码来源:EaServices.cs

示例13: AddNote

        /// <summary>
        /// Add Element- or Diagram -Note to Element or Diagram and link Note to Notes Property.
        /// </summary>
        /// <param name="rep"></param>
        public static void AddNote(Repository rep)
        {
            // handle multiple selected elements
            Diagram diaCurrent = rep.GetCurrentDiagram();
            EA.Collection objCol = null;
            if (diaCurrent != null)
            {
                objCol = diaCurrent.SelectedObjects;
            }
            ObjectType oType = rep.GetContextItemType();
            switch (oType)
            {
                case ObjectType.otConnector:
                    break;
                case ObjectType.otPackage:
                case ObjectType.otElement:
                    if (objCol?.Count > 0)
                    {
                        foreach (EA.DiagramObject obj in objCol)
                        {
                            AddElementNote(rep, obj);
                            

                        }

                    }
                    
                    break;
                case ObjectType.otDiagram:
                        AddDiagramNote(rep);
                    break;
                    
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:38,代码来源:EaServices.cs

示例14: MacroConnector

        /// <summary>
        /// Connector macros: ConnectorID and ConveyedItemIDS
        /// Note: If Element connector 
        /// <para/>
        /// Replace macro #ConnectorID# by the ID of the selected connector.
        /// <para/>
        /// Replace macro #ConveyedItemIDS# by the IDs of conveyed Elements of the selected connector.
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="sql">The sql string to replace the macro by the found ID</param>
        /// <returns>sql string with replaced macro</returns>
        static string MacroConnector(Repository rep, string sql)
        {
            //--------------------------------------------------------------------------------------------
            // CONNECTOR ID
            // CONVEYED_ITEM_ID
            string currentConnectorTemplate = GetTemplateText(SqlTemplateId.ConnectorId);
            string currentConveyedItemTemplate = GetTemplateText(SqlTemplateId.ConveyedItemIds);

            if ((sql.Contains(currentConnectorTemplate) | sql.Contains(currentConveyedItemTemplate)))
            {
                // connector
                if (rep.GetContextItemType() == ObjectType.otConnector)
                {
                    // connector ID
                    Connector con = rep.GetContextObject();
                    if (sql.Contains(currentConnectorTemplate))
                    {
                        
                        sql = sql.Replace(currentConnectorTemplate, $"{con.ConnectorID}");
                    }
                    // conveyed items are a comma separated list of elementIDs
                    if (sql.Contains(currentConveyedItemTemplate))
                    {

                        // to avoid syntax error, 0 will never fit any conveyed item
                        string conveyedItems = "0";

                        // first get "InformationFlows" which carries the conveyed items
                        if (con.MetaType == "Connector")
                        {
                            // get semicolon delimiter list of information flow guids
                            string sqlInformationFlows = "select x.description " +
                                                         "    from  t_xref x " +
                                                         $"    where x.client = '{con.ConnectorGUID}' ";

                            // get semicolon delimiter list of guids of all dependent connectors/information flows
                            List<string> lFlows = rep.GetStringsBySql(sqlInformationFlows);
                            foreach (string flowGuids in lFlows) { 
                                string[] lFlowGuid = flowGuids.Split(',');
                                foreach (string flowGuid in lFlowGuid)
                                {
                                    EA.Connector flow = rep.GetConnectorByGuid(flowGuid);
                                    foreach (EA.Element el in flow.ConveyedItems)
                                    {
                                        conveyedItems = $"{conveyedItems}, {el.ElementID}";
                                    }
                                }

                            }
                        }
                        else
                        {


                            foreach (EA.Element el in con.ConveyedItems)
                            {
                                conveyedItems = $"{conveyedItems}, {el.ElementID}";
                            }

                        }
                        sql = sql.Replace(currentConveyedItemTemplate, $"{conveyedItems}");
                    }
                } else
                // no connector selected
                {
                    MessageBox.Show(sql, @"No connector selected!");
                    sql = "";
                }
            }
            return sql;
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:82,代码来源:SqlTemplates.cs

示例15: DeleteInvisibleUseRealizationDependencies

        // ReSharper disable once UnusedMember.Local
        static void DeleteInvisibleUseRealizationDependencies(Repository rep)
        {
            Connector con;
            var dia = rep.GetCurrentDiagram();
            if (dia == null) return;
            if (!rep.GetContextItemType().Equals(ObjectType.otElement)) return;

            // only one diagram object selected as source
            if (dia.SelectedObjects.Count != 1) return;

            rep.SaveDiagram(dia.DiagramID);
            var diaObjSource = (DiagramObject) dia.SelectedObjects.GetAt(0);
            var elSource = rep.GetElementByID(diaObjSource.ElementID);
            var elSourceId = elSource.ElementID;
            if (!("Interface Class".Contains(elSource.Type))) return;

            // list of all connectorIDs
            var lInternalId = new List<int>();
            foreach (DiagramLink link in dia.DiagramLinks)
            {
                con = rep.GetConnectorByID(link.ConnectorID);
                if (con.ClientID != elSourceId) continue;
                if (!("Usage Realisation".Contains(con.Type))) continue;
                lInternalId.Add(con.ConnectorID);
            }


            for (int i = elSource.Connectors.Count - 1; i >= 0; i = i - 1)
            {
                con = (Connector) elSource.Connectors.GetAt((short) i);
                var conType = con.Type;
                if ("Usage Realisation".Contains(conType))
                {
                    // check if target is..
                    var elTarget = rep.GetElementByID(con.SupplierID);
                    if (elTarget.Type == "Interface")
                    {
                        if (lInternalId.BinarySearch(con.ConnectorID) < 0)
                        {
                            elSource.Connectors.DeleteAt((short) i, true);
                        }
                    }
                }
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:46,代码来源:EaServices.cs


注:本文中的Repository.GetContextItemType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。