Search in sources :

Example 1 with AndroidXmlPredefinedCodeStyle

use of org.jetbrains.android.formatter.AndroidXmlPredefinedCodeStyle in project android by JetBrains.

the class AndroidCodeStyleSettingsModifier method modify.

public static void modify(CodeStyleSettings settings) {
    // Use Android XML formatter by default
    AndroidXmlCodeStyleSettings.getInstance(settings).USE_CUSTOM_SETTINGS = true;
    // XML:
    // Copy Android code style
    AndroidXmlPredefinedCodeStyle xmlStyle = new AndroidXmlPredefinedCodeStyle();
    xmlStyle.apply(settings);
    // Java:
    // Set Import order
    settings.IMPORT_LAYOUT_TABLE.copyFrom(getAndroidImportOrder());
    // Don't use wildcard imports
    settings.PACKAGES_TO_USE_IMPORT_ON_DEMAND.copyFrom(new PackageEntryTable());
    // Class count to use import with "*"
    settings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = 99;
    // Name count to use static import with "*"
    settings.NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND = 99;
    // set margin to 100 columns
    settings.setDefaultRightMargin(100);
}
Also used : PackageEntryTable(com.intellij.psi.codeStyle.PackageEntryTable) AndroidXmlPredefinedCodeStyle(org.jetbrains.android.formatter.AndroidXmlPredefinedCodeStyle)

Aggregations

PackageEntryTable (com.intellij.psi.codeStyle.PackageEntryTable)1 AndroidXmlPredefinedCodeStyle (org.jetbrains.android.formatter.AndroidXmlPredefinedCodeStyle)1