boolean (@NotNull PsiClass targetClass) { String fieldName = settings.getName(); String errorString = check(targetClass, fieldName); if (errorString != null) { String message = RefactoringBundle.getCannotRefactorMessage(errorString); CommonRefactoringUtil .showErrorMessage(GroovyBundle.message("introduce.constant.title"), message, HelpID.INTRODUCE_CONSTANT, context.getProject()); return true; } PsiField oldField = targetClass.findFieldByName(fieldName, true); if (oldField != null) { String message = RefactoringBundle.message("field.exists", fieldName, oldField.getContainingClass().getQualifiedName()); int answer = Messages .showYesNoDialog(context.getProject(), message, GroovyBundle.message("introduce.constant.title"), Messages.getWarningIcon()); if (answer != Messages.YES) { return true; } } return false; }