Search in sources :

Example 1 with XmlFormattingModel

use of com.intellij.lang.xml.XmlFormattingModel in project intellij-community by JetBrains.

the class HtmlFormattingModelBuilder method createModel.

@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
    final PsiFile psiFile = element.getContainingFile();
    final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
    return new XmlFormattingModel(psiFile, new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile), null, null, new HtmlPolicy(settings, documentModel), null, null, false), documentModel);
}
Also used : HtmlPolicy(com.intellij.psi.formatter.xml.HtmlPolicy) XmlBlock(com.intellij.psi.formatter.xml.XmlBlock) PsiFile(com.intellij.psi.PsiFile) XmlFormattingModel(com.intellij.lang.xml.XmlFormattingModel) FormattingDocumentModelImpl(com.intellij.psi.formatter.FormattingDocumentModelImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with XmlFormattingModel

use of com.intellij.lang.xml.XmlFormattingModel in project intellij-community by JetBrains.

the class XhtmlFormattingModelBuilder method createModel.

@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
    final PsiFile psiFile = element.getContainingFile();
    final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
    return new XmlFormattingModel(psiFile, new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile), null, null, new HtmlPolicy(settings, documentModel), null, null, false), documentModel);
}
Also used : HtmlPolicy(com.intellij.psi.formatter.xml.HtmlPolicy) XmlBlock(com.intellij.psi.formatter.xml.XmlBlock) PsiFile(com.intellij.psi.PsiFile) XmlFormattingModel(com.intellij.lang.xml.XmlFormattingModel) FormattingDocumentModelImpl(com.intellij.psi.formatter.FormattingDocumentModelImpl) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

XmlFormattingModel (com.intellij.lang.xml.XmlFormattingModel)2 PsiFile (com.intellij.psi.PsiFile)2 FormattingDocumentModelImpl (com.intellij.psi.formatter.FormattingDocumentModelImpl)2 HtmlPolicy (com.intellij.psi.formatter.xml.HtmlPolicy)2 XmlBlock (com.intellij.psi.formatter.xml.XmlBlock)2 NotNull (org.jetbrains.annotations.NotNull)2