diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java index 061a23cc4df1..9a5c35e14ecb 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java @@ -234,7 +234,7 @@ class IntroduceVariableDialog extends DialogWrapper implements IntroduceVariable @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { - myCbVarType.setEnabled(Comparing.equal(myTypeSelector.getSelectedType(), CommonJavaRefactoringUtil.getTypeByExpressionWithExpectedType(myExpression))); + updateVarType(); } } }); @@ -246,10 +246,17 @@ class IntroduceVariableDialog extends DialogWrapper implements IntroduceVariable panel.add(myCbVarType, gbConstraints); updateControls(); + updateVarType(); return panel; } + public void updateVarType() { + if (myCbVarType != null) { + myCbVarType.setEnabled(Comparing.equal(myTypeSelector.getSelectedType(), CommonJavaRefactoringUtil.getTypeByExpressionWithExpectedType(myExpression))); + } + } + private void updateControls() { if (myCbReplaceWrite != null) { if (myCbReplaceAll.isSelected()) { @@ -276,10 +283,6 @@ class IntroduceVariableDialog extends DialogWrapper implements IntroduceVariable myCbFinal.setEnabled(true); myCbFinal.setSelected(myCbFinalState); } - - if (myCbVarType != null) { - myCbVarType.setEnabled(Comparing.equal(myTypeSelector.getSelectedType(), myExpression.getType())); - } } @Override