public boolean processPrimaryMethod(ChangeInfo changeInfo) {
   if (!StdLanguages.JAVA.equals(changeInfo.getLanguage())
       || !(changeInfo instanceof JavaChangeInfo)) return false;
   final PsiElement element = changeInfo.getMethod();
   LOG.assertTrue(element instanceof PsiMethod);
   if (changeInfo.isGenerateDelegate()) {
     generateDelegate((JavaChangeInfo) changeInfo);
   }
   processPrimaryMethod((JavaChangeInfo) changeInfo, (PsiMethod) element, null, true);
   return true;
 }
 @Override
 public boolean setupDefaultValues(
     ChangeInfo changeInfo, Ref<UsageInfo[]> refUsages, Project project) {
   if (!(changeInfo instanceof JavaChangeInfo)) return true;
   for (UsageInfo usageInfo : refUsages.get()) {
     if (usageInfo instanceof MethodCallUsageInfo) {
       MethodCallUsageInfo methodCallUsageInfo = (MethodCallUsageInfo) usageInfo;
       if (methodCallUsageInfo.isToChangeArguments()) {
         final PsiElement element = methodCallUsageInfo.getElement();
         if (element == null) continue;
         final PsiMethod caller = RefactoringUtil.getEnclosingMethod(element);
         final boolean needDefaultValue = needDefaultValue(changeInfo, caller);
         if (needDefaultValue
             && (caller == null
                 || !MethodSignatureUtil.isSuperMethod(
                     methodCallUsageInfo.getReferencedMethod(), caller))) {
           final ParameterInfo[] parameters = changeInfo.getNewParameters();
           for (ParameterInfo parameter : parameters) {
             final String defaultValue = parameter.getDefaultValue();
             if (defaultValue == null && parameter.getOldIndex() == -1) {
               ((ParameterInfoImpl) parameter).setDefaultValue("");
               if (!ApplicationManager.getApplication().isUnitTestMode()) {
                 final PsiType type =
                     ((ParameterInfoImpl) parameter)
                         .getTypeWrapper()
                         .getType(element, element.getManager());
                 final DefaultValueChooser chooser =
                     new DefaultValueChooser(
                         project, parameter.getName(), PsiTypesUtil.getDefaultValueOfType(type));
                 chooser.show();
                 if (chooser.isOK()) {
                   if (chooser.feelLucky()) {
                     parameter.setUseAnySingleVariable(true);
                   } else {
                     ((ParameterInfoImpl) parameter).setDefaultValue(chooser.getDefaultValue());
                   }
                 } else {
                   return false;
                 }
               }
             }
           }
         }
       }
     }
   }
   return true;
 }
  public boolean processUsage(
      ChangeInfo changeInfo, UsageInfo usage, boolean beforeMethodChange, UsageInfo[] usages) {
    if (!isJavaUsage(usage)) return false;
    if (!(changeInfo instanceof JavaChangeInfo)) return false;

    if (beforeMethodChange) {
      if (usage instanceof CallerUsageInfo) {
        final CallerUsageInfo callerUsageInfo = (CallerUsageInfo) usage;
        processCallerMethod(
            (JavaChangeInfo) changeInfo,
            callerUsageInfo.getMethod(),
            null,
            callerUsageInfo.isToInsertParameter(),
            callerUsageInfo.isToInsertException());
        return true;
      } else if (usage instanceof OverriderUsageInfo) {
        OverriderUsageInfo info = (OverriderUsageInfo) usage;
        final PsiMethod method = info.getElement();
        final PsiMethod baseMethod = info.getBaseMethod();
        if (info.isOriginalOverrider()) {
          processPrimaryMethod((JavaChangeInfo) changeInfo, method, baseMethod, false);
        } else {
          processCallerMethod(
              (JavaChangeInfo) changeInfo,
              method,
              baseMethod,
              info.isToInsertArgs(),
              info.isToCatchExceptions());
        }
        return true;
      }

    } else {
      PsiElement element = usage.getElement();
      LOG.assertTrue(element != null);

      if (usage instanceof DefaultConstructorImplicitUsageInfo) {
        final DefaultConstructorImplicitUsageInfo defConstructorUsage =
            (DefaultConstructorImplicitUsageInfo) usage;
        PsiMethod constructor = defConstructorUsage.getConstructor();
        if (!constructor.isPhysical()) {
          final boolean toPropagate =
              changeInfo instanceof JavaChangeInfoImpl
                  && ((JavaChangeInfoImpl) changeInfo)
                      .propagateParametersMethods.remove(constructor);
          final PsiClass containingClass = defConstructorUsage.getContainingClass();
          constructor = (PsiMethod) containingClass.add(constructor);
          PsiUtil.setModifierProperty(
              constructor,
              VisibilityUtil.getVisibilityModifier(containingClass.getModifierList()),
              true);
          if (toPropagate) {
            ((JavaChangeInfoImpl) changeInfo).propagateParametersMethods.add(constructor);
          }
        }
        addSuperCall(
            (JavaChangeInfo) changeInfo,
            constructor,
            defConstructorUsage.getBaseConstructor(),
            usages);
        return true;
      } else if (usage instanceof NoConstructorClassUsageInfo) {
        addDefaultConstructor(
            ((JavaChangeInfo) changeInfo),
            ((NoConstructorClassUsageInfo) usage).getPsiClass(),
            usages);
        return true;
      } else if (usage instanceof MethodCallUsageInfo) {
        final MethodCallUsageInfo methodCallInfo = (MethodCallUsageInfo) usage;
        processMethodUsage(
            methodCallInfo.getElement(),
            (JavaChangeInfo) changeInfo,
            methodCallInfo.isToChangeArguments(),
            methodCallInfo.isToCatchExceptions(),
            methodCallInfo.getReferencedMethod(),
            methodCallInfo.getSubstitutor(),
            usages);
        return true;
      } else if (usage instanceof ChangeSignatureParameterUsageInfo) {
        String newName = ((ChangeSignatureParameterUsageInfo) usage).newParameterName;
        String oldName = ((ChangeSignatureParameterUsageInfo) usage).oldParameterName;
        processParameterUsage((PsiReferenceExpression) element, oldName, newName);
        return true;
      } else if (usage instanceof CallReferenceUsageInfo) {
        ((CallReferenceUsageInfo) usage).getReference().handleChangeSignature(changeInfo);
        return true;
      } else if (element instanceof PsiEnumConstant) {
        fixActualArgumentsList(
            ((PsiEnumConstant) element).getArgumentList(),
            (JavaChangeInfo) changeInfo,
            true,
            PsiSubstitutor.EMPTY);
        return true;
      } else if (!(usage instanceof OverriderUsageInfo)) {
        PsiReference reference =
            usage instanceof MoveRenameUsageInfo ? usage.getReference() : element.getReference();
        if (reference != null) {
          PsiElement target = changeInfo.getMethod();
          if (target != null) {
            reference.bindToElement(target);
          }
        }
      }
    }
    return false;
  }