Author Topic: MDG C# Addin -> PreGenerate issue  (Read 1064 times)

dschmid2

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
MDG C# Addin -> PreGenerate issue
« on: August 11, 2009, 10:15:07 pm »
I use the MDG_PreGenerate and MDG_PostGenerate methods to add some flexibility on how C++ files are generated.

In PreGenerate I copy the Cpp and Hpp files to .bak files.
In PostGenerate I do some cleanup stuff.

In the PostGenerate call I get the Filename as an argument which is very practical. But in the PreGenerate call, there is only the PackageGuid, which is passed. I have to manually find the selected object, or verify if there are multiple objects in a selection on the current diagram.

What is annoying aswell is that the PreGenerate is called as many times as classes are selected in my diagram, and surely always with the same PackageGuid.

It would be better if the ElementGUID would be passed... or is there a simple way to find out which element(s) are generated?
Using EA 9.1.909 on Win7, C++ Code Generation

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: MDG C# Addin -> PreGenerate issue
« Reply #1 on: August 11, 2009, 10:21:06 pm »
Would one of the Context calls give you this information?
No, you can't have it!

dschmid2

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: MDG C# Addin -> PreGenerate issue
« Reply #2 on: August 11, 2009, 11:22:21 pm »
There is GetContextObject/GetContextItem which give me the currently selected object.
In case of multiple selected objects, it gives me the first object in the selection, which i consider actually as a bug! it should return a collection of objects...
Using EA 9.1.909 on Win7, C++ Code Generation

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: MDG C# Addin -> PreGenerate issue
« Reply #3 on: August 12, 2009, 06:35:48 am »
Yes, definitely. I suggest you submit a bug report on this to Sparx. You can use the Report a Bug link at the bottom of any forum page. If you want to attach an example and have registered EA, click the Registered Users link at the top of any forum page instead. Then click the appropriate link near the top of that page. The registered version of the bug report is the same as the 'general' one, but also allows you to attach a file.
No, you can't have it!