@Override
  protected boolean isAvailable(@Nullable PsiElement element, @NotNull Editor editor, @NotNull PsiFile file) {
    if (!editor.getSettings().isVariableInplaceRenameEnabled()) return false;

    if (!(element instanceof GrVariable)) return false;
    if (element instanceof GrField) return false;

    final SearchScope scope = element.getUseScope();
    if (!(scope instanceof LocalSearchScope)) return false;

    final PsiElement[] scopeElements = ((LocalSearchScope)scope).getScope();
    return scopeElements.length == 1 ||
           scopeElements.length == 2 && (scopeElements[0] instanceof GrDocComment ^ scopeElements[1] instanceof GrDocComment);
  }
@Override
  protected boolean isAvailable(@Nullable PsiElement element, @NotNull Editor editor, @NotNull PsiFile file)