简体   繁体   中英

Enterprise architect : C# add-in current selected item tagged value

I have own profile in EA and i can give a own note element with a specific tag value. My problem is, that i want select some note in project and change tag value through add-in. How can i get current selected element ?

在此处输入图片说明

RTM: Respository.GetTreeSelectedObject

You can use

Repository.GetContextObject()

to get the currently selected Object.
To get the type of the object, use Repository.GetContextItemType()

you can then assign an EA.Element type to the object returned by Repository.GetContextObject()

 private void getSelectedElement(EA.Repository Rep)
            {
                EA.Element ele;
                switch(Rep.GetContextItemType())
                {
                    case EA.ObjectType.otElement:
                        {
                            ele = Rep.GetContextObject();
                            //Operations on the selected element
                            break;
                        }
                } 
            }

If you want to know all the possible types, see the documentation (This is for EA 13)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM