Book a Demo

Author Topic: Extensions not available when starting EA from API  (Read 5485 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Extensions not available when starting EA from API
« on: August 19, 2013, 05:05:23 pm »
Hi there!


I want to open EA from inside a stand-alone application (not from an Add-In). I create a Repository, call OpenFile(), then ShowWindow(). EA opens up fine, I can do stuff in the repository, but where are my extensions?

I'm using 10.0.1008 Ultimate, with a single third-party Add-In (one of my own).
The usual MDG Technologies (GML, Publish, etc) are absent from the Extensions menu, and in the Manage Add-Ins dialog, my Add-In has status Error.

Everything works as expected when opening the same repository using the EA application.

I've also tried creating an App object instead of the Repository object, but got the same results - no extensions.

What am I missing?

Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Extensions not available when starting EA from
« Reply #1 on: August 19, 2013, 05:11:23 pm »
Addins are not loaded at all when EA is created from the API.

MDG technologies should still be available.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Extensions not available when starting EA from
« Reply #2 on: August 19, 2013, 05:37:51 pm »
OK, thanks. I'll double-check MDG Tech availability tonight.

Meantime, is there a way to force loading of (all or specific) Add-Ins?

/Uffe
My theories are always correct, just apply them to the right reality.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Extensions not available when starting EA from
« Reply #3 on: August 20, 2013, 02:32:13 am »
Yes, sorry, the MDG Techs are all there. It's just the Add-Ins that are unavailable.

So is there a way to force loading of Add-Ins?
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Extensions not available when starting EA from
« Reply #4 on: August 20, 2013, 08:44:52 am »
Not in the current version of EA.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Extensions not available when starting EA from
« Reply #5 on: August 20, 2013, 08:57:05 am »
You could open EA manually and access the running application instead of creating it via automation.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Extensions not available when starting EA from
« Reply #6 on: August 26, 2013, 06:02:54 pm »
Uffe,

A workaround might be to let your operating system launch EA from a .eap file and then attach your code to the running application.

The code below does just that (for any filename given)
Code: [Select]
       /// <summary>
        /// asks the operating system to open the file at the given location with the standard application for this type of file.
        /// (the same thing happens when you doubleclick the file)
        /// </summary>
        /// <param name="fullFileName">the full name of the file</param>
        public static void openFileWithAssociatedEditor(string fullFileName)
        {
            //open the file with the associated editor
            using (Process process = new Process())
            {
                process.StartInfo.FileName = fullFileName;
                try
                {
                    process.Start();
                }
                catch (Win32Exception ex)
                {
                    // no editor associated yet with the .postcondition extension.
                    // let the user choose his preferred editor.
                    if (ex.ErrorCode == -2147467259)
                    //ErrorCode for No application is associated with the specified file for
                    //this operation
                    {
                        ProcessStartInfo openWithInfo = new
                        ProcessStartInfo(@"C:\WINDOWS\system32\rundll32.exe");
                        openWithInfo.Arguments = @" C:\WINDOWS\system32\shell32.dll, OpenAs_RunDLL " + fullFileName;
                        process.StartInfo = openWithInfo;
                        process.Start();
                    }
                }

            }
        }

Connecting to the running instance (connects to the instance that was first started up in case of multiple running intances)
Code: [Select]
           object obj = Marshal.GetActiveObject("EA.App");
            EA.App eaApp = obj as EA.App;

Geert