public LibraryNode(LibraryNode node) { _capabilities = node._capabilities; _contextMenuID = node._contextMenuID; _displayData = node._displayData; _name = node._name; _tooltip = node._tooltip; _type = node._type; _children = new List <LibraryNode>(); foreach (LibraryNode child in node._children) { _children.Add(child); } _clipboardFormats = new List <VSOBJCLIPFORMAT>(); foreach (VSOBJCLIPFORMAT format in node._clipboardFormats) { _clipboardFormats.Add(format); } _filteredView = new Dictionary <LibraryNodeType, LibraryNode>(); _updateCount = node._updateCount; }
internal void AddNode(LibraryNode node) { lock (this) { _root = new LibraryNode(_root); _root.AddNode(node); } }
internal void RemoveNode(LibraryNode node) { lock (this) { _root = new LibraryNode(_root); _root.RemoveNode(node); } }
internal void AddNode(LibraryNode node) { lock (_children) { _children.Add(node); } _updateCount++; }
internal void RemoveNode(LibraryNode node) { lock (_children) { _children.Remove(node); } _updateCount++; }
public LibraryNode(LibraryNode node) { _capabilities = node._capabilities; _contextMenuID = node._contextMenuID; _displayData = node._displayData; _name = node._name; _tooltip = node._tooltip; _type = node._type; _children = new List<LibraryNode>(); foreach (LibraryNode child in node._children) _children.Add(child); _clipboardFormats = new List<VSOBJCLIPFORMAT>(); foreach (VSOBJCLIPFORMAT format in node._clipboardFormats) _clipboardFormats.Add(format); _filteredView = new Dictionary<LibraryNodeType, LibraryNode>(); _updateCount = node._updateCount; }
void CreateModuleTree( LibraryNode root, LibraryNode current, ScopeNode scope, string namePrefix, ModuleID moduleId) { if ((null == root) || (null == scope) || (null == scope.NestedScopes)) { return; } foreach (ScopeNode subItem in scope.NestedScopes) { NemerleLibraryNode newNode = new NemerleLibraryNode( subItem, namePrefix, moduleId.Hierarchy, moduleId.ItemID); string newNamePrefix = namePrefix; // The classes are always added to the root node, the functions to the current node. // if ((newNode.NodeType & LibraryNode.LibraryNodeType.Members) != LibraryNode.LibraryNodeType.None) { current.AddNode(newNode); } else if ((newNode.NodeType & LibraryNode.LibraryNodeType.Classes) != LibraryNode.LibraryNodeType.None) { // Classes are always added to the root. // root.AddNode(newNode); newNamePrefix = newNode.Name + "."; } // Now use recursion to get the other types. // CreateModuleTree(root, newNode, subItem, newNamePrefix, moduleId); } }
/// <summary> /// Main function of the parsing thread. /// This function waits on the queue of the parsing requests and build /// the parsing tree for a specific file. The resulting tree is built /// using LibraryNode objects so that it can be used inside the class /// view or object browser. /// </summary> void ParseThread() { const int waitTimeout = 500; // Define the array of events this function is interest in. // WaitHandle[] eventsToWait = new WaitHandle[] { _requestPresent, _shutDownStarted }; // Execute the tasks. // while (true) { // Wait for a task or a shutdown request. // int waitResult = WaitHandle.WaitAny(eventsToWait, waitTimeout, false); if (1 == waitResult) // The shutdown of this component is started, so exit the thread. return; LibraryTask task = null; lock (_requests) { if (_requests.Count != 0) task = _requests.Dequeue(); if (_requests.Count == 0) _requestPresent.Reset(); } if (null == task) continue; ScopeNode scope = null; if (task.Text == null) { if (File.Exists(task.FileName)) { Debug.WriteLine("Parse request (no text): " + task.FileName + " " + task.ModuleID); return; } } else { Debug.WriteLine("Parse request: " + task.FileName + " " + task.ModuleID); return; } LibraryNode module = new LibraryNode( Path.GetFileName(task.FileName), LibraryNode.LibraryNodeType.PhysicalContainer); CreateModuleTree(module, module, scope, "", task.ModuleID); if (task.ModuleID != null) { LibraryNode previousItem; lock (_files) if (_files.TryGetValue(task.ModuleID, out previousItem)) _files.Remove(task.ModuleID); _library.RemoveNode(previousItem); } _library.AddNode(module); if (task.ModuleID != null) lock (_files) _files.Add(task.ModuleID, module); } }
void CreateModuleTree( LibraryNode root, LibraryNode current, ScopeNode scope, string namePrefix, ModuleID moduleId) { if ((null == root) || (null == scope) || (null == scope.NestedScopes)) return; foreach (ScopeNode subItem in scope.NestedScopes) { NemerleLibraryNode newNode = new NemerleLibraryNode( subItem, namePrefix, moduleId.Hierarchy, moduleId.ItemID); string newNamePrefix = namePrefix; // The classes are always added to the root node, the functions to the current node. // if ((newNode.NodeType & LibraryNode.LibraryNodeType.Members) != LibraryNode.LibraryNodeType.None) { current.AddNode(newNode); } else if ((newNode.NodeType & LibraryNode.LibraryNodeType.Classes) != LibraryNode.LibraryNodeType.None) { // Classes are always added to the root. // root.AddNode(newNode); newNamePrefix = newNode.Name + "."; } // Now use recursion to get the other types. // CreateModuleTree(root, newNode, subItem, newNamePrefix, moduleId); } }
public Library(Guid libraryGuid) { _guid = libraryGuid; _root = new LibraryNode("", LibraryNode.LibraryNodeType.Package); }
internal void RemoveNode(LibraryNode node) { lock (this) { _root = new LibraryNode(_root); _root.RemoveNode(node); } }
internal void AddNode(LibraryNode node) { lock (this) { _root = new LibraryNode(_root); _root.AddNode(node); } }
/// <summary> /// ���������� Find All References ������ ���� ��������� (� ����������� ������� ����� � �� ��-Nemerle ��������) /// � ����������� ������ "Find Symbol Results" ������ /// </summary> /// <remarks> /// �������� Source.Goto, � �������������� ���������� ������ /// ����� ������� ��� ������� ���������� ������ � _library ����� ����� NemerleLibraryManager /// ����� �������� IVsObjectSearch.Find - ��������� ���������� �� ������, ������� ����� � ������� _library.GetList2(), /// IVsObjectSearch � ���� ������� ������ �������� � � ��������� �������� (���� �� �����������, �.�. ��� ������� ������� ������ ������ ���� VSOBSEARCHCRITERIA), /// � ������� ��� ���������� ������ � ������ Find Symbol Results (��� �������) /// /// ���������� � ������� �� ����: /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/951158dd-fc98-4325-b07d-bab65b372603/ /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/793f916d-80a6-4944-b058-7166d48d3a32 /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/3d85e968-f735-420c-b9c8-d57ed7839d36 /// /// �������� ��� ������ �� ����� ������� IVsObjectSearch.Find ������� �������� �� IVsFindSymbol.DoSearch /// http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsfindsymbol.dosearch.aspx /// ���� �����-�� ���� ��� ����� � ������ Find /// http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/08b71611-2c94-40e7-a79e-3be843c974ea/ /// </remarks> private void FindReferences() { int line, col; // Get the caret position ErrorHandler.ThrowOnFailure(this.TextView.GetCaretPos(out line, out col)); var findSvc = (IVsObjectSearch)Source.Service.GetService(typeof(SVsObjectSearch)); //IVsNavInfo navInfo; if(findSvc != null) { string caption; var infos = Source.GetGotoInfo(TextView, false, line, col, out caption); if((infos != null) && (infos.Length > 0)) { var criteria = new[] { new VSOBSEARCHCRITERIA { eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD, grfOptions = (uint)_VSOBSEARCHOPTIONS.VSOBSO_CASESENSITIVE, szName = "<dummy>", dwCustom = Library.FindAllReferencesMagicNum, } }; var inlm = Source.Service.GetService(typeof(INemerleLibraryManager)); if(inlm != null) { var nlm = (NemerleLibraryManager)inlm; var libSearchResults = new LibraryNode("<dummy2>", LibraryNode.LibraryNodeType.References, LibraryNode.LibraryNodeCapabilities.None, null); foreach(var i in infos) { var inner = new GotoInfoLibraryNode((NemerleLanguageService)Source.LanguageService, i, caption); libSearchResults.AddNode(inner); } nlm.OnFindAllReferencesDone(libSearchResults); IVsObjectList results; var hr = findSvc.Find((uint)__VSOBSEARCHFLAGS.VSOSF_EXPANDREFS, criteria, out results); } } } }
/// <summary> /// Main function of the parsing thread. /// This function waits on the queue of the parsing requests and build /// the parsing tree for a specific file. The resulting tree is built /// using LibraryNode objects so that it can be used inside the class /// view or object browser. /// </summary> void ParseThread() { const int waitTimeout = 500; // Define the array of events this function is interest in. // WaitHandle[] eventsToWait = new WaitHandle[] { _requestPresent, _shutDownStarted }; // Execute the tasks. // while (true) { // Wait for a task or a shutdown request. // int waitResult = WaitHandle.WaitAny(eventsToWait, waitTimeout, false); if (1 == waitResult) { // The shutdown of this component is started, so exit the thread. return; } LibraryTask task = null; lock (_requests) { if (_requests.Count != 0) { task = _requests.Dequeue(); } if (_requests.Count == 0) { _requestPresent.Reset(); } } if (null == task) { continue; } ScopeNode scope = null; if (task.Text == null) { if (File.Exists(task.FileName)) { Debug.WriteLine("Parse request (no text): " + task.FileName + " " + task.ModuleID); return; } } else { Debug.WriteLine("Parse request: " + task.FileName + " " + task.ModuleID); return; } LibraryNode module = new LibraryNode( Path.GetFileName(task.FileName), LibraryNode.LibraryNodeType.PhysicalContainer); CreateModuleTree(module, module, scope, "", task.ModuleID); if (task.ModuleID != null) { LibraryNode previousItem; lock (_files) if (_files.TryGetValue(task.ModuleID, out previousItem)) { _files.Remove(task.ModuleID); } _library.RemoveNode(previousItem); } _library.AddNode(module); if (task.ModuleID != null) { lock (_files) _files.Add(task.ModuleID, module); } } }
public Library(Guid libraryGuid) { _guid = libraryGuid; _root = new LibraryNode("", LibraryNode.LibraryNodeType.Package); }
internal void RemoveNode(LibraryNode node) { lock (_children) { _children.Remove(node); } _updateCount++; }
internal void AddNode(LibraryNode node) { lock (_children) { _children.Add(node); } _updateCount++; }