class DefaultWorkbenchFeaturesMenusHelper {

    public TopLevelMenusBuilder<MenuBuilder> buildMenusFromNavTree(NavTree navTree) {
        if (navTree == null) {
            return null;
        }

        MenuBuilder<TopLevelMenusBuilder<MenuBuilder>> builder = null;
        for (NavItem navItem : navTree.getRootItems()) {

            // Skip dividers
            if (navItem instanceof NavDivider) {
                continue;
            }
            // AF-953: Ignore empty groups
            if (navItem instanceof NavGroup && ((NavGroup) navItem).getChildren().isEmpty()) {
                continue;
            }
            // Build a top level menu entry
            if (builder == null) {
                builder = MenuFactory.newTopLevelMenu(navItem.getName());
            } else {
                builder = builder.endMenu().newTopLevelMenu(navItem.getName());
            }
            // Append its children
            if (navItem instanceof NavGroup) {
                List<MenuItem> childItems = buildMenuItemsFromNavGroup((NavGroup) navItem);
                builder.withItems(childItems);
            }
            // Append the place request
            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);
            if (navCtx.getResourceId() != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {
                PlaceRequest placeRequest = resolvePlaceRequest(navCtx.getResourceId());
                builder = builder.place(placeRequest);
            }
        }
        return builder != null ? builder.endMenu() : null;
    }

    public  DefaultWorkbenchFeaturesMenusHelper();
    @Inject public  DefaultWorkbenchFeaturesMenusHelper(SyncBeanManager iocManager,
                                               ActivityManager activityManager,
                                               PerspectiveManager perspectiveManager,
                                               Caller<AuthenticationService> authService,
                                               User identity,
                                               UserMenu userMenu,
                                               UtilityMenuBar utilityMenuBar,
                                               WorkbenchMegaMenuPresenter menuBar,
                                               AboutCommand aboutCommand,
                                               AuthorizationManager authorizationManager,
                                               SessionInfo sessionInfo,
                                               PlaceManager placeManager);

}