private String getIndentMode() {
    String indentMode =
        JavaPlugin.getDefault()
            .getCombinedPreferenceStore()
            .getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);

    if (JavaCore.SPACE.equals(indentMode))
      return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_spaces;

    if (JavaCore.TAB.equals(indentMode))
      return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tabs;

    if (DefaultCodeFormatterConstants.MIXED.equals(indentMode))
      return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tabsAndSpaces;

    Assert.isTrue(false, "Illegal indent mode - must not happen"); // $NON-NLS-1$
    return null;
  }
  /*
   * @see SourceViewerConfiguration#getIndentPrefixes(ISourceViewer, String)
   */
  public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
    IJavaProject project = getProject();
    final int tabWidth = CodeFormatterUtil.getTabWidth(project);
    final int indentWidth = CodeFormatterUtil.getIndentWidth(project);
    boolean allowTabs = tabWidth <= indentWidth;

    String indentMode;
    if (project == null)
      indentMode = JavaCore.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
    else indentMode = project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, true);

    boolean useSpaces =
        JavaCore.SPACE.equals(indentMode) || DefaultCodeFormatterConstants.MIXED.equals(indentMode);

    Assert.isLegal(allowTabs || useSpaces);

    if (!allowTabs) {
      char[] spaces = new char[indentWidth];
      Arrays.fill(spaces, ' ');
      return new String[] {new String(spaces), ""}; // $NON-NLS-1$
    } else if (!useSpaces) return getIndentPrefixesForTab(tabWidth);
    else return getIndentPrefixesForSpaces(tabWidth);
  }
 /**
  * The preference setting that tells whether to insert spaces when pressing the Tab key.
  *
  * @return <code>true</code> if spaces are inserted when pressing the Tab key
  * @since 3.5
  */
 private boolean isInsertingSpacesForTab() {
   return JavaCore.SPACE.equals(
       getCoreOption(fProject, DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR));
 }