private void doRefactoring() throws IncorrectOperationException {
    calculateTypeParametersToCreate();
    ChangeContextUtil.encodeContextInfo(myAnonOrLocalClass, false);
    updateLocalClassConstructors(myAnonOrLocalClass);
    PsiClass innerClass = (PsiClass)myTargetClass.add(createClass(myNewClassName));
    ChangeContextUtil.decodeContextInfo(innerClass, myTargetClass, RefactoringChangeUtil.createThisExpression(myTargetClass.getManager(), myTargetClass));

    if (myAnonOrLocalClass instanceof PsiAnonymousClass) {
      migrateAnonymousClassCreation(innerClass);
    } else {
      migrateLocalClassReferences(innerClass);
    }
    collapseDiamonds(innerClass);
  }
private void doRefactoring()