@Override
  public ProblemDescriptor @Nullable [] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
    if (InjectedLanguageManager.getInstance(file.getProject()).isInjectedFragment(file)) return null;
    if (!file.isPhysical()) return null;
    FileViewProvider viewProvider = file.getViewProvider();
    if (viewProvider.getBaseLanguage() != file.getLanguage()) return null;
    VirtualFile virtualFile = file.getVirtualFile();
    if (virtualFile == null) return null;
    FileType fileType = virtualFile.getFileType();
    if (fileType != PlainTextFileType.INSTANCE) {
      return null;
    }
    if (PlainTextFileType.INSTANCE.getDefaultExtension().equals(virtualFile.getExtension())) {
      return null;
    }
    FileType assigned = FileTypeManager.getInstance().getFileTypeByFileName(virtualFile.getNameSequence());
    if (assigned != PlainTextFileType.INSTANCE) {
      return null;
    }

    LocalQuickFix removeFix = new LocalQuickFix() {
      @Nls
      @NotNull
      @Override
      public String getFamilyName() {
        return InspectionsBundle.message("reassigned.to.plain.text.inspection.fix.remove.name");
      }

      @Override
      public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
        ((FileTypeManagerImpl)FileTypeManager.getInstance()).removePlainTextAssociationsForFile(descriptor.getPsiElement().getContainingFile().getName());
      }

      @Override
      public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) {
        return IntentionPreviewInfo.EMPTY;
      }
    };
    LocalQuickFix editFix = new LocalQuickFix() {
      @Nls
      @NotNull
      @Override
      public String getFamilyName() {
        return InspectionsBundle.message("reassigned.to.plain.text.inspection.fix.edit.name");
      }

      @Override
      public boolean startInWriteAction() {
        return false;
      }

      @Override
      public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
        editFileType(project, PlainTextFileType.INSTANCE);
      }
    };
    ProblemDescriptor descriptor = manager.createProblemDescriptor(file, InspectionsBundle.message("reassigned.to.plain.text.inspection.message"), new LocalQuickFix[]{removeFix, editFix},
                                                                   ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                                   true, false);
    return new ProblemDescriptor[]{descriptor};
  }
@Override
  public ProblemDescriptor @Nullable [] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly)