HashSet <IDsDocument> GetModifiedDocuments(IDsDocument document) { var documentsHash = new HashSet <IDsDocument>(); documentsHash.Add(document); var node = DocumentTreeView.FindNode(document); if (node is ModuleDocumentNode) { if (node.Document.AssemblyDef != null && node.Document.AssemblyDef.ManifestModule == node.Document.ModuleDef) { var asmNode = node.GetAssemblyNode(); Debug.Assert(asmNode != null); if (asmNode != null) { documentsHash.Add(asmNode.Document); } } } else if (node is AssemblyDocumentNode) { node.TreeNode.EnsureChildrenLoaded(); var manifestModNode = node.TreeNode.DataChildren.FirstOrDefault() as ModuleDocumentNode; Debug.Assert(manifestModNode != null); if (manifestModNode != null) { documentsHash.Add(manifestModNode.Document); } } return(documentsHash); }
void DocumentTreeView_NodeActivated(object sender, DocumentTreeNodeActivatedEventArgs e) { e.Handled = true; var asmRefNode = e.Node as IAssemblyReferenceNode; if (asmRefNode != null) { var asm = DocumentTreeView.DocumentService.Resolve(asmRefNode.AssemblyRef, asmRefNode.GetModule()); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var asmNode = DocumentTreeView.FindNode(asm); if (asmNode != null) { DocumentTreeView.TreeView.SelectItems(new ITreeNodeData[] { asmNode }); } })); return; } var derivedTypeNode = e.Node as IDerivedTypeNode; if (derivedTypeNode != null) { var td = derivedTypeNode.TypeDef; Debug.Assert(td != null); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var typeNode = DocumentTreeView.FindNode(td); if (typeNode != null) { DocumentTreeView.TreeView.SelectItems(new ITreeNodeData[] { typeNode }); } })); return; } var baseTypeNode = e.Node as IBaseTypeNode; if (baseTypeNode != null) { var tdr = baseTypeNode.TypeDefOrRef; Debug.Assert(tdr != null); var td = tdr?.ScopeType.ResolveTypeDef(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var typeNode = DocumentTreeView.FindNode(td); if (typeNode != null) { DocumentTreeView.TreeView.SelectItems(new ITreeNodeData[] { typeNode }); } })); return; } var tab = ActiveTabContentImpl; if (tab == null) { return; } SetFocus(tab); }