Deprecate FormattingModelBuilderEx.getIndentOptionsToUse(), replaced with FileIndentOptionsProvider.

This commit is contained in:
Rustam Vishnyakov
2015-03-05 13:27:24 +03:00
parent 84c317be1b
commit fc99d5cffc
3 changed files with 7 additions and 14 deletions
@@ -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);
* <code>null</code> to trigger default algorithm usage
* @deprecated Use <code>FileIndentOptionsProvider</code> instead.
* @see com.intellij.psi.codeStyle.FileIndentOptionsProvider
*/
@SuppressWarnings("UnusedDeclaration")
@Nullable
@Deprecated
CommonCodeStyleSettings.IndentOptions getIndentOptionsToUse(@NotNull PsiFile file,
@NotNull FormatTextRanges ranges,
@NotNull CodeStyleSettings settings);
@@ -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) {
@@ -94,13 +94,7 @@ abstract class CodeStyleManagerRunnable<T> {
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);