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


C# Repository.ShowInProjectView方法代码示例

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


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

示例1: LocateTextOrFrame

 static bool LocateTextOrFrame(Repository rep, Element el)
 {
     if (el.Type == "Text")
     {
         string s = el.MiscData[0];
         int id = Convert.ToInt32(s);
         Diagram dia = rep.GetDiagramByID(id);
         rep.ShowInProjectView(dia);
         return true;
     }
     // display the original diagram on what the frame is based
     if (el.Type == "UMLDiagram")
     {
         int id = Convert.ToInt32(el.MiscData[0]);
         Diagram dia = rep.GetDiagramByID(id);
         rep.ShowInProjectView(dia);
         return true;
     }
     return false;
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:20,代码来源:EaServices.cs

示例2: 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

示例3: CreateActivityForOperation

        public static void CreateActivityForOperation(Repository rep)
        {
            ObjectType oType = rep.GetContextItemType();
            switch (oType)
            {
                case ObjectType.otMethod:
                    var m = (Method) rep.GetContextObject();

                    // Create Activity at the end
                    Element el = rep.GetElementByID(m.ParentID);
                    Package pkg = rep.GetPackageByID(el.PackageID);
                    int pos = pkg.Packages.Count + 1;
                    ActivityPar.CreateActivityForOperation(rep, m, pos);
                    rep.Models.Refresh();
                    rep.RefreshModelView(0);
                    rep.ShowInProjectView(m);
                    break;

                case ObjectType.otElement:
                    el = (Element) rep.GetContextObject();
                    if (el.Locked) return;

                    CreateActivityForOperationsInElement(rep, el);
                    rep.Models.Refresh();
                    rep.RefreshModelView(0);
                    rep.ShowInProjectView(el);
                    break;

                case ObjectType.otPackage:
                    pkg = (Package) rep.GetContextObject();
                    CreateActivityForOperationsInPackage(rep, pkg);
                    // update sort order of packages
                    rep.Models.Refresh();
                    rep.RefreshModelView(0);
                    rep.ShowInProjectView(pkg);
                    break;
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:38,代码来源:EaServices.cs

示例4: CreateTypeDefStructFromText

        static void CreateTypeDefStructFromText(Repository rep, Diagram dia, Package pkg, Element el, string txt)
        {
            Element elTypedef = null;


            // delete comment
            txt = DeleteComment(txt);

            bool update = false;
            bool isStruct = true;
            string elType = "Class";

            // find start
            string regex = @"[\s]*typedef[\s]+(struct|enum)[\s]*([^{]*){";
            Match match = Regex.Match(txt, regex);
            if (!match.Success) return;
            if (txt.Contains(" enum"))
            {
                elType = "Enumeration";
                isStruct = false;
            }
            txt = txt.Replace(match.Value, "");

            // find name
            regex = @"}[\s]*([^;]*);";
            match = Regex.Match(txt, regex);
            if (!match.Success) return;
            string name = match.Groups[1].Value.Trim();
            if (name == "") return;
            txt = txt.Remove(match.Index, match.Length);

            // check if typedef already exists
            int targetId = Util.GetTypeId(rep, name);
            if (targetId != 0)
            {
                elTypedef = rep.GetElementByID(targetId);
                update = true;
                for (int i = elTypedef.Attributes.Count - 1; i > -1; i = i - 1)
                {
                    elTypedef.Attributes.DeleteAt((short) i, true);
                }
            }


            // create typedef
            if (update == false)
            {
                if (el != null)
                {
                    // create class below element
                    if ("Interface Class Component".Contains(el.Type))
                    {
                        elTypedef = (Element) el.Elements.AddNew(name, elType);
                        el.Elements.Refresh();
                    }
                    else
                    {
                        MessageBox.Show(@"Can't create element below selected Element");
                    }
                }
                else // create class in package
                {
                    elTypedef = (Element) pkg.Elements.AddNew(name, elType);
                    pkg.Elements.Refresh();
                }
            }
            if (isStruct)
            {
                elTypedef.Stereotype = @"struct";
                EA.TaggedValue tag = TaggedValue.AddTaggedValue(elTypedef, "typedef");
                tag.Value = "true";
                tag.Update();
            }
            if (update == false)
            {
                elTypedef.Name = name;
                elTypedef.Update();
            }

            // add elements
            if (isStruct) CreateClassAttributesFromText(rep, elTypedef, txt);
            else CreateEnumerationAttributesFromText(rep, elTypedef, txt);

            if (update)
            {
                rep.RefreshModelView(elTypedef.PackageID);
                rep.ShowInProjectView(elTypedef);
            }
            else
            {
                // put diagram object on diagram
                int left = 0;
                int right = left + 200;
                int top = 0;
                int bottom = top + 100;
                //int right = diaObj.right + 2 * (diaObj.right - diaObj.left);
                rep.SaveDiagram(dia.DiagramID);
                string position = "l=" + left + ";r=" + right + ";t=" + top + ";b=" + bottom + ";";
                var diaObj = (DiagramObject) dia.DiagramObjects.AddNew(position, "");
                dia.DiagramObjects.Refresh();
//.........这里部分代码省略.........
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:101,代码来源:EaServices.cs

示例5: 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

示例6: LocateOperationFromBehavior

 static void LocateOperationFromBehavior(Repository repository, Element el, DisplayMode showBehavior)
 {
     Method method = Util.GetOperationFromBrehavior(repository, el);
     if (method != null)
     {
         if (showBehavior.Equals(DisplayMode.Behavior))
         {
             Appl.DisplayBehaviorForOperation(repository, method);
         }
         else
         {
             repository.ShowInProjectView(method);
         }
     }
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:15,代码来源:EaServices.cs

示例7: SelectBehaviorFromConnector

        /// <summary>
        /// Display behavior or definition for selected connector ("StateFlow","Sequence"). It Displays the operation (displayMode=Method) or the Behavior (displayMode=Behavior).
        /// <para/>- enum displayMode: "Behavior" or "Method"
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="con"></param>
        /// <param name="showBehavior"></param>
        static void SelectBehaviorFromConnector(Repository repository, Connector con, DisplayMode showBehavior)
        {
            if (con.Type.Equals("StateFlow"))
            {
                Method m = Util.GetOperationFromConnector(repository, con);
                if (m != null)
                {
                    if (showBehavior.Equals(DisplayMode.Behavior))
                    {
                        Appl.DisplayBehaviorForOperation(repository, m);
                    }
                    else
                    {
                        repository.ShowInProjectView(m);
                    }
                }
            }

            if (con.Type.Equals("Sequence"))
            {
                // If name is of the form: OperationName(..) the operation is associated to an method
                string opName = con.Name;
                if (opName.EndsWith(")", StringComparison.Ordinal))
                {
                    // extract the name
                    int pos = opName.IndexOf("(", StringComparison.Ordinal);
                    opName = opName.Substring(0, pos);
                    Element el = repository.GetElementByID(con.SupplierID);
                    // find operation by name
                    foreach (Method op in el.Methods)
                    {
                        if (op.Name == opName)
                        {
                            repository.ShowInProjectView(op);
                            //Appl.DisplayBehaviorForOperation(Repository, op);
                            return;
                        }
                    }
                    // If connector 0 Sequence and Classifier exists
                    if (con.Type.Equals("Sequence") && ( el.ClassfierID > 0 || el.PropertyType > 0))
                    {
                        if ("PartPort".Contains(el.Type))
                        {
                            if (el.PropertyType > 0)
                            {
                                el = repository.GetElementByID(el.PropertyType);
                            }
                            else
                            {
                                if (el.ClassifierID > 0)
                                    el = repository.GetElementByID(el.ClassifierID);
                                else return;

                            }
                        }
                        else
                        {
                            if (el.ClassifierID > 0)
                                el = repository.GetElementByID(el.ClassifierID);
                        }

                        foreach (Method op in el.Methods)
                        {
                            if (op.Name == opName)
                            {
                                if (showBehavior.Equals(DisplayMode.Behavior))
                                {
                                    Appl.DisplayBehaviorForOperation(repository, op);
                                }
                                else
                                {
                                    repository.ShowInProjectView(op);
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:86,代码来源:EaServices.cs


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