diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index ebfc53cf79c3..8f989c674963 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -390,13 +390,12 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp tool.inspectionStarted(inspectionManager, this, getPresentation(toolWrapper)); } - final boolean headlessEnvironment = ApplicationManager.getApplication().isHeadlessEnvironment(); final Map map = getInspectionWrappersMap(localTools); final BlockingQueue filesToInspect = new ArrayBlockingQueue(1000); final Queue filesFailedToInspect = new LinkedBlockingQueue(); // use original progress indicator here since we don't want it to cancel on write action start - Future future = startIterateScopeInBackground(scope, localScopeFiles, headlessEnvironment, filesToInspect, progressIndicator); + Future future = startIterateScopeInBackground(scope, localScopeFiles, filesToInspect, progressIndicator); Processor processor = new Processor() { @Override @@ -522,7 +521,6 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp @NotNull private Future startIterateScopeInBackground(@NotNull final AnalysisScope scope, @Nullable final Collection localScopeFiles, - final boolean headlessEnvironment, @NotNull final BlockingQueue outFilesToInspect, @NotNull final ProgressIndicator progressIndicator) { return ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { @@ -542,7 +540,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp public Document compute() { if (getProject().isDisposed()) throw new ProcessCanceledException(); PsiFile psi = PsiManager.getInstance(getProject()).findFile(file); - Document document = psi == null ? null : shouldProcess(psi, headlessEnvironment, localScopeFiles); + Document document = psi == null ? null : shouldProcess(psi, localScopeFiles); if (document != null) { psiFile[0] = psi; } @@ -578,15 +576,11 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp }); } - private Document shouldProcess(@NotNull PsiFile file, boolean headlessEnvironment, @Nullable Collection localScopeFiles) { + private Document shouldProcess(@NotNull PsiFile file, @Nullable Collection localScopeFiles) { final VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return null; if (isBinary(file)) return null; //do not inspect binary files - if (myView == null && !headlessEnvironment) { - throw new ProcessCanceledException(); - } - if (LOG.isDebugEnabled()) { LOG.debug("Running local inspections on " + virtualFile.getPath()); } @@ -847,7 +841,6 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp @NotNull final Project project, @Nullable final Runnable postRunnable, @Nullable final String commandName) { - setCurrentScope(scope); final int fileCount = scope.getFileCount(); final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); final List lTools = new ArrayList();