private static List<PsiFieldMember> chooseFields(PsiFile file, Editor editor, Project project, final PropertiesComponent propertiesComponent) {
List<PsiFieldMember> members = getFields(file, editor);
if (members == null || members.size() == 0) return null;
if (!ApplicationManager.getApplication().isUnitTestMode()) {
final JCheckBox finalSettersCheckbox = new NonFocusableCheckBox("Generate builder methods for final fields");
finalSettersCheckbox.setMnemonic('f');
finalSettersCheckbox.setSelected(propertiesComponent.isTrueValue(PROP_FINALSETTERS));
finalSettersCheckbox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
propertiesComponent.setValue(PROP_FINALSETTERS, Boolean.toString(finalSettersCheckbox.isSelected()));
}
});
final JCheckBox newBuilderMethodCheckbox = new NonFocusableCheckBox("Generate static newBuilder() method");
newBuilderMethodCheckbox.setMnemonic('n');
newBuilderMethodCheckbox.setSelected(propertiesComponent.isTrueValue(PROP_NEWBUILDERMETHOD));
newBuilderMethodCheckbox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
propertiesComponent.setValue(PROP_NEWBUILDERMETHOD, Boolean.toString(newBuilderMethodCheckbox.isSelected()));
}
});
final JCheckBox copyConstructorCheckbox = new NonFocusableCheckBox("Generate builder copy constructor");
copyConstructorCheckbox.setMnemonic('o');
copyConstructorCheckbox.setSelected(propertiesComponent.isTrueValue(PROP_COPYCONSTRUCTOR));
copyConstructorCheckbox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
propertiesComponent.setValue(PROP_COPYCONSTRUCTOR, Boolean.toString(copyConstructorCheckbox.isSelected()));
}
});
final JCheckBox withNotationCheckbox = new NonFocusableCheckBox("Use 'with...' notation");
withNotationCheckbox.setMnemonic('w');
withNotationCheckbox.setToolTipText("Generate builder methods that start with 'with', for example: builder.withName(String name)");
withNotationCheckbox.setSelected(propertiesComponent.isTrueValue(PROP_WITHNOTATION));
withNotationCheckbox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
propertiesComponent.setValue(PROP_WITHNOTATION, Boolean.toString(withNotationCheckbox.isSelected()));
}
});
PsiFieldMember[] memberArray = members.toArray(new PsiFieldMember[members.size()]);