@Override
  public void checkFile(@NotNull PsiFile file,
                        @NotNull InspectionManager manager,
                        @NotNull ProblemsHolder problemsHolder,
                        @NotNull GlobalInspectionContext globalContext,
                        @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
    if (!(file instanceof PsiJavaFile javaFile) || FileTypeUtils.isInServerPageFile(file)) return;
    PsiImportList importList = javaFile.getImportList();
    PsiImportStatementBase[] imports = importList == null ? PsiImportStatementBase.EMPTY_ARRAY : importList.getAllImportStatements();
    int currentEntryIndex = 0;
    for (PsiImportStatementBase importStatement : imports) {
      ProgressManager.checkCanceled();
      // jsp include directive hack
      if (importStatement.isForeignFileImport()) {
        continue;
      }
      int entryIndex = JavaCodeStyleManager.getInstance(javaFile.getProject()).findEntryIndex(importStatement);
      if (entryIndex < currentEntryIndex) {
        // mis-sorted import found
        IntentionAction fix = QuickFixFactory.getInstance().createOptimizeImportsFix(true, javaFile);
        problemsHolder.registerProblem(importList, getDisplayNameText(), new IntentionWrapper(fix));
        return;
      }
      currentEntryIndex = entryIndex;
    }
  }
@Override
  public void checkFile(@NotNull PsiFile file,
                        @NotNull InspectionManager manager,
                        @NotNull ProblemsHolder problemsHolder,
                        @NotNull GlobalInspectionContext globalContext,
                        @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor)