private void applyOrScheduleRequiredIndex(ID<?, ?> indexId,
                                            UnindexedFileStatusBuilder fileStatusBuilder,
                                            IndexedFileImpl indexedFile,
                                            int inputId,
                                            @NotNull FileIndexingStamp indexingStamp) {
    if (FileBasedIndexScanUtil.isManuallyManaged(indexId)) return;
    if (!RebuildStatus.isOk(indexId)) {
      fileStatusBuilder.mayMarkFileIndexed = false;
      return;
    }

    try {
      FileIndexingState fileIndexingState = myFileBasedIndex.getIndexingState(indexedFile, indexId, indexingStamp);
      if (fileIndexingState == FileIndexingState.UP_TO_DATE && myShouldProcessUpToDateFiles) {
        fileIndexingState = processUpToDateFileByInfrastructureExtensions(indexedFile, inputId, indexId, fileStatusBuilder, indexingStamp);
      }
      if (fileIndexingState.updateRequired()) {
        if (FileBasedIndexEx.doTraceStubUpdates(indexId)) {
          FileBasedIndexImpl.LOG.info(
            "Scheduling indexing of " + indexedFile.getFileName() + " by request of index; " + indexId +
            (fileStatusBuilder.indexInfrastructureExtensionInvalidated ? " because extension invalidated;" : "") +
            ("indexing state = " + fileIndexingState));
        }

        fileStatusBuilder.addUnindexedState(fileIndexingState, indexId);

        if (!tryIndexWithoutContent(indexedFile, inputId, indexId, fileStatusBuilder)) {
          // NOTE! Do not break the loop here. We must process ALL IDs and pass them to the FileIndexingStatusProcessor
          // so that it can invalidate all "indexing states" (by means of clearing IndexingStamp)
          // for all indexes that became invalid. See IDEA-252846 for more details.
          fileStatusBuilder.shouldIndex = true;
        }
      }
    }
    catch (RuntimeException e) {
      final Throwable cause = e.getCause();
      if (cause instanceof IOException || cause instanceof StorageException) {
        LOG.info(e);
        myFileBasedIndex.requestRebuild(indexId, cause);
      }
      else {
        throw e;
      }
    }
  }
private void applyOrScheduleRequiredIndex(ID<?, ?> indexId,
                                            UnindexedFileStatusBuilder fileStatusBuilder,
                                            IndexedFileImpl indexedFile,
                                            int inputId,
                                            @NotNull FileIndexingStamp indexingStamp)