Reputation: 569
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
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.
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.
After this, you can copy desired diagram from one package into another one.
Upvotes: -1
Reputation: 1
you can paste it when you navigate to the right folder or Model in the other project.
Upvotes: -2
Reputation: 69
This might help:
FOR EA VERSION 15
Project 1 - from where you want to copy a diagram
Project 2 - where the diagram will be pasted
FOR EA VERSION 10
Project 1 - from where you want to copy a diagram
Project 2 - where the diagram will be pasted
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
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
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