@Override
 protected String[] suggestNames(PsiType defaultType, String propName) {
   return IntroduceConstantDialog.createNameSuggestionGenerator(
           propName, myExpr, JavaCodeStyleManager.getInstance(myProject), null, myParentClass)
       .getSuggestedNameInfo(defaultType)
       .names;
 }
  protected Settings showRefactoringDialog(
      Project project,
      final Editor editor,
      PsiClass parentClass,
      PsiExpression expr,
      PsiType type,
      PsiExpression[] occurrences,
      PsiElement anchorElement,
      PsiElement anchorElementIfAll) {
    final PsiMethod containingMethod =
        PsiTreeUtil.getParentOfType(expr != null ? expr : anchorElement, PsiMethod.class);

    PsiLocalVariable localVariable = null;
    if (expr instanceof PsiReferenceExpression) {
      PsiElement ref = ((PsiReferenceExpression) expr).resolve();
      if (ref instanceof PsiLocalVariable) {
        localVariable = (PsiLocalVariable) ref;
      }
    } else if (anchorElement instanceof PsiLocalVariable) {
      localVariable = (PsiLocalVariable) anchorElement;
    }

    String enteredName = null;
    boolean replaceAllOccurrences = true;

    final AbstractInplaceIntroducer activeIntroducer =
        AbstractInplaceIntroducer.getActiveIntroducer(editor);
    if (activeIntroducer != null) {
      activeIntroducer.stopIntroduce(editor);
      expr = (PsiExpression) activeIntroducer.getExpr();
      localVariable = (PsiLocalVariable) activeIntroducer.getLocalVariable();
      occurrences = (PsiExpression[]) activeIntroducer.getOccurrences();
      enteredName = activeIntroducer.getInputName();
      replaceAllOccurrences = activeIntroducer.isReplaceAllOccurrences();
      type = ((InplaceIntroduceConstantPopup) activeIntroducer).getType();
    }

    for (PsiExpression occurrence : occurrences) {
      if (RefactoringUtil.isAssignmentLHS(occurrence)) {
        String message =
            RefactoringBundle.getCannotRefactorMessage("Selected expression is used for write");
        CommonRefactoringUtil.showErrorHint(
            project, editor, message, REFACTORING_NAME, getHelpID());
        highlightError(project, editor, occurrence);
        return null;
      }
    }

    if (localVariable == null) {
      final PsiElement errorElement = isStaticFinalInitializer(expr);
      if (errorElement != null) {
        String message =
            RefactoringBundle.getCannotRefactorMessage(
                RefactoringBundle.message("selected.expression.cannot.be.a.constant.initializer"));
        CommonRefactoringUtil.showErrorHint(
            project, editor, message, REFACTORING_NAME, getHelpID());
        highlightError(project, editor, errorElement);
        return null;
      }
    } else {
      final PsiExpression initializer = localVariable.getInitializer();
      if (initializer == null) {
        String message =
            RefactoringBundle.getCannotRefactorMessage(
                RefactoringBundle.message(
                    "variable.does.not.have.an.initializer", localVariable.getName()));
        CommonRefactoringUtil.showErrorHint(
            project, editor, message, REFACTORING_NAME, getHelpID());
        return null;
      }
      final PsiElement errorElement = isStaticFinalInitializer(initializer);
      if (errorElement != null) {
        String message =
            RefactoringBundle.getCannotRefactorMessage(
                RefactoringBundle.message(
                    "initializer.for.variable.cannot.be.a.constant.initializer",
                    localVariable.getName()));
        CommonRefactoringUtil.showErrorHint(
            project, editor, message, REFACTORING_NAME, getHelpID());
        highlightError(project, editor, errorElement);
        return null;
      }
    }

    final TypeSelectorManagerImpl typeSelectorManager =
        new TypeSelectorManagerImpl(project, type, containingMethod, expr, occurrences);
    if (editor != null
        && editor.getSettings().isVariableInplaceRenameEnabled()
        && (expr == null || expr.isPhysical())
        && activeIntroducer == null) {
      myInplaceIntroduceConstantPopup =
          new InplaceIntroduceConstantPopup(
              project,
              editor,
              parentClass,
              expr,
              localVariable,
              occurrences,
              typeSelectorManager,
              anchorElement,
              anchorElementIfAll,
              expr != null ? createOccurrenceManager(expr, parentClass) : null);
      if (myInplaceIntroduceConstantPopup.startInplaceIntroduceTemplate()) {
        return null;
      }
    }

    final IntroduceConstantDialog dialog =
        new IntroduceConstantDialog(
            project,
            parentClass,
            expr,
            localVariable,
            localVariable != null,
            occurrences,
            getParentClass(),
            typeSelectorManager,
            enteredName);
    dialog.setReplaceAllOccurrences(replaceAllOccurrences);
    if (!dialog.showAndGet()) {
      if (occurrences.length > 1) {
        WindowManager.getInstance()
            .getStatusBar(project)
            .setInfo(RefactoringBundle.message("press.escape.to.remove.the.highlighting"));
      }
      return null;
    }
    return new Settings(
        dialog.getEnteredName(),
        expr,
        occurrences,
        dialog.isReplaceAllOccurrences(),
        true,
        true,
        InitializationPlace.IN_FIELD_DECLARATION,
        dialog.getFieldVisibility(),
        localVariable,
        dialog.getSelectedType(),
        dialog.isDeleteVariable(),
        dialog.getDestinationClass(),
        dialog.isAnnotateAsNonNls(),
        dialog.introduceEnumConstant());
  }