DiagramElement from = fromg == null ? null : getExtensionElement(((Contained)fromg).getContainer(), fromg, lastArrows, lengths, true);
DiagramElement tog = buildGlyph(c, cs.getTo(), cs.getToGroup(), stateMap, headerGlyphs, rootElements, elementStack, elementDepth);
if (from != null) {
DiagramElement to = getExtensionElement(((Contained)tog).getContainer(), tog, lastArrows, lengths, false);
Direction d = getDirectionFor(getArrowDirection());
boolean fromBefore = isFromBefore2(rootElements, elementDepth, fromg, tog);
if (!fromBefore) {
d = Direction.reverse(d);
}
createLink(s, from, to, d);
}
elementStack.push(tog);
} else if (s instanceof ReturnStep) {
DiagramElement fromg = elementStack.pop();
if (((ReturnStep)s).isShow()) {
DiagramElement from = getExtensionElement(((Contained)fromg).getContainer(), fromg, lastArrows, lengths, true);
DiagramElement tog = elementStack.peek();
DiagramElement to = getExtensionElement(((Contained)tog).getContainer(), tog, lastArrows, lengths, false);
Direction d = getDirectionFor(getArrowDirection());
boolean fromBefore = isFromBefore2(rootElements, elementDepth, fromg, tog);
if (!fromBefore) {
d = Direction.reverse(d);
}