monostop
monostop

Reputation: 569

Moving diagrams between projects in enterprise architect

I have a project with several diagrams (with elements). I want to close this particular project and move the diagrams to other more suitable projects.

Moving a diagram is simple. Problem is that now I have to manually find all related element to this particular diagram and move them one by one to the other project. As I have quite a few elements in all diagrams in the original project this is quite tedious.

I wonder if there's an easier way of handling refactoring like this in EA?

Upvotes: 5

Views: 6433

Answers (5)

Srdjan
Srdjan

Reputation: 163

In the latest version of Enterprise Architect (I'm using v16) it's easy to copy whole package and than paste it into new project (eapx). But, it's mandatory to have diagram within a package, so if it is not the case, you should previously create one "dummy" or "test" for copy purposes.

  1. Right click on the package containing diagram and copy whole package using this option in the menu (Copy -> Full Structure for Duplication):

enter image description here

  1. Paste the package into your project. Good news: if the target project contains a package with the same name, the "...- Copy" will be created automatically.

  2. After this, you can copy desired diagram from one package into another one.

Upvotes: -1

Waleed Alharbi
Waleed Alharbi

Reputation: 1

  1. Right Click on Diagram you want to duplicate in other project
  2. Copy / Paste
  3. Copy to Clipboard
  4. Full Structure for Duplication

you can paste it when you navigate to the right folder or Model in the other project.

Upvotes: -2

Vaishakh
Vaishakh

Reputation: 69

This might help:

FOR EA VERSION 15

Project 1 - from where you want to copy a diagram

  1. Do a Ctrl+A (select all) on your diagram.
  2. Publish -> Save -> Save to Clipboard.

Project 2 - where the diagram will be pasted

  1. Create an empty diagram.
  2. Right-Click (on the empty diagram) -> Paste -> Image from Clipboard

FOR EA VERSION 10

Project 1 - from where you want to copy a diagram

  1. Do a Ctrl+A (select all) on your diagram.
  2. Edit -> Project Clipboard -> Add to Project Clipboard.

Project 2 - where the diagram will be pasted

  1. Create an empty diagram.
  2. Edit -> Paste Image from Clipboard.

This will copy the diagram as a whole image (single component) and I think you will not be able to change the actual components of the diagram once it is pasted in the new project.

Upvotes: -1

Youssef NAIT
Youssef NAIT

Reputation: 1530

You can also try to put you diagramme inside a package and then export it to XML file and import it from the destination project.

Upvotes: 1

Uffe
Uffe

Reputation: 10504

There is no easier way in out-of-the-box EA, no. But where there's a will there's a way.

First off, make a copy of your project. The solution I'm describing will destroy its structure.

Second, create an empty package and move the diagram there.

Third, create a VBScript in the Browserscript group (Tools - Scripting). Call it "Collect Diagram Elements". In the editor, replace the commented-out otDiagram case with the following:

case otDiagram
    ' Code for when a diagram is selected
    dim theDiagram as EA.Diagram
    set theDiagram = Repository.GetTreeSelectedObject()
    dim dObj as EA.DiagramObject
    dim element as EA.Element
    for each dObj in theDiagram.DiagramObjects
        set element = Repository.GetElementByID(dObj.ElementID)
        element.PackageID = theDiagram.PackageID
        element.Update()
    next

This script runs through all the elements shown in a diagram and moves them to the package the diagram is in.

Run the script by right-clicking the diagram in the package browser and selecting Scripts - Collect Diagram Elements. After the script finishes, you may need to reload the package (right-click the package in the package browser, select Contents - Reload Current Package).

Finally, export the package to XMI (right-click in the package browser, select Import/Export - Export Package to XMI File), and then import it into your target project.

Upvotes: 5

Related Questions