Book a Demo

Author Topic: Load Addin only for a certain repository  (Read 3786 times)

E.Eckstein

  • EA User
  • **
  • Posts: 35
  • Karma: +0/-0
    • View Profile
Load Addin only for a certain repository
« on: September 22, 2015, 04:38:26 pm »
Hi dudes and dudines  ;D

I have a requirement and I got no idea how to realize it. The search in .chm and the forum didn't change this issue.

My problem is following: In the company, some users are working on different repositories (Oracle DBs). The Add-In I developed is quite spezialized and though I know it shouldn't it might crash if it is used in the wrong repository (some special guid's missing etc.) ...

So what I want to do is deativate the Add-In if an different repository is opened.

I had something in mind like developing an 2nd Addin, which could listen to project opened or something like this and deativate the actual Add-In.

I am afraid I can't find a method or something similar to deativate an running Add-In.

Some ideas?

Best Regards,
Eric

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Load Addin only for a certain repository
« Reply #1 on: September 22, 2015, 05:04:19 pm »
Can't think of any way to prevent the add-in from loading as this happens before you have connected to any repository.  My suggestion would be to have your add-in check the value of Repository.ConnectionString and/or Repository.RepositoryType() and then handle as appropriate.  E.g. check these values in EA_GetMenuState and disable the menus when not connected to your Oracle repository.

E.Eckstein

  • EA User
  • **
  • Posts: 35
  • Karma: +0/-0
    • View Profile
Re: Load Addin only for a certain repository
« Reply #2 on: September 22, 2015, 05:08:17 pm »
Hey Aaron,

thank you very much for you fast reply.
Yes I thought so. I might check the connectionstring as you said, save it to a static variable and just return from events fired by EA if we are in the wrong state.

Well thank you again,
If someone else has an idea - I'll still check the thread in time :)

Regards,
Eric

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Load Addin only for a certain repository
« Reply #3 on: September 22, 2015, 08:38:14 pm »
I would do as Aaron suggests.

But technically you can in fact use an add-in to load (or not) other addins.

I'm working on such a project  (soon to be released) but it is no easy task.

Geert