Author Topic: MDG Tech not enabled after EA_OnInitialize  (Read 2091 times)

Jim Lawrence

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
MDG Tech not enabled after EA_OnInitialize
« on: July 07, 2012, 08:52:31 am »
After returning our the xml from our MDG file in an EA_OnInitializeTechnologies event handler, EA does not enable the MDG tech (i.e. the Enabled checkbox is not checked), but the documentation says EA will load and enable it.

I thought there might be a problem with our file, so I copied the SimpleUI.xml file (from EA installation), changed the name and ID and loaded it in our EA_OnInitilizeTechnologies event handler.  I got the same results.  The loaded tech was NOT enabled.  It appears that any MDG tech loaded via addin DLL is never enabled.

Code: [Select]
  public string EA_OnInitializeTechnologies(EA.Repository repository) {
      //string filename = @"C:\Users\<username>\AppData\Roaming\STOMP\stomp.xml";
      string filename = @"C:\Users\<username>\Documents\Visual Studio 2010\Projects\STOMP\xml\stompJL.xml";
      string xml = null;

      if (debug) MessageBox.Show("EA_OnInitializeTechnologies");

      // get the profile data
      xml = File.ReadAllText(filename);

      // return profile data so EA can import it
      return xml;
    }

Any suggestions on how to get EA to enable MDG tech files?

I was expecting an EA_OnPostInitialize event at some point after loading my eap file, but it never occurs.  I thought I might be able to activate my MDG tech here but EA never issues the event.

What are the order of EA events at startup/shutdown?  Where are these documented?  I've been able to determine a few by displaying message boxes in the event handlers.

Jim Lawrence

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: MDG Tech not enabled after EA_OnInitialize
« Reply #1 on: August 07, 2012, 09:04:39 am »
After turning in a bug report on this, it turns out that EA has a "feature" that I had to overcome.  It turns out that in my testing/investigations I had clicked on the enable/disable checkbox for our MDG tech.  It seems that if the user "EVER" enables/disables the MDG tech in the "Settings>MDG Technologies ..." dialog, it adds a techid enable/disable string to the registry at (may vary with your version): HKCU\Software\Sparx Systems\EA400\EA\OPTIONS\MDG_TECHNOLOGY_STATUS
The string is of format: techID=0|1;
This value in the registry will forever more rule the enable/disable capability of your tech.  There is no way for a user to get rid of this string without editing the registry (not something we want a user to mess with).  As we want to make our UML profile and MDG tech the default on startup, I added code to the event handlers to search for and remove the enable/disable string during startup/shutdown.  It doesn't prevent the user from disabling our tech, but is does insure that the next time EA starts, our tech is enabled and made the default tech.

To make your tech the default, write to the same OPTIONS key above, but set key (may vary with your version) MY_TECHNOLOGY to the value of your techid
« Last Edit: August 07, 2012, 09:11:17 am by jiml »