Book a Demo

Author Topic: Where to store project related settings for Addin  (Read 5965 times)

khalidlkhan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Where to store project related settings for Addin
« on: March 10, 2008, 11:36:01 pm »
Hi,

I'm writing an addin for EA and wondered if anyone could advise where and how I could store settings for the addin within model. User settings I can put away in the registry but I need to find a place I can store the settings that relate to the open project, preferebly in a place where the can not be browsed by the user in the project view.

Any feedback appreciated.  

thomas.kilian

  • Guest
Re: Where to store project related settings for Ad
« Reply #1 on: March 11, 2008, 01:42:56 am »
Hm, tricky. An awkward one: there are a few elements which do not appear in the browser (like notes). You could create such a note and store the information in there. However, a Find Orphans would find them.  The element could be locked additionally using database security. Or - you place the note with empty content in a diagram at no size (that would be hard to find, though not impossible). Then Tags (does that work with notes?) could store the data.

khalidlkhan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Where to store project related settings for Ad
« Reply #2 on: March 11, 2008, 06:28:45 pm »
Thanks for your thoughts.

I wanted to save the settings as tags against an EA.Package entity. I believe this is possible. However, I have to assume that someone using my addin probably won't have the required package or package structure that would allow me to find it reliably. Also, of course, if I just add in a package of my choosing it will show up in the project browser, hence arousing curiosity and also looking a bit tatty. (It seems that Model Views which are of an EA.Package type don't allow you to store tags against them. That would have been my ideal compromise, as I could have declared a new Model View dedicated to my addin.)

So I have looked high and low to find a convenient, easily locatable place in the model but have not found anywhere appropriate.

I wondered if other addin authors had had faced the same issue and how they had solved this.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Where to store project related settings for Ad
« Reply #3 on: March 11, 2008, 08:05:17 pm »
Quote
I wondered if other addin authors had had faced the same issue

Actually it never occured to me. Which settings would I want to hide from the Add In users?

khalidlkhan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Where to store project related settings for Ad
« Reply #4 on: March 11, 2008, 08:34:27 pm »
Well I'm in the midst of writing Yet-Another-Requirements addin ( I know a number of addins have been produced in this space - but this is very specific to the company I work for and integrates tightly with the existing legacy requirements gathering tools that are in place.)

What I would like to store in the model/project are:
  • the prefix, sequencecounter and format for new requirements. (I know EA has such a beast but I couldn't find how to get to it programmatically, and besides I have finer grain control over the requirements Ids if I have control over these settings;
  • The GUID of the package/view that a particular project wants to store their requirements in - not all projects store them in the same place. Yes I could enforce a standard but it would be nicer to keep the flexibility if possible.
These are possibly not the best examples of what an addin needs to keep track of and that a user need not have access to in a uncontrolled way. But I think that generically there should be somewhere that addins can store information/settings in the model which can only be accessed programatically - ideally an EA.Package that has a hidden flag that causes it and it's children not to appear in the project browser.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Where to store project related settings for Ad
« Reply #5 on: March 11, 2008, 08:47:45 pm »
Quote
the prefix, sequencecounter and format for new requirements

Quote
The GUID of the package/view that a particular project wants to store their requirements in

But where do these values come from?

If users define them they must see them.

If they are god given they can be hardcoded or read from a configuration file.

If your Add In computes them it can compute them again next time without having to save them with the project.

khalidlkhan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Where to store project related settings for Ad
« Reply #6 on: March 11, 2008, 09:04:59 pm »
My addin has a settings menu option that pops up a dialog box that allows a user to set these in a user friendly way and checks that entered values are acceptable.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Where to store project related settings for Ad
« Reply #7 on: March 11, 2008, 09:44:11 pm »
Quote
My addin has a settings menu option that pops up a dialog box that allows a user to set these

Now I see. Then of course you need to save them somewhere.

I think I would add a view with a name like "Settings" and underneath the view a package like "Requirement settings" with tagged values. You could even use the EA_OnPreDeleteElement broadcast event to prevent deletion of these packages. Unfortunately there seems to be no event when a tagged value is changed. So you would have to validate the values whenever your Add In needs them and pop up your dialog again if they are invalid.

Maybe you could add a diagram with the settings package and a note saying "Don't change these values manually", but of course this is far from perfect. EA's automation interface is sadly limited there.

You can always file a feature request however, so they know someone is longing for all the missing broadcast events (OnPreDeleteTaggedValue, OnPreChangeTaggedValue a.s.o). Such events would come in handy for profile authors too, who could then use an Add In to validate the tagged values defined in their profiles.

khalidlkhan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Where to store project related settings for Ad
« Reply #8 on: March 11, 2008, 09:59:08 pm »
That's really useful. Many thanks for your input. I will put my thinking cap on again and will keep you informed as to want I end up doing.

Much appreciated.