void (final VirtualFile file) { ApplicationManager.getApplication().runWriteAction(() -> { try { file.delete(PruneEmptyDirectoriesAction.class); //noinspection UseOfSystemOutOrSystemErr System.out.println("Deleted: " + file.getPresentableUrl()); } catch (IOException e) { //noinspection HardCodedStringLiteral Messages.showErrorDialog(IdeBundle.message("message.cannot.delete.0.1", file.getPresentableUrl(), e.getLocalizedMessage()), "IOException"); } }); }