Book a Demo

Author Topic: Alter the Package Pre-definition  (Read 4604 times)

RJSO

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Alter the Package Pre-definition
« on: June 17, 2008, 12:25:37 am »
Hi!

I'm trying to create an .EAP template that configures my packages the way i want. For example, when i add a new Requirements Model i want to configure and alter the packages and elements that are inside.

In fact what i want to do is something similar to the Package Template feature but with Packages configuration and not only Elements.


Is that possible?

Thanks in advance

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Alter the Package Pre-definition
« Reply #1 on: June 17, 2008, 03:48:33 am »
My guess is that you need to write an add-in. There are two relevant sections in the EA documentation: the EA Object Model and the MDG Add-in model. Don't be fooled by the title of the second one, most or all of that API can be used by any automation project that runs 'inside' EA.

You need to trap the events that occur when you add a new element or double-click an element, anything that would (or could) normally bring up a properties dialog. You would then supply your own dialog and (probably) cancel EA's default behavior (having handled things your way).

[edit]See below for a much cleaner approach.

I was thinking of the case where you don't have a predetermined set of options you want to set, and the user is expected to supply these at runtime each time the template is used. If you don't have this requirement the approach below is best by far.[/edit]
« Last Edit: June 17, 2008, 09:28:41 am by Midnight »
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Alter the Package Pre-definition
« Reply #2 on: June 17, 2008, 05:22:19 am »
Haven't tried it out, but I think the first and easiest thing you can do is make a backup of the <program files>\Sparx Systems\EA\ModelPatterns folder, import the xml files, change the models the way you want, and export them back to the original folder. Make sure to backup your edited models though before you install a new EA version, cause setup will probably overwrite them.

Of course if you want your model templates parameterised (say you want to pop up a dialog or read some homegrown configuration when a model is added), you'll need to use the API to trap events.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Alter the Package Pre-definition
« Reply #3 on: June 17, 2008, 08:18:04 am »
Frank is right that modifying the XML files would be the quickest/easiest way to do it.  Tip. You can see what files correspond to what packages by looking at ModelPatterns\models.xml.   You can also add new packages and groups this way.

For something that you don't need to worry about during an upgrade you should look into MDG technologies.  You'll have to directly edit the MTS file, but the instructions for this are at http://www.sparxsystems.com.au/EAUserGuide/index.html?model_templates2.htm.

RJSO

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Alter the Package Pre-definition
« Reply #4 on: June 18, 2008, 01:31:15 am »
I will try the MDG approach as it seems the more appropriate for my problem. Once again, thanks for the help :)