Object (Object component, Object part, boolean forward, boolean popup) { if (forward) { if (part != null) { part = get(part, ":next"); } if (part == null) { part = get(popup ? get(component, "menu") : component, "menu"); } } else { Object prev = get(popup ? get(component, "menu") : component, "menu"); for (Object next = get(prev, ":next"); (next != null) && (next != part); next = get(next, ":next")) { prev = next; } part = prev; } return (getClass(part) == "separator") ? getMenu(component, part, forward, popup) : part; }