private Indent calcIndentBefore(final ASTNode child, final int state) {
    if (state == AFTER_ELSE) {
      if (!mySettings.SPECIAL_ELSE_IF_TREATMENT) {
        return getCodeBlockInternalIndent(1);
      } else {
        return getCodeBlockExternalIndent();
      }
    }
    if (state == BEFORE_BLOCK && (isSimpleStatement(child) || child.getElementType() == JavaElementType.BLOCK_STATEMENT)){
      return getCodeBlockInternalIndent(0);
    }
    if (state == BEFORE_FIRST) {
      return getCodeBlockExternalIndent();
    }
    if (child.getElementType() == JavaTokenType.ELSE_KEYWORD) {
      return getCodeBlockExternalIndent();
    }
    if (child.getPsi() instanceof PsiTypeElement) {
      return Indent.getNoneIndent();
    }

    return Indent.getContinuationIndent(myIndentSettings.USE_RELATIVE_INDENTS);
  }
private Indent calcIndentBefore(final ASTNode child, final int state)