Search code examples
c#scriptingadd-inenterprise-architect

EA select Element API


I'm creating an Add-in for EA in C# and I'm new in this topic.

I need a method when is selected an element in EA with left click to trigger an event. Now I succeeded to used method EA_GetMenuItems for right click, but for left click didn't found any method.

Also when method is triggered I need to know what type of element was selected: a diagram, a block, ..

It will help me also if you have any documentation with EA API C#, I found this documentation, but seems that is old: https://sparxsystems.com.au/downloads/resources/booklets/enterprise_architect_sdk.pdf


Solution

  • All the documentation you need is in the manual, that can be reached by pressing F1 inside EA.

    Clicking on an element will trigger the event EA_OnContextItemChanged.

    The parameter ot gives you the item's type. You can use one of the Repository.GetXXXByGUID methods with the parameter GUID to get a hold of the actual object that was selected.

    This example is one of the add-ins I wrote that uses this event.