final String[] INDENT_MODE__VALUES = array(
CodeFormatterConstants.TAB,
CodeFormatterConstants.SPACES
);
final ComboBoxField indentModeField = new ComboBoxField(
FormatterMessages.IndentationGroup_tab_policy,
INDENT_MODE__LABELS,
INDENT_MODE__VALUES);
createCheckboxField(generalGroup,
CodeFormatterConstants.FORMATTER_INDENT_MODE.key,
indentModeField
);
createStringField(generalGroup,
CodeFormatterConstants.FORMATTER_TAB_SIZE.key,
createNumberField(FormatterMessages.IndentationGroup_tab_size, 2)
);
final NumberField indentationSizeField = createNumberField(
FormatterMessages.IndentationGroup_indent_size, 2);
createStringField(generalGroup,
CodeFormatterConstants.FORMATTER_INDENTATION_SPACES_SIZE.key,
indentationSizeField
);
IFieldValueListener indentModeValueListener = new IFieldValueListener() {
@Override
public void fieldValueChanged() {
boolean enabled = !areEqual(indentModeField.getFieldValue(), CodeFormatterConstants.TAB);
indentationSizeField.setEnabled(enabled);
}
};
indentModeField.addValueChangedListener(indentModeValueListener);
indentModeValueListener.fieldValueChanged();
}