@Override
  public boolean showHint(@NotNull Editor editor) {
    // Lines below are required to prevent the "Add import" popup appearing two times in a row
    // Similar issue is in com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase.calcClassesToImport
    if (!ref.isValid()) {
      return false;
    }
    PsiFile containingFile = ref.getContainingFile();
    if (containingFile instanceof GroovyFile) {
      List<PsiClass> alreadyImportedClasses =
        ContainerUtil.map(((GroovyFile)containingFile).getImportStatements(), GrImportStatement::resolveTargetClass);
      for (PsiClass classToImport : getClassesToImport()) {
        if (alreadyImportedClasses.contains(classToImport)) {
          return false;
        }
      }
    }
    return super.showHint(editor);
  }
@Override
  public boolean showHint(@NotNull Editor editor)