TreeElement (TreeElement first, ASTNode last, ASTNode anchor, Boolean before) { if (anchor == null){ if (before == null || before.booleanValue()){ anchor = findChildByRole(ChildRole.RBRACE); before = Boolean.TRUE; } else{ anchor = findChildByRole(ChildRole.LBRACE); before = Boolean.FALSE; } } if (before == Boolean.TRUE) { while (anchor != null && isNonJavaStatement(anchor)) { anchor = anchor.getTreePrev(); before = Boolean.FALSE; } } else if (before == Boolean.FALSE) { while (anchor != null && isNonJavaStatement(anchor)) { anchor = anchor.getTreeNext(); before = Boolean.TRUE; } } return super.addInternal(first, last, anchor, before); }