package com.dci.intellij.dbn.code.common.style.presets.iteration;
import com.dci.intellij.dbn.language.common.element.ElementType;
import com.dci.intellij.dbn.language.common.element.IterationElementType;
import com.dci.intellij.dbn.language.common.psi.BasePsiElement;
import com.intellij.formatting.Spacing;
import com.intellij.formatting.Wrap;
import com.intellij.psi.codeStyle.CodeStyleSettings;
public class IterationChopDownAlwaysPreset extends IterationAbstractPreset {
public IterationChopDownAlwaysPreset() {
super("chop_down", "Chop down");
}
public boolean accepts(BasePsiElement psiElement) {
return getParentElementType(psiElement) instanceof IterationElementType;
}
public Wrap getWrap(BasePsiElement psiElement, CodeStyleSettings settings) {
BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
ElementType elementType = psiElement.getElementType();
return getWrap(elementType, iterationElementType, true);
}
public Spacing getSpacing(BasePsiElement psiElement, CodeStyleSettings settings) {
BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
ElementType elementType = psiElement.getElementType();
return getSpacing(iterationElementType, elementType, true);
}
}