Prevent from deleting a PsiFileSystemItem
Answered
I have a PsiFileSystemItem class that overrides the ‘delete’ and ‘checkDelete’ method as below. Though it prompt error message, it still be deleted from disk. How to prevent deleting?
public class MyClass implements PsiFileSystemItem {
@Override
public void delete() throws IncorrectOperationException {
throw new UnsupportedOperationException("Cannot delete");
}
@Override
public void checkDelete() throws IncorrectOperationException {
throw new UnsupportedOperationException("Cannot delete");
}
}
Please sign in to leave a comment.
Hi,
Please provide a minimal reproducible sample, a project we can test it on, and steps to reproduce.