Hello everyone!
I have installed subclipse 1.2.0 and writing own plugins for Eclipse. One of those plugins need to know when a file is moved around. So I wrote a IResourceChangeListener and asked the IResourceDelta if the IResource have been moved. This works fine, but not with SVN-projects. It seemes, that the MOVED_FROM and MOVED_TO flags are lost, when a resource is unmanaged. Moving managed resources works fine (moving it back results in lost flags again).
So I debugged and tried and after 2 days I found some lines at moveFile-Method of the SVNMoveDeleteHook:
if (SVNWorkspaceRoot.getSVNFileFor(source).getStatus()
.isAdded()) {
//can't move a file that's in state added, so copy to new
// location
//remove old location, add new location
//fix for issue 87 <http://subclipse.tigris.org/issues/show_bug.cgi?id=87> -mml
source.copy(destination.getFullPath(), updateFlags, monitor);
svnClient.addFile(destination.getLocation().toFile());
svnClient.remove(
new File[] { source.getLocation().toFile() }, true);
tree.deletedFile(source);
} else {
svnClient.move(source.getLocation().toFile(), destination
.getLocation().toFile(), true);
}
//movedFile must be done before endOperation because
// destination file must not already exist in the workspace
// resource tree.
tree.movedFile(source, destination);
destination.refreshLocal(IResource.DEPTH_ZERO, monitor);
At a first look this seems to be ok, but when you look at the IResourceTree.movedFile() method you'll find the line:
if (!source.exists())
return;
The movedFile method is responsible for moving Properties, Markers and setting NodeIDs (which is telling Eclipse where a Resource is moved at or from).
regards from Germany,
Steve Ulrich
Entwicklung Personalwesen
CSS GmbH
Justus-Liebig-Str. 2-4
36093 Künzell/Fulda
Germany
Internet: <http://www.css.de/> http://www.css.de <http://www.css.defon/>
Fon: +49 (0)661 9392-58
Fax: +49 (0)661 9392-70
Email: Steve.Ulrich@css.de
Sitz der Gesellschaft: Künzell
Handelsregister: Amtsgericht Fulda, HRB 838
Geschäftsführer: Michael Friemel, Armin Prinz
Received on Wed Mar 21 15:21:00 2007