@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
    if (!myTargetMethod.isValid() || myTargetMethod.getContainingClass() == null) return false;
    for (PsiExpression expression : myExpressions) {
      if (!expression.isValid()) return false;
    }
    if (!mySubstitutor.isValid()) return false;
    if (myTargetMethod.isConstructor()) {
      PsiCallExpression call = PsiTreeUtil.getParentOfType(myContext, PsiCallExpression.class);
      if (call instanceof PsiMethodCallExpression && ((PsiMethodCallExpression)call).getMethodExpression().textMatches("this") &&
          PsiTreeUtil.isAncestor(myTargetMethod, call, true)) {
        // Avoid creating recursive constructor call
        return false;
      }
    }

    final StringBuilder buf = new StringBuilder();
    final HashSet<ParameterInfoImpl> newParams = new HashSet<>();
    final HashSet<ParameterInfoImpl> removedParams = new HashSet<>();
    final HashSet<ParameterInfoImpl> changedParams = new HashSet<>();
    myNewParametersInfo = getNewParametersInfo(myExpressions, myTargetMethod, mySubstitutor, buf, newParams, removedParams, changedParams);
    if (myNewParametersInfo == null || formatTypesList(myNewParametersInfo, myContext) == null) return false;
    myShortName = getShortText(buf, newParams, removedParams, changedParams);
    return !isMethodSignatureExists();
  }
@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file)