Bulk vetoing file pre-delete listener?

I'm adding a new feature to my plugin that would optionally propagate file delete events to the server.  I'd prefer to do this by adding a pre-delete listener that asks the user whether the deletes should also occur on the server.  If yes, I'd like to attempt the delete on the server before performing the delete locally.  If the delete fails on the server, I'd like to report that to the user and ask whether the file(s) should be deleted locally or not.

I know I can register a VirtualFileListener or a BulkFileListener that can receive pre-delete events.  The former only gets them one at a time by design.  My hope was that the latter would get all files involved in a delete operation, but when I highlight multiple files in the project view and delete them, it also receives them one at a time.  It looks like this is because VirtualFileDeleteProvider just loops over the files calling file.delete() on each.

So my first question is, can I actually get a single event before the files have been deleted from the file system that tells me all of the files that have been requested for delete?

My second question is, assuming that's possible, how can I effectively "veto" the delete event in that bulk pre-delete listener if for whatever reason my plugin decides that it shouldn't proceed?

Thanks in advance!

Please sign in to leave a comment.