@Override
  public @NotNull ChildAttributes getChildAttributes(final int newChildIndex) {
    if (isAfter(newChildIndex, new IElementType[]{JavaDocElementType.DOC_COMMENT})) {
      return new ChildAttributes(Indent.getNoneIndent(), null);
    }

    if (myNode.getElementType() == JavaElementType.FOR_STATEMENT && mySettings.ALIGN_MULTILINE_FOR && isInsideForParens(newChildIndex)) {
      Alignment prev = getUsedAlignment(newChildIndex);
      if (prev != null) {
        return new ChildAttributes(null, prev);
      }
    }

    if (newChildIndex == 0) {
      return new ChildAttributes(getCodeBlockExternalIndent(), null);
    }

    boolean useExternalIndent = false;
    if (newChildIndex == getSubBlocks().size()) {
      useExternalIndent = true;
    }
    else if (TYPES_OF_STATEMENTS_WITH_OPTIONAL_BRACES.contains(myNode.getElementType())) {
      // There is a possible case that we have situation like below:
      //    if (true) <enter was pressed here>
      //    <caret>
      //    System.out.println();
      // We would like to indent current caret position then because there is a high probability that the user starts
      // typing there (populating statement body). So, we perform dedicated check for that here and use 'external indent'
      // if necessary.
      Block prevBlock = getSubBlocks().get(newChildIndex - 1);
      Block nextBlock = getSubBlocks().get(newChildIndex);
      if (prevBlock instanceof ASTBlock && nextBlock instanceof ASTBlock) {
        ASTNode prevNode = ((ASTBlock)prevBlock).getNode();
        ASTNode nextNode = ((ASTBlock)nextBlock).getNode();
        if (prevNode != null && nextNode != null && prevNode.getElementType() == JavaTokenType.RPARENTH
            && nextNode.getElementType() != JavaTokenType.LBRACE)
        {
          useExternalIndent = true;
        }
      }
    }

    if (useExternalIndent) {
      return new ChildAttributes(getCodeBlockChildExternalIndent(newChildIndex), null);
    }
    else {
      return new ChildAttributes(myIndentsBefore.get(newChildIndex), getUsedAlignment(newChildIndex));
    }
  }
@Override
  public @NotNull ChildAttributes getChildAttributes(final int newChildIndex)