Starting with a running instance of EA and an empty project opened (consisting only of an empty root node), I am trying to write a simple script to import a full EA project from a .xmi file. I know it can be done easily with the GUI but I need to use that functionality for another problem.
When I import a .xmi of an EA project with the GUI I get a message saying
'XMI contains a Model which may be placed at the root level in the Project Browser. Press Yes to import as Root Model, No to place under selected package'
and can choose to do this. (The .xmi file has been created by exporting a project from EA to .xmi)
When I run the script (see below) it seems to choose one of the options, depending on what I don't know. Mostly the one that puts the root node of the imported project under the already existing empty root. So the project structure is muddled.
Here's the script:
repo = eaApp.Repository
root = repo.Models[0]
projectInterface = repo.GetProjectInterface()
newPkgGUID = projectInterface.ImportPackageXMI(root.PackageGUID, XMISourcePath, 1, 1) # actual import
What I basically want to do is I always want to put the root node of the imported project at root level, but there seems to be no access to the dialogue that pops up when operating from the GUI.
Any suggestions for this problem?
The script is written in Python.