I am developing a VCS plugin. I want to provide refactoring facility (move, rename, delete) through the plugin. I extended the VirtualFileAdapter class to hook these operations. However, I am not able to implement it properly. What I want to need is to provide move/rename/delete through the IDE that would update the references in the IDE as well as update the repository.
In the SCM I use, there is a move command available. Given the source and target, this command will move(or rename) the file. Now, this SCM maintains element IDs. So during this move operation, the location of the files have changed, however their IDs remained the same.
I am unable to use both in the source. Say, user moves a file from folder A to folder B. The beforeFileMovement(VirtualFileMoveEvent) function of the VirtualFileAdapter class will be called. Here, if I execute my move command (through CLI), then this function fails as it cannot find the file present in folder A. If I let this function perform the move operation, then my move command will fail to locate the file. The solution to this would be to recopy the destination files back to source and then execute my move command. However, this approach seems ok for one or two files, not in case a folder is moved having many files.
What solution I expect is, obtain the usages of this file(s), get the usages/references to be updated, perform the move operation through the SCM move command (through CLI), then update the references as per the information. Can this be feasible? If so, then I suppose I need a different adapter.