@Override
  public @Nullable String getErrorMessage(@NotNull Project project, @NotNull VirtualFile file) {
    final Module module = ModuleUtilCore.findModuleForFile(file, project);
    if (module != null && !module.isDisposed()) {
      final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
      if (sdk == null) {
        if (ModuleRootManager.getInstance(module).isSdkInherited()) {
          return JavaUiBundle.message("project.sdk.not.defined");
        }
        else {
          return JavaUiBundle.message("module.sdk.not.defined");
        }
      }
      else if (SdkDownloadTracker.getInstance().isDownloading(sdk)) {
        return null;
      }
      else if (sdk.getSdkType().equals(JavaSdk.getInstance()) && sdk.getRootProvider().getFiles(OrderRootType.CLASSES).length == 0) {
        return JavaUiBundle.message("project.or.module.jdk.misconfigured", ModuleRootManager.getInstance(module).isSdkInherited() ? 0 : 1);
      }
    }
    else if (ScratchUtil.isScratch(file) && ProjectRootManager.getInstance(project).getProjectSdk() == null) {
      return JavaUiBundle.message("project.sdk.not.defined");
    }
    return null;
  }
@Override
  public @Nullable String getErrorMessage(@NotNull Project project, @NotNull VirtualFile file)