protected void doOKAction() {
   if (!myValidator.isOK(this)) return;
   myNameSuggestionsManager.nameSelected();
   myTypeSelectorManager.typeSelected(getSelectedType());
   if (myCbFinal.isEnabled()) {
     JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_FINALS = myCbFinal.isSelected();
   }
   super.doOKAction();
 }
Пример #2
0
  protected void doAction() {
    final JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();
    settings.INTRODUCE_PARAMETER_REPLACE_FIELDS_WITH_GETTERS =
        myPanel.getReplaceFieldsWithGetters();
    if (myCbDeclareFinal != null && myCbDeclareFinal.isEnabled()) {
      settings.INTRODUCE_PARAMETER_CREATE_FINALS = Boolean.valueOf(myCbDeclareFinal.isSelected());
    }

    myPanel.saveSettings(settings);

    myNameSuggestionsManager.nameSelected();

    boolean isDeleteLocalVariable = false;

    PsiExpression parameterInitializer = myExpression;
    if (myLocalVar != null) {
      if (myPanel.isUseInitializer()) {
        parameterInitializer = myLocalVar.getInitializer();
      }
      isDeleteLocalVariable = myPanel.isDeleteLocalVariable();
    }

    final IntroduceParameterProcessor processor =
        new IntroduceParameterProcessor(
            myProject,
            myMethodToReplaceIn,
            myMethodToSearchFor,
            parameterInitializer,
            myExpression,
            myLocalVar,
            isDeleteLocalVariable,
            getParameterName(),
            myPanel.isReplaceAllOccurences(),
            myPanel.getReplaceFieldsWithGetters(),
            isDeclareFinal(),
            myPanel.isGenerateDelegate(),
            getSelectedType(),
            myPanel.getParametersToRemove());
    invokeRefactoring(processor);
    myParameterNameField.requestFocusInWindow();
  }