Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: SteveC on September 11, 2018, 07:32:14 am

Title: Notification When an Element is Modified
Post by: SteveC on September 11, 2018, 07:32:14 am
Is anyone aware of how an add-in can be notified when an element is modified?

For example, I'd like to know when the user changes a tagged value of one of the elements. This would allow the add-in to check if it should perform any processing on the element based on the new tagged values.
Title: Re: Notification When an Element is Modified
Post by: qwerty on September 11, 2018, 07:45:04 am
There's a hook (EAOnContextItemChanges IIRC out of memory). But it does not report TV changes.

q.
Title: Re: Notification When an Element is Modified
Post by: EXploringEA on September 11, 2018, 04:49:49 pm
I had this requirement sometime ago and used EA_OnNotifyContextItemModified but this doesn't let you know if this is due to a tagged value change. 

Hence, my approach was to use EA_OnContextItemChanged to track the selection of an element, and take a copy of tagged values before any changes.  Then when ContextItemModified is triggered a check can be made to see if there is any difference for a tagged value.  Not ideal.. 

Title: Re: Notification When an Element is Modified
Post by: Geert Bellekens on September 11, 2018, 04:53:27 pm
There is a (fairly) new set of events related to editing tagged values:

https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/automation/tagged_value_broadcasts.html (https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/automation/tagged_value_broadcasts.html)

Geert
Title: Re: Notification When an Element is Modified
Post by: Eve on September 11, 2018, 05:25:21 pm
There is a (fairly) new set of events related to editing tagged values:

https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/automation/tagged_value_broadcasts.html (https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/automation/tagged_value_broadcasts.html)

Geert
Unfortunately, they are only relevant for AddinBroadcast (http://www.sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/predefinedtaggedvaluetypes.html) tagged values.

But you could use them to force tagged value edits to go through your addin.
Title: Re: Notification When an Element is Modified
Post by: Geert Bellekens on September 11, 2018, 06:56:11 pm
There is a (fairly) new set of events related to editing tagged values:

https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/automation/tagged_value_broadcasts.html (https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/automation/tagged_value_broadcasts.html)

Geert
Unfortunately, they are only relevant for AddinBroadcast (http://www.sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/predefinedtaggedvaluetypes.html) tagged values.

But you could use them to force tagged value edits to go through your addin.
Ahh, too bad   :'(

Would be nice to have such a general "taggedValueModified" event thoug.

Geert