// Path: src/cmake/global/CMakeLanguage.java
// public class CMakeLanguage extends Language {
//     public static final CMakeLanguage INSTANCE = new CMakeLanguage();
// 
//     private CMakeLanguage() {
//         super("CMake");
//     }
// }


import cmake.global.CMakeLanguage;
import cmake.psi.CMakeTypes;
import com.intellij.formatting.*;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
package cmake.format;


/**
 * Created by alex on 1/11/15.
 */
public class CMakeFormattingModuleBuilder implements FormattingModelBuilder {
    @NotNull
    @Override
    public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {

        CMakeCodeStyleSettings cmakeSettings = settings.getCustomSettings(CMakeCodeStyleSettings.class);
        SpacingBuilder spacingBuilder = createSpacingBuilder(settings, cmakeSettings);
        CMakeFormattingBlock block = new CMakeFormattingBlock(element.getNode(),
                Wrap.createWrap(WrapType.NONE,true),
                null,
                spacingBuilder);
        return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings);
    }

    private static SpacingBuilder createSpacingBuilder(@NotNull CodeStyleSettings settings,
                                                       CMakeCodeStyleSettings cmakeSettings) {
        
        //noinspection SuspiciousNameCombination
// Path: src/cmake/global/CMakeLanguage.java
// public class CMakeLanguage extends Language {
//     public static final CMakeLanguage INSTANCE = new CMakeLanguage();
// 
//     private CMakeLanguage() {
//         super("CMake");
//     }
// }


// Path: src/cmake/format/CMakeFormattingModuleBuilder.java
import cmake.global.CMakeLanguage;
import cmake.psi.CMakeTypes;
import com.intellij.formatting.*;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

package cmake.format;


/**
 * Created by alex on 1/11/15.
 */
public class CMakeFormattingModuleBuilder implements FormattingModelBuilder {
    @NotNull
    @Override
    public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {

        CMakeCodeStyleSettings cmakeSettings = settings.getCustomSettings(CMakeCodeStyleSettings.class);
        SpacingBuilder spacingBuilder = createSpacingBuilder(settings, cmakeSettings);
        CMakeFormattingBlock block = new CMakeFormattingBlock(element.getNode(),
                Wrap.createWrap(WrapType.NONE,true),
                null,
                spacingBuilder);
        return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings);
    }

    private static SpacingBuilder createSpacingBuilder(@NotNull CodeStyleSettings settings,
                                                       CMakeCodeStyleSettings cmakeSettings) {
        
        //noinspection SuspiciousNameCombination
        return new SpacingBuilder(settings, CMakeLanguage.INSTANCE)