void (@NotNull UsageInfo usage, @NotNull PsiClass outerClass, @Nullable String parameterNameOuterClass) { PsiElement refElement = usage.getElement(); if (refElement == null) return; PsiManager manager = refElement.getManager(); PsiElement refParent = refElement.getParent(); if (refParent instanceof PsiNewExpression || refParent instanceof PsiAnonymousClass) { PsiNewExpression newExpr = refParent instanceof PsiNewExpression ? (PsiNewExpression)refParent : (PsiNewExpression)refParent.getParent(); PsiExpressionList argList = newExpr.getArgumentList(); if (argList != null) { // can happen in incomplete code PsiExpression qualifier = newExpr.getQualifier(); if (qualifier != null) { if (parameterNameOuterClass != null) { argList.addAfter(qualifier, null); } qualifier.delete(); } else if (parameterNameOuterClass != null) { PsiThisExpression thisExpr; PsiClass parentClass = RefactoringChangeUtil.getThisClass(newExpr); if (outerClass.equals(parentClass)) { thisExpr = RefactoringChangeUtil.createThisExpression(manager, null); } else { thisExpr = RefactoringChangeUtil.createThisExpression(manager, outerClass); } argList.addAfter(thisExpr, null); } } } }