private IExtenderProvider[] GetExtenderProviders(ISite site) {
// See if this component's site has an IExtenderListService. If it
// does, we get our list of extenders from that, not from the container.
//
IExtenderListService listService = (IExtenderListService)site.GetService(typeof(IExtenderListService));
if (listService != null) {
return listService.GetExtenderProviders();
}
else {
ComponentCollection comps = site.Container.Components;
ArrayList exList = null;
foreach(IComponent comp in comps) {
if (comp is IExtenderProvider) {
if (exList == null) {
exList = new ArrayList(2);
}
exList.Add(comp);
}
}
if (exList == null) {
return null;
}
else {
IExtenderProvider[] temp = new IExtenderProvider[exList.Count];
exList.CopyTo(temp, 0);
return temp;
}
}
}