JComponent () { JPanel optionsPanel = new JPanel(); optionsPanel.setBorder(new EmptyBorder(JBUIScale.scale(10), 0, 0, 0)); optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS)); myRbInlineAll = new JRadioButton(); myRbInlineAll.setText(getInlineAllText()); myRbInlineAll.setSelected(true); myRbInlineThisOnly = new JRadioButton(); myRbInlineThisOnly.setText(getInlineThisText()); final boolean writable = allowInlineAll(); optionsPanel.add(myRbInlineAll); String keepDeclarationText = getKeepTheDeclarationText(); if (keepDeclarationText != null && writable) { myKeepTheDeclaration = new JRadioButton(); myKeepTheDeclaration.setText(keepDeclarationText); optionsPanel.add(myKeepTheDeclaration); } optionsPanel.add(myRbInlineThisOnly); ButtonGroup bg = new ButtonGroup(); final JRadioButton[] buttons = myKeepTheDeclaration != null ? new JRadioButton[] {myRbInlineAll, myKeepTheDeclaration, myRbInlineThisOnly} : new JRadioButton[] {myRbInlineAll, myRbInlineThisOnly}; for (JRadioButton button : buttons) { bg.add(button); } RadioUpDownListener.installOn(buttons); myRbInlineThisOnly.setEnabled(myInvokedOnReference); myRbInlineAll.setEnabled(writable); if(myInvokedOnReference) { if (canInlineThisOnly()) { myRbInlineAll.setSelected(false); myRbInlineAll.setEnabled(false); if (myKeepTheDeclaration != null) { myKeepTheDeclaration.setSelected(false); myKeepTheDeclaration.setEnabled(false); } myRbInlineThisOnly.setSelected(true); } else { if (writable) { final boolean inlineThis = isInlineThis(); myRbInlineThisOnly.setSelected(inlineThis); if (myKeepTheDeclaration != null) myKeepTheDeclaration.setSelected(!inlineThis && isKeepTheDeclarationByDefault()); myRbInlineAll.setSelected(!inlineThis && !isKeepTheDeclarationByDefault()); } else { myRbInlineAll.setSelected(false); if (myKeepTheDeclaration != null) { myKeepTheDeclaration.setSelected(false); } myRbInlineThisOnly.setSelected(true); } } } else { boolean keepTheDeclarationByDefault = isKeepTheDeclarationByDefault(); myRbInlineAll.setSelected(!keepTheDeclarationByDefault); if (myKeepTheDeclaration != null) { myKeepTheDeclaration.setSelected(keepTheDeclarationByDefault); } myRbInlineThisOnly.setSelected(false); } getPreviewAction().setEnabled(myRbInlineAll.isSelected() || myKeepTheDeclaration != null && myKeepTheDeclaration.isSelected()); final ActionListener previewListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean enabled = myRbInlineAll.isSelected() || myKeepTheDeclaration != null && myKeepTheDeclaration.isSelected(); getPreviewAction().setEnabled(enabled); } }; for (JRadioButton button : buttons) { button.addActionListener(previewListener); } return optionsPanel; }