@Override
  public PsiElement replace(@NotNull PsiElement newElement) throws IncorrectOperationException {
    if (newElement instanceof PsiTypeElement) {
      GrTypeElement groovyTypeElement = GroovyPsiElementFactory.getInstance(getProject()).createTypeElement(((PsiTypeElement)newElement).getType());
      return myElement.replace(groovyTypeElement);
    }
    else {
      return super.replace(newElement);
    }
  }
@Override
  public PsiElement replace(@NotNull PsiElement newElement)