package com.intellij.application.options;

import com.intellij.psi.codeStyle.FileTypeIndentOptionsProvider;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.PsiFile;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;

/**
 * @author yole
 */
public class XmlIndentOptionsProvider implements FileTypeIndentOptionsProvider {
  public CodeStyleSettings.IndentOptions createIndentOptions() {
    return new CodeStyleSettings.IndentOptions();
  }

  public FileType getFileType() {
    return StdFileTypes.XML;
  }

  public IndentOptionsEditor createOptionsEditor() {
    return new SmartIndentOptionsEditor();
  }

  public String getPreviewText() {
    return CodeStyleAbstractPanel.readFromFile(getClass(), "preview.xml.template");
  }

  public void prepareForReformat(final PsiFile psiFile) {
  }
}

@@ -466,52 +466,238 @@
     
-return new CodeStyleSettings.IndentOptions()
+final CodeStyleSettings.IndentOptions options = new CodeStyleSettings.IndentOptions();%0A    // HACK %5Byole%5D%0A    if (System.getProperty(%22idea.platform.prefix%22).equals(%22Ruby%22)) %7B%0A      options.INDENT_SIZE = 2;%0A    %7D%0A    return options
 ;%0A  

integrate from RubyMine10: hack to set default XML indent to 2