コード例 #1
0
ファイル: MyAddin.cs プロジェクト: jotab/add_in
 //Create and turn on one output tab with name the value of constant OUTPUT_NAME
 private void outputTabActive(EA.Repository repository)
 {
     repository.CreateOutputTab(OUTPUT_NAME);
     repository.EnsureOutputVisible(OUTPUT_NAME);
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: razr/ea-audio
        // Called when user makes a selection in the menu.
        // This is your main exit point to the rest of your Add-in
        public void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName)
        {
            switch( ItemName )
            {
                case "&Audio Configuration":

                    String writerString;

                    writerString = "Please select an audio diagram";

                    Repository.CreateOutputTab("Audio Configuration");
                    Repository.EnsureOutputVisible("Audio Configuration");
                    Repository.ClearOutput("Audio Configuration");

                    /* works on currently selected diagram */

                    if (Repository.GetTreeSelectedItemType() == EA.ObjectType.otDiagram)
                    {
                        EA.Diagram theDiagram;

                        theDiagram = (EA.Diagram)Repository.GetTreeSelectedObject();
                        writerString = "Name = " + theDiagram.Name.ToString() + " " + theDiagram.Type.ToString() + System.Environment.NewLine;
                        Repository.WriteOutput("Audio Configuration", writerString, 0);

                        foreach (EA.DiagramObject theDiagramObject in theDiagram.DiagramObjects)
                        {
                            EA.Element theElement = Repository.GetElementByID(theDiagramObject.ElementID);

                            /* consider only instances */
                            if (theElement.ClassfierID != 0)
                            {
                                // get classifier, in our case it is sink or source classes
                                EA.Element theClassfierElement = Repository.GetElementByID(theElement.ClassfierID);

                                writerString = theElement.Name.ToString() + " " + theClassfierElement.Name.ToString();
                                //writerString = theDiagramObject.ObjectType.ToString() + System.Environment.NewLine;
                                Repository.WriteOutput("Audio Configuration", writerString, 0);

                                writerString = theElement.RunState;
                                Repository.WriteOutput("Audio Configuration", writerString, 0);

                                // parse embedded elements
                                foreach (EA.Element theEmbeddedElement in theElement.EmbeddedElements)
                                {
                                    writerString = "\t" + theEmbeddedElement.Name.ToString();
                                    Repository.WriteOutput("Audio Configuration", writerString, 0);
                                    foreach (EA.Connector theConnector in theEmbeddedElement.Connectors)
                                    {
                                        writerString = "\t\t" + theConnector.Name.ToString();
                                        Repository.WriteOutput("Audio Configuration", writerString, 0);
                                    }
                                }
                            }
                        }
                    }

                    break;
                case "&Menu2":

                    break;
                case "About...":
                    Form1 anAbout = new Form1();
                    anAbout.ShowDialog();
                    break;
            }
        }