Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: slautebach on January 05, 2017, 02:07:19 am

Title: EA Addin Events API and Repository
Post by: slautebach on January 05, 2017, 02:07:19 am
I am writing an addin for EA, and notice that almost all Addin Events pass in the repository parameter.  Given that the repository is always being passed in, would it be technically safe to catch all the events and store/update a global reference to the Repository?   So when my addin events occur I can just reference the latest reference to the repository through my addin's global reference?  Or are there potential edge cases that would not make this safe or reliable?
Title: Re: EA Addin Events API and Repository
Post by: qwerty on January 05, 2017, 02:36:10 am
Your add-in is registered and thus can be called from different EA instances.

q.
Title: Re: EA Addin Events API and Repository
Post by: slautebach on January 05, 2017, 03:34:48 am
Thank you for the response.  To be sure I am understanding what you have said, If I or a user were to run multiple instances of EA each instance of EA is sharing the same singular instance of my Addin object? 
Title: Re: EA Addin Events API and Repository
Post by: Geert Bellekens on January 05, 2017, 04:16:16 am
Thank you for the response.  To be sure I am understanding what you have said, If I or a user were to run multiple instances of EA each instance of EA is sharing the same singular instance of my Addin object?
No each instance of EA instantiates a new instance of your add-in class.
So yes it is safe to keep a reference to the repository object, as long as you update it when EA opens a different model. EA_FileOpen?

Geert