Block (@NotNull PsiElement rootElement) { FormattingModelBuilder formattingModelBuilder = LanguageFormatting.INSTANCE.forContext(rootElement); CodeStyleSettings settings = CodeStyle.getSettings(rootElement.getContainingFile()); if (formattingModelBuilder != null) { FormattingModel formattingModel = formattingModelBuilder.createModel( FormattingContext.create(rootElement, settings)); return formattingModel.getRootBlock(); } else { return null; } }