Java Code Examples for com.intellij.psi.formatter.FormattingDocumentModelImpl#createOn()
The following examples show how to use
com.intellij.psi.formatter.FormattingDocumentModelImpl#createOn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoyFormattingModelBuilder.java From bamboo-soy with Apache License 2.0 | 5 votes |
@Override public TemplateLanguageBlock createTemplateLanguageBlock( @NotNull ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment, @Nullable List<DataLanguageBlockWrapper> foreignChildren, @NotNull CodeStyleSettings codeStyleSettings) { final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(node.getPsi().getContainingFile()); if (node.getPsi() instanceof TagElement) { return new SoyTagBlock( this, codeStyleSettings, node, foreignChildren, new HtmlPolicy(codeStyleSettings, documentModel)); } else if(node.getPsi() instanceof TagBlockElement) { return new SoyTagBlockBlock( this, codeStyleSettings, node, foreignChildren, new HtmlPolicy(codeStyleSettings, documentModel)); } else if (node.getPsi() instanceof SoyStatementList) { return new SoyStatementListBlock( this, codeStyleSettings, node, foreignChildren, new HtmlPolicy(codeStyleSettings, documentModel)); } else { return new SoyBlock( this, codeStyleSettings, node, foreignChildren, new HtmlPolicy(codeStyleSettings, documentModel)); } }
Example 2
Source File: CSharpFormattingModelBuilder.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) { final PsiFile file = element.getContainingFile(); FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile()); Block rootBlock = new CSharpFormattingBlock(file.getNode(), null, null, settings); return new PsiBasedFormattingModel(file, rootBlock, model); }
Example 3
Source File: FormatterImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public FormattingModel createFormattingModelForPsiFile(@Nonnull final PsiFile file, @Nonnull final Block rootBlock, final CodeStyleSettings settings) { return new PsiBasedFormattingModel(file, rootBlock, FormattingDocumentModelImpl.createOn(file)); }