Esempio n. 1
0
        int IVsSimpleObjectList2.LocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint pulIndex)
        {
            if (null == pNavInfoNode)
            {
                throw new ArgumentNullException("pNavInfoNode");
            }
            pulIndex = NullIndex;
            string nodeName;

            ErrorHandler.ThrowOnFailure(pNavInfoNode.get_Name(out nodeName));
            try
            {
                for (int i = 0; i < children.Count; i++)
                {
                    if (0 == string.Compare(children[i].UniqueName, nodeName, StringComparison.OrdinalIgnoreCase))
                    {
                        pulIndex = (uint)i;
                        return(VSConstants.S_OK);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(VSConstants.S_FALSE);
        }
Esempio n. 2
0
        int IVsSimpleObjectList2.LocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint pulIndex)
        {
            if (null == pNavInfoNode)
            {
                throw new ArgumentNullException("pNavInfoNode");
            }
            pulIndex = NullIndex;
            string nodeName = null;

            ThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                ErrorHandler.ThrowOnFailure(pNavInfoNode.get_Name(out nodeName));
            });
            try
            {
                for (int i = 0; i < children.Count; i++)
                {
                    if (0 == string.Compare(children[i].UniqueName, nodeName, StringComparison.OrdinalIgnoreCase))
                    {
                        pulIndex = (uint)i;
                        return(VSConstants.S_OK);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(VSConstants.S_FALSE);
        }
Esempio n. 3
0
        protected override bool TryLocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint index)
        {
            var itemCount = GetItemCount();

            index = 0xffffffffu;

            string matchName;

            if (ErrorHandler.Failed(pNavInfoNode.get_Name(out matchName)))
            {
                return(false);
            }

            uint type;

            if (ErrorHandler.Failed(pNavInfoNode.get_Type(out type)))
            {
                return(false);
            }

            var longestMatchedName = string.Empty;

            for (uint i = 0; i < itemCount; i++)
            {
                var name = GetText(i, VSTREETEXTOPTIONS.TTO_DISPLAYTEXT);

                if (_kind == ObjectListKind.Types ||
                    _kind == ObjectListKind.Namespaces ||
                    _kind == ObjectListKind.Members)
                {
                    if (string.Equals(matchName, name, StringComparison.Ordinal))
                    {
                        index = i;
                        break;
                    }
                }
                else
                {
                    if (string.Equals(matchName, name, StringComparison.Ordinal))
                    {
                        index = i;
                        break;
                    }
                    else if (_kind == ObjectListKind.Projects)
                    {
                        if (matchName.IndexOf(name, StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            if (longestMatchedName.Length < name.Length)
                            {
                                longestMatchedName = name;
                                index = i;
                            }
                        }
                    }
                }
            }

            return(index != 0xffffffffu);
        }
Esempio n. 4
0
        int IVsSimpleObjectList2.LocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint pulIndex)
        {
            Utilities.ArgumentNotNull("pNavInfoNode", pNavInfoNode);

            pulIndex = NullIndex;
            string nodeName;

            ErrorHandler.ThrowOnFailure(pNavInfoNode.get_Name(out nodeName));
            for (int i = 0; i < _children.Count; i++)
            {
                if (0 == string.Compare(_children[i].UniqueName, nodeName, StringComparison.OrdinalIgnoreCase))
                {
                    pulIndex = (uint)i;
                    return(VSConstants.S_OK);
                }
            }
            return(VSConstants.S_FALSE);
        }
Esempio n. 5
0
        /// <summary>
        /// Reserved for future use.
        /// </summary>
        /// <param name="pNavInfoNode"></param>
        /// <param name="pulIndex"></param>
        /// <returns></returns>
        public int LocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint pulIndex)
        {
            //Logger.Log("ResultList.LocateNavInfoNode   ");

            string needleName = string.Empty;

            pNavInfoNode.get_Name(out needleName);
            var index = 0;

            foreach (var c in children)
            {
                string nodeName = string.Empty;
                ((IVsNavInfoNode)c).get_Name(out nodeName);
                if (string.Compare(needleName, nodeName) == 0)
                {
                    pulIndex = (uint)index;
                    return(VSConstants.S_OK);
                }
                index++;
            }
            pulIndex = 0;
            return(VSConstants.E_FAIL);
        }
Esempio n. 6
0
        /// <summary>
        /// Reserved for future use.
        /// </summary>
        /// <param name="pNavInfoNode"></param>
        /// <param name="pulIndex"></param>
        /// <returns></returns>
        public int LocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint pulIndex)
        {
            //Logger.Log("ResultList.LocateNavInfoNode   ");

            string needleName = string.Empty;
            pNavInfoNode.get_Name(out needleName);
            var index = 0;
            foreach(var c in children)
            {
                string nodeName = string.Empty;
                ((IVsNavInfoNode)c).get_Name(out nodeName);
                if (string.Compare(needleName, nodeName) == 0)
                {
                    pulIndex = (uint)index;
                    return VSConstants.S_OK;
                }
                index++;
            }
            pulIndex = 0;
            return VSConstants.E_FAIL;
        }
 int IVsSimpleObjectList2.LocateNavInfoNode(IVsNavInfoNode pNavInfoNode, out uint pulIndex)
 {
     if (null == pNavInfoNode) {
         throw new ArgumentNullException("pNavInfoNode");
     }
     pulIndex = NullIndex;
     string nodeName;
     ErrorHandler.ThrowOnFailure(pNavInfoNode.get_Name(out nodeName));
     for (int i = 0; i < children.Count; i++ ) {
         if (0 == string.Compare(children[i].UniqueName, nodeName, StringComparison.OrdinalIgnoreCase)) {
             pulIndex = (uint)i;
             return VSConstants.S_OK;
         }
     }
     return VSConstants.S_FALSE;
 }