Author Topic: Moving source code breaks synchonization  (Read 617 times)

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Moving source code breaks synchonization
« on: August 20, 2008, 03:09:28 am »
This thread is based on a post elsewhere...

Quote
Hi, I have a problem! I Import Source Directory from C# project, and I make all needed diagrams, but now we make big changes with our project we have different solutions, different folders and I can't make reverse engineering to synchronize packages and I can't see the source code in source code view.
Please  write me if someone have any ideas how to  change source directory, and synchronize source code from new directory and how to see code when I select some of classes! To generate separately all is very time consuming! Thank you for advance  for all suggestions!  
Back to top  

[Repeated below in case the referenced post disappears later.]
Hi, I have a problem! I Import Source Directory from C# project, and I make all needed diagrams, but now we make big changes with our project we have different solutions, different folders and I can't make reverse engineering to synchronize packages and I can't see the source code in source code view.
Please  write me if someone have any ideas how to  change source directory, and synchronize source code from new directory and how to see code when I select some of classes! To generate separately all is very time consuming! Thank you for advance  for all suggestions!  
Back to top
« Last Edit: August 20, 2008, 03:12:43 am by Midnight »
No, you can't have it!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Moving source code breaks synchonization
« Reply #1 on: August 20, 2008, 03:12:52 am »
Valya,

[edit]See Simon's post below. The solution he presents should solve your problem. If not - and only then - feel free to try either of the approaches I suggest.[/edit]

EA stores information about the absolute path to source code in both packages and elements (i.e. classes). When you move source code - such as moving a VS project - you break this link. EA can no longer find the original files, and so it cannot synchronize. In forward engineering EA will generate new files, and in reverse engineering EA will fail to recognize your old code. This can cause duplicate classes and failure to update older code. These symptoms parallel what you are seeing.

There is some information in the forum about how you can correct this. Searching the forum would likely solve your problem, but it might take a while.

Here's a couple of suggestions - from memory; I've not tested them - that might provide you with a fast solution (or show you what you need to do).

Before you try the ideas below make a backup copy of your EA and VS projects.

The first step is to try to 'convince' EA that the project files have moved. You might be able to do this by making a copy of your (new) VS project. Then remove (or rename) the directory tree where you moved your VS project to. [Now the new location is empty.] Use EA to generate (i.e. forward engineer) your old project to the (now empty) location you want to use in future. With any luck this will cause EA to store the new code location in the model.

Now delete the source code you just created (it is the old project anyway) and copy the new VS project back to the desired directory. [At this point you should have your new VS project where you want it, and the EA project pointing to the correct location. Now try to reverse engineer (and synchronize) the project.

Hopefully the above procedure will solve your problem.

If it does not...

Try exporting the old EA project to XMI. Examine the packages and classes to see where and how (i.e. in what format) the source code path is stored. Now use a good editor or XML tool to change the path information to your new VS project and file paths.

Import the XMI into a copy of your EA project. Do not strip GUIDs, since you want to replace the old elements with the new ones (thus updating the paths). Now try reverse engineering.

Please post back to let us know if you succeeded.

David
« Last Edit: August 20, 2008, 11:32:43 pm by Midnight »
No, you can't have it!

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6215
  • Karma: +49/-5
    • View Profile
Re: Moving source code breaks synchonization
« Reply #2 on: August 20, 2008, 08:27:54 am »
In order to get EA to update the existing classes you will need to update the filename of each class.  This can be done using the dockable properties window.  (View | Properties)
 
A bulk update of class filenames when a directory path has changed can be made using local paths (See http://www.sparxsystems.com.au/EAUserGuide/index.html?localpaths.htm) as follows.
 
Open the local paths dialog. (Settings | Local Paths) In the path field enter the path that EA currently thinks your files are at, or part of it.
In the ID field enter something like "Source_Path".
In the type field select your source code language.
Click "Apply Path"
This will substitute the path you entered for the ID in all classes containing that path.
Edit the path field to your new path.
EA will now find the files in their new paths.
If you want to you can now click "Expand Path" and then delete that path.
That will remove the relative paths that were created before, setting them back to absolute paths.
Simon

support@sparxsystems.com

valya

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Moving source code breaks synchonization
« Reply #3 on: August 21, 2008, 12:08:38 am »
thank you :) I try with XMI, than change path and it works :) thank you very much :) David