/*
 * Copyright 2010-2013 napile.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.napile.playJava4idea.template.base.formatter;

import java.util.List;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.napile.playJava4idea.template.base.parser.PlayBaseTemplateSimplyTokens;
import com.intellij.formatting.Alignment;
import com.intellij.formatting.Wrap;
import com.intellij.formatting.templateLanguages.DataLanguageBlockWrapper;
import com.intellij.formatting.templateLanguages.TemplateLanguageBlock;
import com.intellij.formatting.templateLanguages.TemplateLanguageBlockFactory;
import com.intellij.lang.ASTNode;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.tree.IElementType;

/**
 * @author VISTALL
 * @since 18:04/26.03.13
 */
public class PlayBaseTemplateBlock extends TemplateLanguageBlock
{
	protected PlayBaseTemplateBlock(@NotNull ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment, @NotNull TemplateLanguageBlockFactory blockFactory, @NotNull CodeStyleSettings settings, @Nullable List<DataLanguageBlockWrapper> foreignChildren)
	{
		super(node, wrap, alignment, blockFactory, settings, foreignChildren);
	}

	@Override
	protected IElementType getTemplateTextElementType()
	{
		return PlayBaseTemplateSimplyTokens.TEMPLATE_TEXT;
	}
}

@@ -851,38 +851,220 @@
 ort 
-com.intellij.formatting.Alignm
+org.napile.playJava4idea.template.base.psi.PlayBaseTemplateFile;%0Aimport org.napile.playJava4idea.template.base.psi.PlayBaseTemplateTag;%0Aimport com.intellij.formatting.Alignment;%0Aimport com.intellij.formatting.Ind
 ent;
@@ -1361,16 +1361,52 @@
 STNode;%0A
+import com.intellij.psi.PsiElement;%0A
 import c
@@ -1871,16 +1871,16 @@
 ren)%0A%09%7B%0A
-
 %09%09super(
@@ -1948,16 +1948,293 @@
 n);%0A%09%7D%0A%0A
+%09@Override%0A%09public Indent getIndent()%0A%09%7B%0A%09%09final PsiElement psi = getNode().getPsi();%0A%09%09if(psi instanceof PlayBaseTemplateTag)%0A%09%09%7B%0A%09%09%09if(!(psi.getParent() instanceof PlayBaseTemplateFile))%0A%09%09%09%7B%0A%09%09%09%09return Indent.getNormalIndent();%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return Indent.getNoneIndent();%0A%09%7D%0A%0A
 %09@Overri

fix indent