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.element.TokenElementType;
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 IterationIgnoreWrappingPreset extends IterationAbstractPreset {
public IterationIgnoreWrappingPreset() {
super("ignore_wrapping", "Ignore");
}
public Wrap getWrap(BasePsiElement psiElement, CodeStyleSettings settings) {
return null;
}
public Spacing getSpacing(BasePsiElement psiElement, CodeStyleSettings settings) {
BasePsiElement parentPsiElement = getParentPsiElement(psiElement);
IterationElementType iterationElementType = (IterationElementType) parentPsiElement.getElementType();
ElementType elementType = psiElement.getElementType();
if (elementType instanceof TokenElementType) {
TokenElementType tokenElementType = (TokenElementType) elementType;
if (iterationElementType.isSeparator(tokenElementType)) {
return tokenElementType.isCharacter() ?
SPACING_NO_SPACE :
SPACING_ONE_SPACE;
}
}
return null;
}
}