@Nullable
  private @DialogMessage String check(@NotNull PsiClass targetClass, @Nullable final String fieldName) {
    if (!GroovyLanguage.INSTANCE.equals(targetClass.getLanguage())) {
      return GroovyRefactoringBundle.message("class.language.is.not.groovy");
    }

    if (fieldName == null || fieldName.isEmpty()) {
      return RefactoringBundle.message("no.field.name.specified");
    }

    else if (!PsiNameHelper.getInstance(context.getProject()).isIdentifier(fieldName)) {
      return RefactoringMessageUtil.getIncorrectIdentifierMessage(fieldName);
    }

    if (targetClass instanceof GroovyScriptClass) {
      return GroovyRefactoringBundle.message("target.class.must.not.be.script");
    }

    return null;
  }
@Nullable
  private @DialogMessage String check(@NotNull PsiClass targetClass, @Nullable final String fieldName)