public static ContextMenuStrip CreateContextMenu(object owner, string addInTreePath) { if (addInTreePath == null) { return(null); } try { ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner); ContextMenuStrip contextMenu = new ContextMenuStrip(); contextMenu.Items.Add(new ToolStripMenuItem("dummy")); contextMenu.Opening += delegate { contextMenu.Items.Clear(); foreach (object item in buildItems) { if (item is ToolStripItem) { contextMenu.Items.Add((ToolStripItem)item); } else { ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item; contextMenu.Items.AddRange(submenuBuilder.BuildSubmenu(null, owner)); } } }; contextMenu.Opened += ContextMenuOpened; contextMenu.Closed += ContextMenuClosed; return(contextMenu); } catch (TreePathNotFoundException) { MessageService.ShowError("Warning tree path '" + addInTreePath + "' not found."); return(null); } }
public static object BuildItem(string path, object caller) { int num = path.LastIndexOf('/'); string path2 = path.Substring(0, num); string childItemID = path.Substring(num + 1); AddInTreeNode treeNode = AddInTree.GetTreeNode(path2); return(treeNode.BuildChildItem(childItemID, caller, new System.Collections.ArrayList(AddInTree.BuildItems <object>(path, caller, false)))); }
public static System.Collections.Generic.List <T> BuildItems <T>(string path, object caller, bool throwOnNotFound) { AddInTreeNode treeNode = AddInTree.GetTreeNode(path, throwOnNotFound); if (treeNode == null) { return(new System.Collections.Generic.List <T>()); } return(treeNode.BuildChildItems <T>(caller)); }
public void Apply(IList items) { AddInTreeNode node; try { node = AddInTree.GetTreeNode(path); foreach (object o in node.BuildChildItems(caller)) { items.Add(o); } } catch (TreePathNotFoundException) { MessageService.ShowError("IncludeDoozer: AddinTree-Path not found: " + path); } }
public void Apply(IList items) { AddInTreeNode node = AddInTree.GetTreeNode(path, false); if (node != null) { foreach (object o in node.BuildChildItems <object>(caller, additionalConditions)) { items.Add(o); } } else { throw new CoreException("IncludeDoozer: AddinTree-Path not found: " + path); } }
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); } }
public static ToolStrip[] CreateToolbars(object owner, string addInTreePath) { AddInTreeNode treeNode; try { treeNode = AddInTree.GetTreeNode(addInTreePath); } catch (TreePathNotFoundException) { return(null); } List <ToolStrip> toolBars = new List <ToolStrip>(); foreach (AddInTreeNode childNode in treeNode.ChildNodes.Values) { toolBars.Add(CreateToolStrip(owner, childNode)); } return(toolBars.ToArray()); }
public static void AddItemsToMenu(ToolStripItemCollection collection, object owner, string addInTreePath) { ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner); foreach (object item in buildItems) { if (item is ToolStripItem) { collection.Add((ToolStripItem)item); if (item is IStatusUpdate) { ((IStatusUpdate)item).UpdateStatus(); } } else { ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item; collection.AddRange(submenuBuilder.BuildSubmenu(null, owner)); } } }
public static ToolStrip CreateToolStrip(object owner, string addInTreePath) { return(CreateToolStrip(owner, AddInTree.GetTreeNode(addInTreePath))); }
public static AddInTreeNode GetTreeNode(string path) { return(AddInTree.GetTreeNode(path, true)); }