AlfActionUtil.importFrom is a static method that takes a directory path (as a string) and a file name, and carries out the functionality of the Import From > Alf File command (see Importing Alf). That is, it does the following:

  1. If there is no Project currently open, it creates a new Project using the Alf project template and makes it the active Project.
  2. It imports the given file into the currently active Project, with progress status, in a MagicDraw session.
  3. It marks the active Project as dirty (but does not save it or close it).

When the method completes, it is safe to continue to perform Alf compiler operations on the Project. Any parsing, constraint checking or mapping errors (but not IO exceptions) are reported to the MagicDraw Message Window.

AlfActionUtil.importFrom(modelDirectory, modelFileName);