added abstract getType method to Indent class

This commit is contained in:
Yaroslav Lepenkin
2015-06-17 14:10:46 +03:00
parent cbf8463974
commit c6f6dfaf15
3 changed files with 6 additions and 2 deletions
@@ -83,6 +83,8 @@ import org.jetbrains.annotations.NotNull;
public abstract class Indent {
private static IndentFactory myFactory;
public abstract Type getType();
static void setFactory(IndentFactory factory) {
myFactory = factory;
}
@@ -18,7 +18,7 @@ package com.intellij.formatting;
import org.jetbrains.annotations.NonNls;
public class IndentImpl extends Indent {
class IndentImpl extends Indent {
private final boolean myIsAbsolute;
private final boolean myRelativeToDirectParent;
@@ -38,6 +38,7 @@ public class IndentImpl extends Indent {
myEnforceIndentToChildren = enforceIndentToChildren;
}
@Override
public Type getType() {
return myType;
}
@@ -59,7 +59,8 @@ public class FormatterBasedLineIndentInfoBuilder {
List<Block> normallyIndentedBlocks = ContainerUtil.filter(getBlocksStartingNewLine(), new Condition<Block>() {
@Override
public boolean value(Block block) {
Indent.Type type = block.getIndent() instanceof IndentImpl ? ((IndentImpl)block.getIndent()).getType() : null;
Indent indent = block.getIndent();
Indent.Type type = indent != null ? indent.getType() : null;
return type == Indent.Type.NONE || type == Indent.Type.NORMAL;
}
});