final LiteralHashElements access = grammarAccess.getLiteralHashAccess();
final HashEntryElements hashAccess = grammarAccess.getHashEntryAccess();
int previousKeyWidth = 0;
while(itor.hasNext()) {
IDomNode n = itor.next();
EObject ge = n.getGrammarElement();
if(ge == access.getLeftCurlyBracketKeyword_1()) {
IDomNode nextLeaf = DomModelUtils.nextWhitespace(n);
if(DomModelUtils.isWhitespace(nextLeaf) && breakAndAlign)
nextLeaf.getStyles().add(StyleSet.withStyles(styles.oneLineBreak()));
}
else if(breakAndAlign) {
if(ge == access.getCommaKeyword_2_1_0()) {
IDomNode nextLeaf = DomModelUtils.nextWhitespace(n);
if(DomModelUtils.isWhitespace(nextLeaf))
nextLeaf.getStyles().add(StyleSet.withStyles(styles.oneLineBreak()));
}
else if(ge == hashAccess.getKeyLiteralNameOrStringParserRuleCall_0_0()) {
DelegatingLayoutContext keyContext = new DelegatingLayoutContext(context);
TextFlow keyFlow = new TextFlow(keyContext);
ArrayList<IDomNode> children = Lists.newArrayList(n.getChildren());
for(Iterator<IDomNode> subitor = children.iterator(); subitor.hasNext();) {
IDomNode x = subitor.next();
NodeType t = x.getNodeType();
if(t == NodeType.ACTION || t == NodeType.WHITESPACE) {
subitor.remove();
continue;
}
break; // first non whitespace or action