private Document shouldProcess(@NotNull PsiFile file,
                                 boolean headlessEnvironment,
                                 @Nullable Collection<? super VirtualFile> localScopeFiles) {
    VirtualFile virtualFile = file.getVirtualFile();
    if (virtualFile == null) return null;
    if (isBinary(file)) return null; //do not inspect binary files

    if (myViewClosed && !headlessEnvironment) {
      throw new ProcessCanceledException();
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("Running local inspections on " + virtualFile.getPath());
    }

    if (SingleRootFileViewProvider.isTooLargeForIntelligence(virtualFile)) return null;
    if (localScopeFiles != null && !localScopeFiles.add(virtualFile)) return null;
    if (!ProblemHighlightFilter.shouldProcessFileInBatch(file)) return null;

    return PsiDocumentManager.getInstance(getProject()).getDocument(file);
  }
private Document shouldProcess(@NotNull PsiFile file,
                                 boolean headlessEnvironment,
                                 @Nullable Collection<? super VirtualFile> localScopeFiles)