protected boolean canReplace(PsiElement replacement, PsiElement element) {
    return !PsiTreeUtil.isAncestor(replacement, element, false);
  }
protected boolean canReplace(PsiElement replacement, PsiElement element)