public static FormattingMode getCurrentFormattingMode(@NotNull Project project) {
    if (!project.isDisposed()) {
      CodeStyleManager instance = getInstance(project);
      if (instance instanceof FormattingModeAwareIndentAdjuster) {
        return ((FormattingModeAwareIndentAdjuster)instance).getCurrentFormattingMode();
      }
    }
    return FormattingMode.REFORMAT;
  }
public static FormattingMode getCurrentFormattingMode(@NotNull Project project)