void (JPanel panel, GridBagConstraints gbConstraints) { gbConstraints.insets = JBUI.insetsBottom(4); gbConstraints.gridwidth = 1; gbConstraints.gridx = 0; gbConstraints.weighty = 0; gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; myCbSearchInComments = new NonFocusableCheckBox(); myCbSearchInComments.setText(RefactoringBundle.getSearchInCommentsAndStringsText()); myCbSearchInComments.setSelected(true); panel.add(myCbSearchInComments, gbConstraints); gbConstraints.insets = JBUI.insets(0, UIUtil.DEFAULT_HGAP, 4, 0); gbConstraints.gridwidth = GridBagConstraints.REMAINDER; gbConstraints.gridx = 1; gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; myCbSearchTextOccurrences = new NonFocusableCheckBox(); myCbSearchTextOccurrences.setText(RefactoringBundle.getSearchForTextOccurrencesText()); myCbSearchTextOccurrences.setSelected(true); panel.add(myCbSearchTextOccurrences, gbConstraints); if (!TextOccurrencesUtil.isSearchTextOccurrencesEnabled(myPsiElement)) { myCbSearchTextOccurrences.setEnabled(false); myCbSearchTextOccurrences.setSelected(false); myCbSearchTextOccurrences.setVisible(false); } List<AutomaticRenamerFactory> applicableAutoRenameFactories = ActionUtil.underModalProgress( myProject, RefactoringBundle.message("rename.finding.auto.rename.options.modal.title"), () -> { ProgressManager.checkCanceled(); return ContainerUtil.filter( AutomaticRenamerFactory.EP_NAME.getExtensionList(), renamerFactory -> renamerFactory.isApplicable(myPsiElement) && renamerFactory.getOptionName() != null ); } ); for(AutomaticRenamerFactory factory : applicableAutoRenameFactories) { gbConstraints.gridwidth = myAutoRenamerFactories.size() % 2 == 0 ? 1 : GridBagConstraints.REMAINDER; gbConstraints.gridx = myAutoRenamerFactories.size() % 2; gbConstraints.insets = gbConstraints.gridx == 0 ? JBUI.insetsBottom(4) : JBUI.insets(0, UIUtil.DEFAULT_HGAP, 4, 0); gbConstraints.weightx = 1; gbConstraints.fill = GridBagConstraints.BOTH; JCheckBox checkBox = new NonFocusableCheckBox(); checkBox.setText(factory.getOptionName()); checkBox.setSelected(factory.isEnabled()); panel.add(checkBox, gbConstraints); myAutoRenamerFactories.put(factory, checkBox); } }