diff --git a/platform/lang-impl/src/com/intellij/formatting/FormattingModelBuilderEx.java b/platform/lang-impl/src/com/intellij/formatting/FormattingModelBuilderEx.java
index f08c374d36b4..0b0c83851740 100644
--- a/platform/lang-impl/src/com/intellij/formatting/FormattingModelBuilderEx.java
+++ b/platform/lang-impl/src/com/intellij/formatting/FormattingModelBuilderEx.java
@@ -50,8 +50,12 @@ public interface FormattingModelBuilderEx extends FormattingModelBuilder {
* @param settings code style settings holder
* @return indent options to use for the target formatting operation (if any adjustment is required);
* null to trigger default algorithm usage
+ * @deprecated Use FileIndentOptionsProvider instead.
+ * @see com.intellij.psi.codeStyle.FileIndentOptionsProvider
*/
+ @SuppressWarnings("UnusedDeclaration")
@Nullable
+ @Deprecated
CommonCodeStyleSettings.IndentOptions getIndentOptionsToUse(@NotNull PsiFile file,
@NotNull FormatTextRanges ranges,
@NotNull CodeStyleSettings settings);
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java
index dc24b2b1d583..f1cf75b4a2fe 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeFormatterFacade.java
@@ -237,13 +237,8 @@ public class CodeFormatterFacade {
formatter.setProgressTask(new FormattingProgressTask(project, file, document));
}
- CommonCodeStyleSettings.IndentOptions indentOptions = null;
- if (builder instanceof FormattingModelBuilderEx) {
- indentOptions = ((FormattingModelBuilderEx)builder).getIndentOptionsToUse(file, ranges, mySettings);
- }
- if (indentOptions == null) {
- indentOptions = mySettings.getIndentOptionsByFile(file, textRanges.size() == 1 ? textRanges.get(0).getTextRange() : null);
- }
+ CommonCodeStyleSettings.IndentOptions indentOptions =
+ mySettings.getIndentOptionsByFile(file, textRanges.size() == 1 ? textRanges.get(0).getTextRange() : null);
formatter.format(model, mySettings, indentOptions, ranges);
for (FormatTextRanges.FormatTextRange range : textRanges) {
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerRunnable.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerRunnable.java
index f3e6df48ae1c..c220e5078f27 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerRunnable.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleManagerRunnable.java
@@ -94,13 +94,7 @@ abstract class CodeStyleManagerRunnable {
mySettings = CodeStyleSettingsManager.getSettings(myCodeStyleManager.getProject());
mySignificantRange = offset != -1 ? getSignificantRange(file, offset) : null;
-
- if (builder instanceof FormattingModelBuilderEx) {
- myIndentOptions = ((FormattingModelBuilderEx)builder).getIndentOptionsToUse(file, new FormatTextRanges(mySignificantRange, true), mySettings);
- }
- if (myIndentOptions == null) {
- myIndentOptions = mySettings.getIndentOptionsByFile(file);
- }
+ myIndentOptions = mySettings.getIndentOptionsByFile(file, mySignificantRange);
myModel = CoreFormatterUtil.buildModel(builder, file, mySettings, myMode);