@Override
  protected void doFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) throws IncorrectOperationException {
    final GrTypeDefinition psiClass = myPsiClassPointer.getElement();
    if (psiClass == null) return;

    GrReferenceList list;
    final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(project);

    final PsiClass comparable =
      JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_COMPARABLE, psiClass.getResolveScope());
    final boolean addTypeParam = comparable != null && comparable.getTypeParameters().length == 1;

    if (!InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_LANG_COMPARABLE)) {
      if (psiClass.isInterface()) {
        list = psiClass.getExtendsClause();
        if (list == null) {
          list = factory.createExtendsClause();

          PsiElement anchor = psiClass.getImplementsClause();
          if (anchor == null) {
            anchor = psiClass.getBody();
          }
          if (anchor == null) return;
          list = (GrReferenceList)psiClass.addBefore(list, anchor);
          psiClass.getNode().addLeaf(TokenType.WHITE_SPACE, " ", anchor.getNode());
          psiClass.getNode().addLeaf(TokenType.WHITE_SPACE, " ", list.getNode());
        }
      }
      else {
        list = psiClass.getImplementsClause();
        if (list == null) {
          list = factory.createImplementsClause();
          PsiElement anchor = psiClass.getBody();
          if (anchor == null) return;
          list = (GrReferenceList)psiClass.addBefore(list, anchor);
          psiClass.getNode().addLeaf(TokenType.WHITE_SPACE, " ", list.getNode());
          psiClass.getNode().addLeaf(TokenType.WHITE_SPACE, " ", anchor.getNode());
        }
      }


      final GrCodeReferenceElement _ref =
        factory.createCodeReference(myInterfaceName + (addTypeParam ? "<" + AddMethodFix.generateTypeText(psiClass) + ">" : ""));
      final GrCodeReferenceElement ref = (GrCodeReferenceElement)list.add(_ref);
      JavaCodeStyleManager.getInstance(project).shortenClassReferences(ref);
    }
    if (comparable != null && !psiClass.isInterface()) {
      final PsiMethod baseMethod = comparable.getMethods()[0];
      OverrideImplementUtil.overrideOrImplement(psiClass, baseMethod);
    }
  }
@Override
  protected void doFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor)