예제 #1
0
 internal void AddNode(LibraryNode node)
 {
     lock (this)
     {
         root.AddNode(node);
     }
 }
예제 #2
0
 protected IVsSimpleObjectList2 FilterView(LibraryNodeType filterType)
 {
     return(ThreadHelper.JoinableTaskFactory.Run(async delegate
     {
         await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
         LibraryNode filtered = null;
         if (filteredView.TryGetValue(filterType, out filtered))
         {
             return filtered as IVsSimpleObjectList2;
         }
         filtered = this.Clone();
         for (int i = 0; i < filtered.children.Count;)
         {
             if (0 == (filtered.children[i].type & filterType))
             {
                 filtered.children.RemoveAt(i);
             }
             else
             {
                 i += 1;
             }
         }
         filteredView.Add(filterType, filtered);
         return filtered as IVsSimpleObjectList2;
     }));
 }
예제 #3
0
 internal void RemoveNode(LibraryNode node)
 {
     lock (this)
     {
         //root = new LibraryNode(root);
         root.RemoveNode(node);
     }
 }
예제 #4
0
 internal void RemoveNode(LibraryNode node)
 {
     lock (children)
     {
         children.Remove(node);
     }
     filteredView = new Dictionary <LibraryNodeType, LibraryNode>();
     updateCount += 1;
 }
예제 #5
0
 /// <summary>
 /// Search the Childrens of the currentRoot, to see if some are containing strSearchCriteria.
 /// If the Children has some childrens..., then call FillRoot recursively.
 /// </summary>
 /// <param name="tmpRoot">The current upper level, where corresponding Childrens must be added</param>
 /// <param name="elementTypes">What kind of Children are we looking for</param>
 /// <param name="strSearchCriteria">What are we looking for</param>
 /// <param name="currentRoot">The node to look after</param>
 private void FillRoot(LibraryNode tmpRoot, List <LibraryNode.LibraryNodeType> elementTypes, string strSearchCriteria, LibraryNode currentRoot)
 {
     foreach (LibraryNode node in currentRoot.children)
     {
         if (elementTypes.Contains(node.NodeType) && node.Name.ToLower().Contains(strSearchCriteria.ToLower()))
         {
             tmpRoot.children.Add(node.Clone());
         }
         if (node.children.Count > 0)
         {
             FillRoot(tmpRoot, elementTypes, strSearchCriteria, node);
         }
     }
 }
예제 #6
0
 public LibraryNode(LibraryNode node)
 {
     this.capabilities  = node.capabilities;
     this.contextMenuID = node.contextMenuID;
     this.displayData   = node.displayData;
     this.name          = node.name;
     this.tooltip       = node.tooltip;
     this.type          = node.type;
     this.children      = new List <LibraryNode>();
     foreach (LibraryNode child in node.children)
     {
         children.Add(child);
     }
     this.clipboardFormats = new List <VSOBJCLIPFORMAT>();
     foreach (VSOBJCLIPFORMAT format in node.clipboardFormats)
     {
         clipboardFormats.Add(format);
     }
     this.filteredView = new Dictionary <LibraryNodeType, LibraryNode>();
     this.updateCount  = node.updateCount;
 }
예제 #7
0
        internal LibraryNode SearchHierarchy(IVsHierarchy hierarchy)
        {
            LibraryNode found = null;

            lock (this)
            {
                foreach (LibraryNode nd in root.children)
                {
                    if (nd is XSharpLibraryNode)
                    {
                        XSharpLibraryNode vln = (XSharpLibraryNode)nd;
                        if (hierarchy.Equals(vln.ownerHierarchy))
                        {
                            found = nd;
                            break;
                        }
                    }
                }
            }
            return(found);
        }
예제 #8
0
        private LibraryNode SearchNodes(uint elementType, string strSearchCriteria)
        {
            List <LibraryNode.LibraryNodeType> nType = new List <LibraryNode.LibraryNodeType>();

            if (elementType == (uint)_LIB_LISTTYPE.LLT_HIERARCHY)
            {
                nType.Add(LibraryNode.LibraryNodeType.Hierarchy);
            }
            else if (elementType == (uint)_LIB_LISTTYPE.LLT_NAMESPACES)
            {
                nType.Add(LibraryNode.LibraryNodeType.Namespaces);
            }
            else if (elementType == (uint)_LIB_LISTTYPE.LLT_MEMBERS)
            {
                nType.Add(LibraryNode.LibraryNodeType.Classes);
                nType.Add(LibraryNode.LibraryNodeType.Members);
            }
            LibraryNode tmpRoot = new LibraryNode("", LibraryNode.LibraryNodeType.Package);

            //
            FillRoot(tmpRoot, nType, strSearchCriteria, root);
            //
            return(tmpRoot);
        }
예제 #9
0
 bool MatchesName(LibraryNode node, string name)
 {
     return(String.Compare(node.Name, name, true) == 0 &&
            (node.NodeType & LibraryNodeType.Classes) != LibraryNodeType.None);
 }
예제 #10
0
 bool findbyName(LibraryNode node, string name)
 {
     return(String.Compare(node.Name, name, true) == 0 && (node.NodeType & LibraryNodeType.Namespaces) != LibraryNodeType.None);
 }
예제 #11
0
 public Library(Guid libraryGuid)
 {
     this.guid = libraryGuid;
     root      = new LibraryNode("", LibraryNode.LibraryNodeType.Package);
 }