@Override
  protected void processIntention(@NotNull PsiElement element, @NotNull final Project project, final Editor editor) throws IncorrectOperationException {
    final PsiElement resolved = resolve(element);
    if (!(resolved instanceof PsiMember)) return;

    final PsiClass containingClass = ((PsiMember)resolved).getContainingClass();
    if (containingClass == null) return;

    String originalName = ((PsiMember)resolved).getName();
    final String name = resolved instanceof PsiMethod && GroovyPropertyUtils.isSimplePropertyAccessor((PsiMethod)resolved) ? GroovyPropertyUtils.getPropertyName((PsiMethod)resolved)
                                                                                                                           : originalName;
    final String qname = containingClass.getQualifiedName();
    if (name == null) return;

    final PsiFile containingFile = element.getContainingFile();
    if (!(containingFile instanceof GroovyFile file)) return;
    file.accept(new GroovyRecursiveElementVisitor() {
      @Override
      public void visitReferenceExpression(@NotNull GrReferenceExpression expression) {
        super.visitReferenceExpression(expression);
        if (name.equals(expression.getReferenceName())) {
          PsiElement resolved = expression.resolve();
          if (resolved != null) {
            expression.putUserData(TEMP_REFERENT_USER_DATA, resolved);
          }
        }
      }
    });

    final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(project);
    final GrImportStatement tempImport = factory.createImportStatementFromText(qname + "." + name, true, false, null);
    final GrImportStatement importStatement = file.addImport(tempImport);

    boolean isAnythingShortened = shortenUsages(resolved, containingFile);
    if (!isAnythingShortened) {
      importStatement.delete();
      return;
    }

    file.accept(new GroovyRecursiveElementVisitor() {
      @Override
      public void visitReferenceExpression(@NotNull GrReferenceExpression expression) {
        super.visitReferenceExpression(expression);

        GrTypeArgumentList typeArgumentList = expression.getTypeArgumentList();
        if (typeArgumentList != null && typeArgumentList.getFirstChild() != null) {
          expression.putUserData(TEMP_REFERENT_USER_DATA, null);

          return;
        }

        if (name.equals(expression.getReferenceName())) {
          if (expression.isQualified()) {
            GrExpression qualifier = expression.getQualifierExpression();
            if (qualifier instanceof GrReferenceExpression) {
              PsiElement aClass = ((GrReferenceExpression)qualifier).resolve();
              if (aClass == ((PsiMember)resolved).getContainingClass()) {
                GrReferenceAdjuster.shortenReference(expression);
              }
            }
          }
          else {
            PsiElement referent = expression.getUserData(TEMP_REFERENT_USER_DATA);
            if (referent instanceof PsiMember &&
                ((PsiMember)referent).hasModifierProperty(PsiModifier.STATIC) &&
                referent != expression.resolve()) {
              expression.bindToElement(referent);
            }
          }
        }
        expression.putUserData(TEMP_REFERENT_USER_DATA, null);
      }
    });
  }
@Override
  protected void processIntention(@NotNull PsiElement element, @NotNull final Project project, final Editor editor)