/// <summary> /// PropagatesDependancy the elementToAdd to the dependancies of the elementToBrowse /// </summary> /// <param name="elementToBrowse"></param> /// <param name="elementToAdd"></param> private void PropagatesDependancy(Utils.ModelElement elementToBrowse, Utils.ModelElement elementToAdd) { if (!BrowsedElements.Contains(elementToBrowse)) { BrowsedElements.Add(elementToBrowse); elementToAdd.AddDependancy(elementToBrowse); if (elementToBrowse.CacheDependancy != null) { foreach (Utils.ModelElement depending in elementToBrowse.CacheDependancy) { object current = depending; while (current != null) { Utils.ModelElement currentElement = current as Utils.ModelElement; if (currentElement != null) { PropagatesDependancy(currentElement, elementToAdd); } IEnclosed enclosed = current as IEnclosed; if (enclosed != null) { current = enclosed.Enclosing; } else { current = null; } } } } } }