public void AddNodeFor(Document.DocumentPart part, bool refreshParent) { if (part is Document.Alert) { AddAlert(part as Document.Alert, null, refreshParent); } else if (part is Document.TestParameter) { AddTestParameter(part as Document.TestParameter, null, refreshParent); } else if (part is Document.AutomatedTest) { AddTest(part as Document.AutomatedTest, null, refreshParent); } else if (part is Document.Target) { AddTarget(part as Document.Target, null, refreshParent); } else if (part is Document.Project) { AddProject(part as Document.Project); } else { throw new ApplicationException("Internal error: Invalid document part type: " + part.GetType().ToString()); } }
public ContextMenuStrip GetContextMenuFor(Document.DocumentPart part) { if (part == null) { return(null); } if (part is Document.Alert) { return(ctxAlert); } else if (part is Document.TestParameter) { return(ctxTestParameter); } else if (part is Document.AutomatedTest) { return(ctxTest); } else if (part is Document.Target) { return(ctxTarget); } else if (part is Document.Project) { return(ctxProject); } else { throw new ApplicationException("Internal error: Invalid document part type: " + part.GetType().ToString()); } }
////////////////////////////////////////////////////////////////////////////////////////// public void RemoveNodeFor(Document.DocumentPart part) { if (part is Document.Alert) { RemoveAlert(part as Document.Alert); } else if (part is Document.TestParameter) { RemoveTestParameter(part as Document.TestParameter); } else if (part is Document.AutomatedTest) { RemoveTest(part as Document.AutomatedTest); } else if (part is Document.Target) { RemoveTarget(part as Document.Target); } else if (part is Document.Project) { //RemoveProject(part as Document.Project); } else { throw new ApplicationException("Internal error: Invalid document part type: " + part.GetType().ToString()); } }
public void SelectNodeFor(Document.DocumentPart part) { if (part != null) { TreeNode[] foundNodes = tree.Nodes.Find(part.ID.ToString(), true); if (foundNodes.Length != 0) { tree.SelectedNode = foundNodes[0]; } } }
private void tree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == MouseButtons.Right) { TreeViewHitTestInfo i = tree.HitTest(e.Location); if (i.Location == TreeViewHitTestLocations.Label || i.Location == TreeViewHitTestLocations.Image || i.Location == TreeViewHitTestLocations.StateImage) { tree.SelectedNode = e.Node; Document.DocumentPart part = e.Node.Tag as Document.DocumentPart; ContextMenuStrip menu = treeViewAdapter.GetContextMenuFor(part); if (menu != null) { menu.Show(tree.PointToScreen(e.Location)); } } } }
////////////////////////////////////////////////////////////////////////////////////////// public void ClearChildNodesFor(Document.DocumentPart part, string collectionName) { if (part is Document.AutomatedTest) { ClearChildNodesTest(part as Document.AutomatedTest, collectionName); } else if (part is Document.Target) { ClearChildNodesTarget(part as Document.Target, collectionName); } else if (part is Document.Project) { ClearChildNodesProject(part as Document.Project, collectionName); } else { throw new ApplicationException("Internal error: Invalid document part type: " + part.GetType().ToString()); } }
protected void CreateNodeForDocumentPart(Document.DocumentPart documentPart, TreeNode parentNode) { if (documentPart is Document.Site) { Document.Site site = documentPart as Document.Site; TreeNode node = new TreeNode("site: " + project.Name); node.Tag = site; node.ImageKey = node.SelectedImageKey = "site"; foreach (Document.DocumentPart childPart in site.Contents) { CreateNodeForDocumentPart(childPart, node); } treeControl.Nodes.Add(node); } else if (documentPart is Document.Folder) { Document.Folder folder = documentPart as Document.Folder; TreeNode node = new TreeNode("folder: " + folder.Name); node.Tag = folder; node.ImageKey = node.SelectedImageKey = "folder_closed"; foreach (Document.DocumentPart childPart in folder.Contents) { CreateNodeForDocumentPart(childPart, node); } parentNode.Nodes.Add(node); } else // File { Document.File file = documentPart as Document.File; TreeNode node = new TreeNode("file: " + file.Name + ", mapped to: " + file.MappedTo); node.Tag = file; node.ImageKey = node.SelectedImageKey = "parameter"; parentNode.Nodes.Add(node); } }