Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ocroquette on July 20, 2007, 04:56:11 am
-
Hi
With EA_OnPostNewAttribute, I get a "EA.EventProperties Info", from which I can get the new attribute's id (Info.Get(0).Value)
The problem is, I can't find any way to find this attribute from there.
There is no Repository.GetAttributesByID(), and I don't really understand that.
The same is true for the methods, ie. there is no GetMethodsByID(), while there are GetPackagebyID(), GetConnectorByID(), GetDiagramByID(),...
Any idea!?
Don't tell me I have to loop through all the attributes of all the elements to find my attribute! :P
-
This event is only triggered if you have successfully completed the process of adding an attribute. This event gives you the ID of the attribute, which is only assigned when creation is completed.
When you begin to add the attribute (i.e. have just opened the editor or something) the EA_OnPreNewAttribute event is triggered. The Info property for this event contains (among other things) a ParentID field that identifies the owning element.
You'll still have to blunder through the Attributes collection to find the one with the corrent ID. That's a pain, but no greater than what you'd have to handle in any case.
David
-
Does the attribute have a parent for which you can get ElementByID? (A shot in the dark from my Mac)
-
This event is only triggered if you have successfully completed the process of adding an attribute. This event gives you the ID of the attribute, which is only assigned when creation is completed.
When you begin to add the attribute (i.e. have just opened the editor or something) the EA_OnPreNewAttribute event is triggered. The Info property for this event contains (among other things) a ParentID field that identifies the owning element.
That's clear to me.
However, EA could transmit the ParentID on EA_OnPostNewAttribute too. It would make life easier.
You'll still have to blunder through the Attributes collection to find the one with the corrent ID. That's a pain, but no greater than what you'd have to handle in any case.
It seems to me like an illogical limitation of the API. I will fill a feature request.
Thanks for your help!
-
Does the attribute have a parent for which you can get ElementByID? (A shot in the dark from my Mac)
Sure, but you still need to loop over all the attributes again to get the corresponding attribute as an object.
-
That's usual behavior - category UI :(
I've definitely seen worse things. Even such where people do believe it's brilliant (Microsoft, to name one example). But what outstanding product could EA be without that Unique Interface?