boolean (final Project project, final Editor editor, final PsiElement tempAnchorElement, final @NlsContexts.DialogTitle String refactoringName, final String helpID) { if (tempAnchorElement instanceof PsiExpressionStatement) { PsiExpression enclosingExpr = ((PsiExpressionStatement)tempAnchorElement).getExpression(); if (enclosingExpr instanceof PsiMethodCallExpression) { PsiMethod method = ((PsiMethodCallExpression)enclosingExpr).resolveMethod(); if (method != null && method.isConstructor()) { //This is either 'this' or 'super', both must be the first in the respective constructor String message = RefactoringBundle.getCannotRefactorMessage(JavaRefactoringBundle.message("invalid.expression.context")); CommonRefactoringUtil.showErrorHint(project, editor, message, refactoringName, helpID); return true; } } } return false; }