JComponent () { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.weightx = 1; gbConstraints.weighty = 0; gbConstraints.gridwidth = 1; gbConstraints.gridx = 0; gbConstraints.gridy = 0; gbConstraints.insets = JBInsets.emptyInsets(); if (myOccurrencesCount > 1) { myCbReplaceAll = new NonFocusableCheckBox(); myCbReplaceAll.setText(RefactoringBundle.message("replace.all.occurences", myOccurrencesCount)); panel.add(myCbReplaceAll, gbConstraints); myReplaceAllListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateControls(); } }; myCbReplaceAll.addItemListener(myReplaceAllListener); if (myAnyLValueOccurrences) { myCbReplaceWrite = new StateRestoringCheckBox(); myCbReplaceWrite.setText(JavaRefactoringBundle.message("replace.write.access.occurrences")); gbConstraints.insets = JBUI.insetsLeft(8); gbConstraints.gridy++; panel.add(myCbReplaceWrite, gbConstraints); myCbReplaceWrite.addItemListener(myReplaceAllListener); } } myCbFinal = new NonFocusableCheckBox(); myCbFinal.setText(JavaRefactoringBundle.message("declare.final")); final Boolean createFinals = JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_FINALS; myCbFinalState = createFinals == null ? JavaCodeStyleSettings.getInstance(myFile).GENERATE_FINAL_LOCALS : createFinals.booleanValue(); gbConstraints.insets = JBInsets.emptyInsets(); gbConstraints.gridy++; panel.add(myCbFinal, gbConstraints); myFinalListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (myCbFinal.isEnabled()) { myCbFinalState = myCbFinal.isSelected(); } } }; myCbFinal.addItemListener(myFinalListener); myCbVarType = new NonFocusableCheckBox(JavaRefactoringBundle.message("declare.var.type")); boolean toVarType = IntroduceVariableBase.canBeExtractedWithoutExplicitType(myExpression); if (toVarType) { myTypeSelector.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { myCbVarType.setEnabled(Comparing.equal(myTypeSelector.getSelectedType(), CommonJavaRefactoringUtil.getTypeByExpressionWithExpectedType(myExpression))); } } }); } myCbVarType.setVisible(toVarType); myCbVarType.setSelected(IntroduceVariableBase.createVarType()); gbConstraints.gridy++; panel.add(myCbVarType, gbConstraints); updateControls(); return panel; }