use of com.intellij.psi.impl.source.codeStyle.PsiBasedFormatterModelWithShiftIndentInside in project intellij-community by JetBrains.
the class JavaFormattingModelBuilder method createModel.
@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
final FileElement fileElement = TreeUtil.getFileElement((TreeElement) SourceTreeToPsiMap.psiElementToTree(element));
LOG.assertTrue(fileElement != null, "File element should not be null for " + element);
CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
JavaCodeStyleSettings customJavaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
Block block = AbstractJavaBlock.newJavaBlock(fileElement, commonSettings, customJavaSettings);
FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile());
return new PsiBasedFormatterModelWithShiftIndentInside(element.getContainingFile(), block, model);
}
Aggregations