public static void doDelete(@NotNull PsiFile file) throws IncorrectOperationException {
    if (!file.isPhysical()) {
      Consumer<PsiFile> handler = file.getUserData(NON_PHYSICAL_FILE_DELETE_HANDLER);
      if (handler == null) {
        throw new IncorrectOperationException();
      }
      handler.accept(file);
      return;
    }
    
    PsiManagerImpl manager = (PsiManagerImpl)file.getManager();

    VirtualFile vFile = file.getVirtualFile();
    try{
      vFile.delete(manager);
    }
    catch(IOException e){
      throw new IncorrectOperationException(e);
    }
  }
public static void doDelete(@NotNull PsiFile file)