Book a Demo

Author Topic: Save Project Copy with an EA Add In  (Read 3416 times)

flo123

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Save Project Copy with an EA Add In
« on: May 17, 2012, 03:46:09 am »
Hello,

I'm developing an ADD IN for EA. (V9.3).

One of my methods can change the diagrams (modifies all elements).  BEFOR the method is executed I want to give the user the possibility to save a "Project Copy". (like File -> Save Project Copy in EA)

Unfortunately I can't find a EA build-in method, which allows me to make a dump to an .eap file. There is a  project.ExportPackageXMI which only saves the XMI export, the project.SaveDiagramImageToFile just saves the .emf picture of the selected diagram..

I need to save the project copy, so that the user simply can open the old .eap (like someName_old.eap) file when something went wrong.

Thank you for the answers :)

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Save Project Copy with an EA Add In
« Reply #1 on: May 17, 2012, 04:12:06 am »
Hi,

I think the reason for this is that EA doesn't really use a file but a database backend for the repository. The .eap file is nothing more than a MS Access database in disguise. So what you want won't work with EA projects that are based on a server database repository like MySQL, etc. (unless you copy the complete DB on the server).
Anyway, to make it work with an .eap file you could use the name of the file provided in the Repository.ConnectionString property and create a backup of this one using OS board tool methods.
Another approach would be to automatically create a baseline of the project using the CreateBaseline()/CreateBaslineEx() methods from the Project interface class. Thus the user could revert the project to the saved baseline if s.th. went wrong. This approach would work for any type of EA repository (effectively it's an XMI export saved into the repositories' DB).

HTH
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

flo123

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Save Project Copy with an EA Add In
« Reply #2 on: May 17, 2012, 05:34:01 am »
Hello,

thank you for the help. The first approach didn't work out, because I use my SaveFileCopy method with the FileOpen-Event and then the EA process is already reading the file.

The second approach is great! It actually does everything I need and even more (because the user can see the changes the method did)

Thank you.