private void asyncCheckErrors(@NotNull final Collection<VirtualFile> files, @NotNull final Consumer<Boolean> errorsFoundConsumer) { ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { @Override public void run() { final boolean errorsFound = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() { @Override public Boolean compute() { for (VirtualFile file : files) { if (PsiErrorElementUtil.hasErrors(myProject, file)) { return true; } } return false; } }); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { errorsFoundConsumer.consume(errorsFound); } }, ModalityState.any()); } }); }
private void asyncCheckErrors(@Nonnull final Collection<VirtualFile> files, @Nonnull final Consumer<Boolean> errorsFoundConsumer) { ApplicationManager.getApplication().executeOnPooledThread(() -> { final boolean errorsFound = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() { @Override public Boolean compute() { for (VirtualFile file : files) { if (PsiErrorElementUtil.hasErrors(myProject, file)) { return true; } } return false; } }); ApplicationManager.getApplication().invokeLater(() -> errorsFoundConsumer.consume(errorsFound), ModalityState.any()); }); }
private boolean isPsiFileHasErrors(Project project, PsiFile psiFile) { if (getStorage(project).isEnabled(noActionIfCompileErrors)) { return !PsiErrorElementUtil.hasErrors(project, psiFile.getVirtualFile()); } return true; }