Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: bachus on August 13, 2014, 07:02:40 pm

Title: Deleting Attributes when using EA New Events
Post by: bachus on August 13, 2014, 07:02:40 pm
hello !

I'm currently struggling with the EA Post-New Events and EA Pre-New Event.
In a c# Add-in, I'm checking if the right attribute is apply on the right element, using theirs stereotypes.

I try to use the function EA_OnPostNewAttribute which work correctly to do some tests and modifications on the attributes proprieties.
But I didn't manage to "not apply" the attribute if I don't want to (returning false in that case). Which seems normal as the Attribute is already created...
So I try to erase this attribute, but I did not succeed.  :(
-> Which method should I use to erase an attribute knowing is ID and is parentID ?

As it didn't work with that function, I try to use the EA_OnPreNewAttribute. It seems perfect in the first case, as it allows to add or not add the attribute before it is created ! But I didn't manage to change the proprieties, so it became useless...
In the function it is possible to change the attributes proprieties, but the changes are not took into account then the attribute is created.
-> is there a way to change the attributes proprieties using this function ?


Any help is welcome !  :)
Title: Re: Deleting Attributes when using EA New Events
Post by: qwerty on August 13, 2014, 08:35:16 pm
I guess you will need some internal storage and check both events. The PRE to eventually block creation and the POST to modify things afterwards.

q.
Title: Re: Deleting Attributes when using EA New Events
Post by: bachus on August 13, 2014, 09:25:54 pm
What was my opinion too. But I would like to avoid the use of global variable...

Thanks for the fast answer !  
Title: Re: Deleting Attributes when using EA New Events
Post by: qwerty on August 13, 2014, 09:42:28 pm
IIRC similar topics had been discussed here and Geert suggested this approach too.

q.