Book a Demo

Author Topic: Refactor: Rename javapackage and synchronize model  (Read 4194 times)

armin

  • EA User
  • **
  • Posts: 63
  • Karma: +0/-0
  • mission possible
    • View Profile
Refactor: Rename javapackage and synchronize model
« on: April 05, 2007, 05:44:31 am »
Hi,

we used our ide to rename a java package. After that the packenames of all classes inside this package were updated. After that we changed the packagename in EA and tried to synchronize model whith code. It was not possible because EA looks for the java files in the directory with the old packagename.
How it is possible to synchronize model with code after renaming a package?

Thanx for help and happy easter

Armin


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Refactor: Rename javapackage and synchronize m
« Reply #1 on: April 05, 2007, 09:21:28 am »
I think I remember seeing something in the forum along these lines - possibly not specific to Java - quite a while ago. You might be successful in some diligent searching. Namespaces might also have been discussed in the same thread.

NOTE: I could be completely wrong about this; it just seems to ring a bell.

If I'm correct, the end result was that there were some serious limitations on how well package-level round trips were handled by EA. Or, perhaps there was a direction in which it worked to some extent, but that it (the renaming) could not be done in the other direction.

Sorry I cannot be more specific about this. I do little work in this area, so don't have enough reason to expend time searching for this.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Refactor: Rename javapackage and synchronize m
« Reply #2 on: April 09, 2007, 12:57:01 pm »
EA uses the filename of a class to determine if it should synchronize. So you'll need to change the filename of all classes in that package.

You can do this in bulk using Local Paths as follows.

Open the local paths dialog. (Configuration | 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.

armin

  • EA User
  • **
  • Posts: 63
  • Karma: +0/-0
  • mission possible
    • View Profile
Re: Refactor: Rename javapackage and synchronize m
« Reply #3 on: April 15, 2007, 11:37:17 pm »
Thank you for this workaround. It works fine! Nevertheless I think it would be very usefull if EA would offer a way to take into account the package structure when synchronize model with code.

Armin

LM

  • Guest
Re: Refactor: Rename javapackage and synchronize m
« Reply #4 on: October 19, 2007, 02:33:21 am »
For some reasons Local Path doean't work for me. I have tried to use it following simons's steps, but it always said "Process compete! 0 records affected"

My steps:
Open Local Path dialog
Path: set local path where my initially generated files
stored (C:\Test\EA\2\22)
ID: Source_Path
Press "Apply Path"

What am I doing wrong?

Thank you,
L

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Refactor: Rename javapackage and synchronize m
« Reply #5 on: October 19, 2007, 03:13:46 am »
Hello simonm,

do you mean Settings | Local Paths

not Configuration | Local Paths, do you?

Regards

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Refactor: Rename javapackage and synchronize m
« Reply #6 on: October 21, 2007, 01:00:01 pm »
LM, make sure the language used for the local path matches the language of your classes.

Yes, sorry.  My FAQ for this situation that I copied needed updating.

LM

  • Guest
Re: Refactor: Rename javapackage and synchronize m
« Reply #7 on: October 24, 2007, 01:39:36 am »
Thank you,
It works now and I believe I better understand how "Local Path" works. It makes text substitute in project file (.eap). The first step is to replace absolute path (like c:\Myfolder) to  ID (like %MyID%) in every file name in .eap file. Then it always uses value of %MyID% as a path.
But what is “Version Control” in “Type” field and hot is can be used?

LM

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Refactor: Rename javapackage and synchronize m
« Reply #8 on: October 24, 2007, 03:41:53 am »
Quote
...But what is “Version Control” in “Type” field and hot is can be used?

Remember that EA can be used with several third-party version control systems. This setting is likely relevant in these scenarios.
No, you can't have it!