Search in sources :

Example 1 with CodeStyleBoundedIntegerSettingPresentation

use of com.intellij.psi.codeStyle.presentation.CodeStyleBoundedIntegerSettingPresentation in project intellij-community by JetBrains.

the class WrappingAndBracesPanel method initTables.

@Override
protected void initTables() {
    for (Map.Entry<CodeStyleSettingPresentation.SettingsGroup, List<CodeStyleSettingPresentation>> entry : CodeStyleSettingPresentation.getStandardSettings(getSettingsType()).entrySet()) {
        CodeStyleSettingPresentation.SettingsGroup group = entry.getKey();
        for (CodeStyleSettingPresentation setting : entry.getValue()) {
            //TODO this is ugly, but is the fastest way to make Options UI API and settings representation API connect
            String fieldName = setting.getFieldName();
            String uiName = setting.getUiName();
            if (setting instanceof CodeStyleBoundedIntegerSettingPresentation) {
                CodeStyleBoundedIntegerSettingPresentation intSetting = (CodeStyleBoundedIntegerSettingPresentation) setting;
                int defaultValue = intSetting.getDefaultValue();
                addOption(fieldName, uiName, group.name, intSetting.getLowerBound(), intSetting.getUpperBound(), defaultValue, intSetting.getValueUiName(defaultValue));
            } else if (setting instanceof CodeStyleSelectSettingPresentation) {
                CodeStyleSelectSettingPresentation selectSetting = (CodeStyleSelectSettingPresentation) setting;
                addOption(fieldName, uiName, group.name, selectSetting.getOptions(), selectSetting.getValues());
            } else {
                addOption(fieldName, uiName, group.name);
            }
        }
    }
}
Also used : CodeStyleSettingPresentation(com.intellij.psi.codeStyle.presentation.CodeStyleSettingPresentation) CodeStyleSelectSettingPresentation(com.intellij.psi.codeStyle.presentation.CodeStyleSelectSettingPresentation) List(java.util.List) Map(java.util.Map) MultiMap(com.intellij.util.containers.MultiMap) CodeStyleBoundedIntegerSettingPresentation(com.intellij.psi.codeStyle.presentation.CodeStyleBoundedIntegerSettingPresentation)

Aggregations

CodeStyleBoundedIntegerSettingPresentation (com.intellij.psi.codeStyle.presentation.CodeStyleBoundedIntegerSettingPresentation)1 CodeStyleSelectSettingPresentation (com.intellij.psi.codeStyle.presentation.CodeStyleSelectSettingPresentation)1 CodeStyleSettingPresentation (com.intellij.psi.codeStyle.presentation.CodeStyleSettingPresentation)1 MultiMap (com.intellij.util.containers.MultiMap)1 List (java.util.List)1 Map (java.util.Map)1