code: private void collectRequiredAddons(AddonInfo addonInfo, List<AddonInfo> addons)
     {
        // Move this addon to the top of the list
        addons.remove(addonInfo);
        addons.add(0, addonInfo);
        for (AddonId addonId : addonInfo.getRequiredAddons())
        {
           if (!addons.contains(addonId) && (!isDeployed(addonId) || !isEnabled(addonId)))
           {
              AddonInfo childInfo = info(addonId);
              collectRequiredAddons(childInfo, addons);
           }
        }
     }
docs: Collect all required addons for a specific addon.
  
  It traverses the whole graph
  
  @param addonInfo
  @param addons