public void runInspection(final @NotNull AnalysisScope scope,
                            final @NotNull InspectionManager manager,
                            final @NotNull GlobalInspectionContext globalContext,
                            final @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
    globalContext.getRefManager().iterate(new RefVisitor() {
      @Override public void visitElement(@NotNull RefEntity refEntity) {
        if (!globalContext.shouldCheck(refEntity, GlobalInspectionTool.this)) return;
        if (!isInScope(refEntity)) return;
        CommonProblemDescriptor[] descriptors = checkElement(refEntity, scope, manager, globalContext, problemDescriptionsProcessor);
        if (descriptors != null) {
          problemDescriptionsProcessor.addProblemElement(refEntity, descriptors);
        }
      }

      private boolean isInScope(@NotNull RefEntity refEntity) {
        if (refEntity instanceof RefElement) {
          SmartPsiElementPointer pointer = ((RefElement)refEntity).getPointer();
          if (pointer != null) {
            VirtualFile virtualFile = pointer.getVirtualFile();
            if (virtualFile != null && !scope.contains(virtualFile)) return false;
          }
          else {
            RefEntity owner = refEntity.getOwner();
            return owner == null || isInScope(owner);
          }
        }
        if (refEntity instanceof RefModule) {
          return scope.containsModule(((RefModule)refEntity).getModule());
        }
        return true;
      }
    });
  }
public void runInspection(final @NotNull AnalysisScope scope,
                            final @NotNull InspectionManager manager,
                            final @NotNull GlobalInspectionContext globalContext,
                            final @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor)