private static void AddExtensionPath(ExtensionPath path) { AddInTreeNode treePath = CreatePath(rootNode, path.Name); foreach (IEnumerable <Codon> innerCodons in path.GroupedCodons) { treePath.AddCodons(innerCodons); } }
/// <summary> /// Builds a single item in the addin tree. /// </summary> /// <param name="path">A path to the item in the addin tree.</param> /// <param name="caller">The owner used to create the objects.</param> /// <exception cref="TreePathNotFoundException">The path does not /// exist or does not point to an item.</exception> public static object BuildItem(string path, object caller) { int pos = path.LastIndexOf('/'); string parent = path.Substring(0, pos); string child = path.Substring(pos + 1); AddInTreeNode node = GetTreeNode(parent); return(node.BuildChildItem(child, caller, new ArrayList(BuildItems <object>(path, caller, false)))); }
/// <summary> /// Builds the items in the path. Ensures that all items have the type T. /// </summary> /// <param name="path">A path in the addin tree.</param> /// <param name="caller">The owner used to create the objects.</param> /// <param name="throwOnNotFound">If true, throws a <see cref="TreePathNotFoundException"/> /// if the path is not found. If false, an empty ArrayList is returned when the /// path is not found.</param> public static List <T> BuildItems <T>(string path, object caller, bool throwOnNotFound) { AddInTreeNode node = GetTreeNode(path, throwOnNotFound); if (node == null) { return(new List <T>()); } else { return(node.BuildChildItems <T>(caller)); } }
public void Apply(IList items) { AddInTreeNode node = AddInTree.GetTreeNode(path, false); if (node != null) { foreach (object o in node.BuildChildItems(caller)) { items.Add(o); } } else { MessageService.ShowError("IncludeDoozer: AddinTree-Path not found: " + path); } }
private static AddInTreeNode CreatePath(AddInTreeNode localRoot, string path) { if (path == null || path.Length == 0) { return(localRoot); } string[] splittedPath = path.Split('/'); AddInTreeNode curPath = localRoot; int i = 0; while (i < splittedPath.Length) { if (!curPath.ChildNodes.ContainsKey(splittedPath[i])) { curPath.ChildNodes[splittedPath[i]] = new AddInTreeNode(); } curPath = curPath.ChildNodes[splittedPath[i]]; ++i; } return(curPath); }
/// <summary> /// Checks whether the specified path exists in the AddIn tree. /// </summary> public static bool ExistsTreeNode(string path) { if (path == null || path.Length == 0) { return(true); } string[] splittedPath = path.Split('/'); AddInTreeNode curPath = rootNode; int i = 0; while (i < splittedPath.Length) { // curPath = curPath.ChildNodes[splittedPath[i]] - check if child path exists if (!curPath.ChildNodes.TryGetValue(splittedPath[i], out curPath)) { return(false); } ++i; } return(true); }