File moving problem in VirtualFileAdapter from openapi IDEA 7.0.3

Hi, I've got one problem. I need to capture event that performs the file's movement. So, I call Move from Refactor menu in IDEA, and after that select the destination directory, when I click OK... I'm taken to VirtualFileAdapter method called void beforeFileMovement(VirtualFileMoveEvent event)... but when I'm in a debug in this method I can see in my file system that my file is already moved to the destination folder. Why? As far as I understand this method must be called before the file will be moved.... Am I doing something wrong?

2 comments
Comment actions Permalink

Hello ALincoln,

Hi, I've got one problem. I need to capture event that performs the
file's movement. So, I call Move from Refactor menu in IDEA, and after
that select the destination directory, when I click OK... I'm taken to
VirtualFileAdapter method called void
beforeFileMovement(VirtualFileMoveEvent event)... but when I'm in a
debug in this method I can see in my file system that my file is
already moved to the destination folder. Why? As far as I understand
this method must be called before the file will be moved.... Am I
doing something wrong?


No, you aren't. The beforeFileMovement event is now fired before the move
event is recorded in the IntelliJ IDEA virtual file system, which processes
actual changes happening on disk asynchronously. Thus, by the time you get
this event in IDEA, the disk is already in the new state, but the VFS is
in the old state.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Thanks for the response...

I think I should use LocalFileOperationsHandler instead of VirtualFileAdapter to handle that...in such way I can handle the local file systems operations..

0

Please sign in to leave a comment.