void (Project project, PsiElement[] fileElements) { for (PsiElement file : fileElements) { if (!clearFileReadOnlyFlags(project, file)) return; } LocalFilesDeleteTask task = new LocalFilesDeleteTask(project, fileElements); ProgressManager.getInstance().run(task); if (task.error != null) { String file = task.error instanceof FileSystemException ? ((FileSystemException)task.error).getFile() : null; if (file != null) { String message = IoErrorText.message(task.error), yes = RevealFileAction.getActionName(), no = CommonBundle.getCloseButtonText(); if (Messages.showYesNoDialog(project, message, CommonBundle.getErrorTitle(), yes, no, Messages.getErrorIcon()) == Messages.YES) { RevealFileAction.openFile(Paths.get(file)); } } else { Messages.showMessageDialog(project, IoErrorText.message(task.error), CommonBundle.getErrorTitle(), Messages.getErrorIcon()); } } if (task.aborted != null) { VfsUtil.markDirtyAndRefresh(true, true, false, task.aborted); } if (!task.processed.isEmpty()) { ApplicationManager.getApplication().runWriteAction(() -> { for (PsiElement fileElement : task.processed) { try { fileElement.delete(); } catch (IncorrectOperationException e) { ApplicationManager.getApplication().invokeLater( () -> Messages.showMessageDialog(project, e.getMessage(), CommonBundle.getErrorTitle(), Messages.getErrorIcon())); } } }); } }