Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Thiyagaraj A on February 20, 2008, 04:04:01 pm

Title: Adding elements into diagrams from MDG Technology?
Post by: Thiyagaraj A on February 20, 2008, 04:04:01 pm
I am having a MDG technology imported.
Is it possible to take an element from the technology and add it to the diagram without users drag and drop. That means, when a user clicks an AddIn menu option we should be enable to take an element from the technology and draw it in the diagram.
Title: Re: Adding elements into diagrams from MDG Technol
Post by: Frank Horn on February 20, 2008, 07:26:39 pm
I think it's just like adding a standard element to a diagram. You can give it a stereotype, and if that stereotype is one from your technology, than it's an element from your technology.

Unfortunately EA automation seems to do nothing else there. The new element will not have the tagged values defined in the profile. I guess you would have to add them by code in your AddIn.

I'm facing a similar problem: I'm writing an import for my pre-EA XML files which is to populate a package with elements defined in a profile within an MDG technology. So how do I create the tagged values? If I do it the hardcoded way, I will have duplicate logic. So what I will probably do is read the MDG XML file myself from within the AddIn and look up (with XPath expressions) which tagged values are defined for a stereotype. Would be much easier of course if EA created the tagged values no matter where the element comes from.

Maybe some of the old hands have better ideas.
Title: Re: Adding elements into diagrams from MDG Technol
Post by: «Midnight» on February 20, 2008, 11:58:50 pm
You can do this with an MDG Technology, but (I think) you have to load it the 'new' way.

There's a note in the ImportTechnology (I think that's it) documentation with a pointer to EA_OnInitializeTechnologies in the MDG add-in section. Sparx has confirmed that the MDG event call is the way to go from EA 7.0 onwards.

See if that works for you.

David

[BTW, make sure your technology is 'active' by either selecting it in the main menu drop-down or setting it active on the Settings | MDG Technologies dialog. I suspect (without proof) this might affect your success with tagged values. As far as shape scripts go, I suspect (again without proof) that the somewhat older functionality of the stereotypes dialog is more forgiving (or less discerning) and will render the script regardless; this could easily fool you (certainly me) into thinking I'd added my profile stereotype when I really had not. Test this by typing your stereotype in by hand when your profile is loaded but not active.]
Title: Re: Adding elements into diagrams from MDG Technol
Post by: Eve on February 21, 2008, 07:58:00 am
Quote
Sparx has confirmed that the MDG event call is the way to go from EA 7.0 onwards.

That or a file.  See http://www.sparxsystems.com.au/EAUserGuide/index.html?deploying_mdg_technologies.htm
Title: Re: Adding elements into diagrams from MDG Technol
Post by: Frank Horn on March 14, 2008, 06:51:03 pm
Quote
I think it's just like adding a standard element to a diagram. You can give it a stereotype, and if that stereotype is one from your technology, than it's an element from your technology.

Unfortunately EA automation seems to do nothing else there. The new element will not have the tagged values defined in the profile. I guess you would have to add them by code in your AddIn.

Just to update this, in case somebody finds this thread and thinks there is no easy way to add the tagged values defined in an MDG profile to elements created via automation. It turned out there's an "undocumented feature":

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1205431696/0#4