@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
    if (!myRefExpr.isValid() || !BaseIntentionAction.canModify(myRefExpr)) return false;
    PsiElement refName = myRefExpr.getReferenceNameElement();
    if (refName == null) return false;
    PsiExpression qualifier = myRefExpr.getQualifierExpression();
    if (qualifier != null && qualifier.getType() instanceof PsiPrimitiveType) {
      PsiExpression expression = (myRefExpr.getParent() instanceof PsiMethodCallExpression call) ? call : myRefExpr;
      if (ExpressionUtils.isVoidContext(expression)) {
        return false;
      }
      myText = QuickFixBundle.message("replace.with.qualifier.text");
    }
    else {
      myText = QuickFixBundle.message("rename.wrong.reference.text");
    }
    return !CreateFromUsageUtils.isValidReference(myRefExpr, myUnresolvedOnly);
  }
@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file)