Search in sources :

Example 1 with XmlTagBlock

use of com.intellij.psi.formatter.xml.XmlTagBlock in project android by JetBrains.

the class AndroidXmlFormattingModelBuilder method createDelegatingBlock.

private static Block createDelegatingBlock(FormattingModel model, AndroidXmlCodeStyleSettings.MySettings customSettings, CodeStyleSettings settings) {
    final Block block = model.getRootBlock();
    if (block instanceof XmlBlock) {
        final XmlBlock b = (XmlBlock) block;
        final XmlPolicy policy = customSettings.createXmlPolicy(settings, model.getDocumentModel());
        return new XmlBlock(b.getNode(), b.getWrap(), b.getAlignment(), policy, b.getIndent(), b.getTextRange()) {

            @Override
            protected XmlTagBlock createTagBlock(ASTNode child, Indent indent, Wrap wrap, Alignment alignment) {
                return new XmlTagBlock(child, wrap, alignment, myXmlFormattingPolicy, indent != null ? indent : Indent.getNoneIndent(), isPreserveSpace());
            }
        };
    } else {
        return block;
    }
}
Also used : XmlPolicy(com.intellij.psi.formatter.xml.XmlPolicy) XmlTagBlock(com.intellij.psi.formatter.xml.XmlTagBlock) XmlBlock(com.intellij.psi.formatter.xml.XmlBlock) ASTNode(com.intellij.lang.ASTNode) XmlTagBlock(com.intellij.psi.formatter.xml.XmlTagBlock) XmlBlock(com.intellij.psi.formatter.xml.XmlBlock)

Aggregations

ASTNode (com.intellij.lang.ASTNode)1 XmlBlock (com.intellij.psi.formatter.xml.XmlBlock)1 XmlPolicy (com.intellij.psi.formatter.xml.XmlPolicy)1 XmlTagBlock (com.intellij.psi.formatter.xml.XmlTagBlock)1