Is there a way to prevent a folder from being deleted?

I'm creating a new language plugin and I want to use a fixed folder structure:

<root folder>
\ classes
\ triggers
\ components
\ pages

Each of these folders is added to the Module as a source folder by the Module Builder.

I don't want the user to be able to delete the fixes folders (classes, triggers, components, pages).
I've had a look at the VirtualFileListener interface - which would allow me to listen for delete events - but the methods are all void return, so I'm not sure if I can veto a delete request.

Any help is appreciated!

1 comment
Comment actions Permalink

The VFS reflects the actual state of the local file system, and there is no way for IntelliJ IDEA to prevent a folder in the file system from being deleted. Because of this, there is no veto possibility in the VFS event listeners. If you require the folders to be there, the only solution is to recreate them if they get deleted.


Please sign in to leave a comment.