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


C# EA.GetCurrentDiagram方法代码示例

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


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

示例1: GetElementFromContextObject

 /// <summary>
 /// Get element from Context element. Possible inputs are: Attribute, Operation, Element, Package
 /// </summary>
 /// <param name="rep"></param>
 /// <returns></returns>
 public static EA.Element GetElementFromContextObject(EA.Repository rep)  {
     EA.Element el = null;
     EA.ObjectType objectType = rep.GetContextItemType();
     switch (objectType)
     {
         case ObjectType.otAttribute:
             var a = (EA.Attribute)rep.GetContextObject();
             el = rep.GetElementByID(a.ParentID);
             break;
         case ObjectType.otMethod:
             var m = (Method)rep.GetContextObject();
             el = rep.GetElementByID(m.ParentID);
             break;
         case ObjectType.otElement:
             el = (EA.Element)rep.GetContextObject();
             break;
         case ObjectType.otPackage:
             EA.Package pkg  = rep.GetContextObject();
             el = rep.GetElementByGuid(pkg.PackageGUID);
             break;
         case ObjectType.otNone:
             EA.Diagram dia = rep.GetCurrentDiagram();
             if (dia?.SelectedObjects.Count == 1)
             {
                 var objSelected = (EA.DiagramObject)dia.SelectedObjects.GetAt(0);
                 el = rep.GetElementByID(objSelected.ElementID);
             }
             break;
         default:
             MessageBox.Show(@"No Element, Attribute, Operation, Package selected");
             break;
      }
     return el;
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:39,代码来源:Util.cs

示例2: GetCurrentElement

        /// <summary>
        /// Selected items in the project browser are processed differently than selected elements
        /// in the visible diagram. This helper will grab the currently selected project browser item first.
        /// If it doesn't find it, it will return the currently selected diagram item.
        /// </summary>
        /// <param name="repository">The currently open EA repository</param>
        /// <returns>The element currently selected in either the project browser or diagram</returns>
        public static EA.Element GetCurrentElement(EA.Repository repository)
        {
            EA.Element result = null;

            EA.Collection elements = repository.GetTreeSelectedElements();

            if (elements.Count > 0)
            {
                result = elements.GetAt(0);
            }
            else
            {
                EA.Diagram diagram = repository.GetCurrentDiagram();
                if (diagram != null)
                {
                    EA.DiagramObject s = diagram.SelectedObjects.GetAt(0);
                    result = repository.GetElementByID(s.ElementID);
                }
            }

            return result;
        }
开发者ID:PlasmaTrout,项目名称:EAPowerTools,代码行数:29,代码来源:EAHelper.cs

示例3: testPropertiesDialog

 public void testPropertiesDialog(EA.Repository repository)
 {
     int diagramID = repository.GetCurrentDiagram().DiagramID;
     repository.OpenDiagramPropertyDlg(diagramID);
 }
开发者ID:JOndik,项目名称:SmallTEAmsHelper,代码行数:5,代码来源:BPAddIn.cs

示例4: showProperties

        //
        private void showProperties(EA.Repository repository)
        {
            outputTabActive(repository);
            repository.WriteOutput(OUTPUT_NAME, "Tags created:\n", 0);
            Diagram dia = repository.GetCurrentDiagram();
            for (short i = 0; i < dia.DiagramLinks.Count; i++)
            {
                DiagramLink diaLink = dia.DiagramLinks.GetAt(i);
                Connector con = repository.GetConnectorByID(diaLink.ConnectorID);

            }

            /*foreach (Package model in repository.Models)
             repository.WriteOutput(OUTPUT_NAME, "\n\nName of all Elements: ", 0);
                    foreach (Element element in package.Elements)
                    {
                        repository.WriteOutput(OUTPUT_NAME, element.Name, 0);
                    }
                }
            }*/
        }
开发者ID:jotab,项目名称:add_in,代码行数:22,代码来源:MyAddin.cs

示例5: countExistingConnections

 //No Tested
 private short countExistingConnections(EA.Repository repository)
 {
     Diagram diagram = repository.GetCurrentDiagram();
     return diagram.DiagramLinks.Count;
 }
开发者ID:jotab,项目名称:add_in,代码行数:6,代码来源:MyAddin.cs

示例6: insertCDE

        public static void insertCDE(EA.Repository m_Repository, QueryServiceControl.QueryServiceManager.dataelement de, EAUtil.INSERT_XSD_TYPE xsdType)
        {
            try
            {
                string id = de.names.id;
                string name = de.names.preferred;
                string definition = QueryServiceControl.QueryServiceControl.getDefinition(de.definition);

                EA.Package package = m_Repository.GetPackageByID(m_Repository.GetCurrentDiagram().PackageID);
                EA.Element o = (EA.Element)package.Elements.AddNew(name.Replace(" ", "_"), "Class");
                o.Notes = definition + " (ID: " + id + ")";

                EAUtil.addTaggedValue("CDERef", id, o);
                EAUtil.addTaggedValue("preferred name", name, o);

                if (package.StereotypeEx == "XSDschema")
                {
                    if (xsdType == EAUtil.INSERT_XSD_TYPE.TOP_LEVEL_ELEMENT)
                    {
                        o.Stereotype = "XSDtopLevelElement";
                    }
                    else if (xsdType == EAUtil.INSERT_XSD_TYPE.TOP_LEVEL_ATTRIBUTE)
                    {
                        o.Stereotype = "XSDtopLevelAttribute";
                    }
                }

                if (de.values != null && de.values.Item is QueryServiceControl.QueryServiceManager.nonenumerated)
                {
                    string dataType = (de.values.Item as QueryServiceControl.QueryServiceManager.nonenumerated).datatype;
                    if (dataType.StartsWith("xs:"))// || dataType.StartsWith("xsd:"))
                    {
                        //o.Genlinks = "Parent=" + dataType.Substring(dataType.IndexOf(":") + 1) + ";";
                        string simpleTypeClassName = name.Replace(" ", "_") + "_Type";
                        EA.Element simpleTypeClass = (EA.Element)package.Elements.AddNew(simpleTypeClassName, "Class");
                        simpleTypeClass.Stereotype = "XSDsimpleType";
                        simpleTypeClass.Genlinks = "Parent=" + dataType.Substring(dataType.IndexOf(":") + 1) + ";";
                        simpleTypeClass.Update();
                        simpleTypeClass.Refresh();

                        EA.DiagramObject simpleTypeDiag = (EA.DiagramObject)(m_Repository.GetCurrentDiagram().DiagramObjects.AddNew("", ""));
                        simpleTypeDiag.ElementID = simpleTypeClass.ElementID;
                        simpleTypeDiag.Update();

                        EA.Connector simpleTypeConnector = (EA.Connector)o.Connectors.AddNew("", "Generalization");
                        simpleTypeConnector.SupplierID = simpleTypeDiag.ElementID;
                        simpleTypeConnector.Update();
                        o.Connectors.Refresh();
                    }
                    else
                    {
                        o.Genlinks = "Parent=" + dataType + ";";
                    }
                }
                else if (de.values != null && de.values.Item is QueryServiceControl.QueryServiceManager.enumerated)
                {
                    string enumClassName = "Enum_" + name.Replace(" ", "_");
                    EA.Element enumClass = (EA.Element)package.Elements.AddNew(enumClassName, "Class");
                    enumClass.Stereotype = "enumeration";
                    enumClass.Genlinks = "Parent=string;";

                    QueryServiceControl.QueryServiceManager.enumerated en =
                        de.values.Item as QueryServiceControl.QueryServiceManager.enumerated;

                    foreach (QueryServiceControl.QueryServiceManager.validvalue vv in en.validvalue)
                    {
                        EA.Attribute at = (EA.Attribute)enumClass.Attributes.AddNew("", "");
                        at.Stereotype = "enum";
                        at.Name = vv.code;
                        at.Notes = QueryServiceControl.QueryServiceControl.getMeaning(vv.meaning);
                        at.Update();
                    }
                    enumClass.Attributes.Refresh();

                    EA.DiagramObject enumDiag = (EA.DiagramObject)(m_Repository.GetCurrentDiagram().DiagramObjects.AddNew("", ""));
                    enumDiag.ElementID = enumClass.ElementID;
                    enumDiag.Update();

                    EA.Connector enumConnector = (EA.Connector)o.Connectors.AddNew("", "Generalization");
                    enumConnector.SupplierID = enumDiag.ElementID;
                    enumConnector.Update();
                    o.Connectors.Refresh();

                    enumClass.Update();
                    enumClass.Refresh();
                }
                //attr.Update();

                //o.Attributes.Refresh();

                o.Update();
                o.Refresh();

                EA.DiagramObject diagram = (EA.DiagramObject)(m_Repository.GetCurrentDiagram().DiagramObjects.AddNew("", ""));
                diagram.ElementID = o.ElementID;
                diagram.Update();

                m_Repository.ReloadDiagram(diagram.DiagramID);

                //this.Close();
//.........这里部分代码省略.........
开发者ID:NCIP,项目名称:cagrid-grid-incubation,代码行数:101,代码来源:EAUtil.cs


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