/**
  * Adds a submenu containing a given list of actions. The menu is only added if there is at least
  * one visible action in the list.
  *
  * @param imageDescriptor
  */
 private void addSubmenu(
     IMenuManager parent,
     String label,
     ImageDescriptor imageDescriptor,
     ImmutableList<IAction> actions) {
   if (actions != null && !actions.isEmpty()) {
     boolean notEmpty = false;
     MenuManager submenu = new MenuManager(label);
     for (IAction a : actions) {
       notEmpty |= addVisible(submenu, a);
     }
     if (notEmpty) {
       submenu.setImageDescriptor(imageDescriptor);
       parent.add(submenu);
     }
   }
 }