Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conveniently move a class to a different package in eclipse without borking svn

When moving a file from old.package to new.package I want two things to happen:

  1. Update all references to that class (in all files of the project) so that the new package is used
  2. svn move old/package/Foo.java new/package/Foo.java

I use subversive within Eclipse Ganymede. When I just drag the file from one package to the other, all references get updated and the file is moved around on the filesystem. But SVN is unaware of this and therefore the svn move old/package/foo.java new/package/Foo.java command does not work (obviously) when old/package/Foo.java does not exist (because eclipse has moved it already).

Is there a way to have eclipse do it's refactoring but using svn to move the file on the filesystem? I hope I'm just missing something obvious :-)

like image 800
Schneehenry Avatar asked Jan 07 '09 11:01

Schneehenry


3 Answers

I use Subclipse and it does support moving files between packages

like image 186
Yuval Adam Avatar answered Nov 20 '22 04:11

Yuval Adam


I've been experimenting, and think I've found the way:

1) Tortoise-move the file using the right-click-drag context menu (or whatever SVN method you want).

2) Use the windows filesystem to move it back.

3) Drag-move the file in Eclipse to update all the references.

4) Commit - it shows as a delete/add, but it saves the history, and it does change the package references in one commit (keeping each commit buildable).

Old question, but I keep returning to it, so this is my documentation!

like image 29
orbfish Avatar answered Nov 20 '22 04:11

orbfish


Yuval's right. This sounds like a (very unfortunate!) deficiency in Subversive. (having no experience with Subversive I can't say for sure) Subclipse definitely handles this properly by hooking into the right APIs in Eclipse.

like image 1
John Stoneham Avatar answered Nov 20 '22 05:11

John Stoneham