Ejemplo n.º 1
0
        }         // proc UpdateTypeList

        public Declarations FindDeclarations(bool lTypes, string sStarts)
        {
            InitComponent();

            if (lTypes)
            {
                // Aktualisiere die Typ-Liste
                if (typeRoot == null || Math.Abs(Environment.TickCount - iLastTypeUpdated) > 60000)
                {
                    typeRoot = null;
                    UpdateTypeList();
                }

                // Suche den Passenden Knoten
                return(typeRoot.FindNameSpace(0, sStarts, false));
            }
            else
            {
                return(null);
            }

            //IVsNavInfo navInfo;
            //Guid guid;
            //library.GetGuid(out guid);
            //libraryScope.get_RootNavInfo(out navInfo);
            //ErrorHandler.ThrowOnFailure(libraryScope.CreateNavInfo(ref guid,
            //	new SYMBOL_DESCRIPTION_NODE[] { new SYMBOL_DESCRIPTION_NODE() { dwType = (uint)_LIB_LISTTYPE.LLT_NAMESPACES, pszName = "System" } }, 1, out navInfo));

            //IVsObjectList2 listC;
            //ErrorHandler.ThrowOnFailure(libraryScope.put_ChildListOptions((uint)(_BROWSE_COMPONENT_SET_OPTIONS.BCSO_NO_DRAG_DROP | _BROWSE_COMPONENT_SET_OPTIONS.BCSO_NO_REMOVE | _BROWSE_COMPONENT_SET_OPTIONS.BCSO_NO_RENAME)));
            //ErrorHandler.ThrowOnFailure(libraryScope.GetList2((uint)_LIB_LISTTYPE.LLT_NAMESPACES, (uint)_LIB_FLAGS.LF_GLOBAL,
            //	new[]
            //	{
            //		new VSOBSEARCHCRITERIA2()
            //		{
            //			eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
            //			szName = sStarts
            //		}
            //	}, null, out listC));

            //IVsSimpleObjectList2 simpleList = listC as IVsSimpleObjectList2;
            //ErrorHandler.ThrowOnFailure(library.GetList2((uint)(_LIB_LISTTYPE.LLT_CLASSES), (uint)_LIB_FLAGS.LF_GLOBAL,
            //	new[]
            //	{
            //		new VSOBSEARCHCRITERIA2()
            //		{
            //			eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
            //			szName = sStarts
            //		}
            //	}, out simpleList));

            //string sTmp;
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_BASETEXT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_CUSTOM, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_DEFAULT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_DISPLAYTEXT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_EXTENDED, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_PREFIX, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_PREFIX2, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_SEARCHTEXT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_SORTTEXT, out sTmp);
            //Debug.Print(sTmp);


            //Guid riid = typeof(IVsSimpleObjectList2).GUID;
            //IntPtr p;
            //Marshal.QueryInterface(Marshal.GetIUnknownForObject(listC), ref riid, out p);

            //simpleList = listC as IVsSimpleObjectList2;

            //simp

            //return new ObjectListDeclarations(simpleList);
        }         // func FidDeclarations
Ejemplo n.º 2
0
        }         // proc InitComponent

        private void UpdateTypeList()
        {
            //	IVsObjectList2 _list;
            //	ErrorHandler.ThrowOnFailure(libraryScope.GetList2((uint)_LIB_LISTTYPE.LLT_CLASSES, (uint)_LIB_FLAGS.LF_GLOBAL,
            //		new[]
            //			{
            //				new VSOBSEARCHCRITERIA2()
            //				{
            //					eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
            //					szName = String.Empty
            //				}
            //			}, null, out _list));
            //	IVsCoTaskMemFreeMyStrings t = _list as IVsCoTaskMemFreeMyStrings;
            //	string s;
            //	_list.GetText(0, VSTREETEXTOPTIONS.TTO_DEFAULT, out s);
            //	Debug.Print(s);


            IVsSimpleObjectList2 simpleList;            // = _list as IVsSimpleObjectList2;

            ErrorHandler.ThrowOnFailure(library.GetList2((uint)_LIB_LISTTYPE.LLT_CLASSES, (uint)_LIB_FLAGS.LF_GLOBAL,
                                                         new[]
            {
                new VSOBSEARCHCRITERIA2()
                {
                    eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
                    szName    = String.Empty
                }
            }, out simpleList));

            uint dwCount;

            ErrorHandler.ThrowOnFailure(simpleList.GetItemCount(out dwCount));

            typeRoot = new TypeListItem(simpleList, TypeListItem.NamespaceIndex, String.Empty);

            for (uint i = 0; i < dwCount; i++)
            {
                // Ermittle den Namen
                string sNamespace;
                string sTypeName;
                ErrorHandler.ThrowOnFailure(simpleList.GetTextWithOwnership(i, VSTREETEXTOPTIONS.TTO_PREFIX2, out sNamespace));
                ErrorHandler.ThrowOnFailure(simpleList.GetTextWithOwnership(i, VSTREETEXTOPTIONS.TTO_DEFAULT, out sTypeName));

                // Hole die Attribute ab
                uint dwClassType;
                uint dwClassAccess;
                ErrorHandler.ThrowOnFailure(simpleList.GetCategoryField2(i, (int)LIB_CATEGORY.LC_CLASSTYPE, out dwClassType));
                ErrorHandler.ThrowOnFailure(simpleList.GetCategoryField2(i, (int)LIB_CATEGORY.LC_CLASSACCESS, out dwClassAccess));

                // Keine eigentlichen Typen und Namespaces
                if (((_LIBCAT_CLASSTYPE)dwClassType) == _LIBCAT_CLASSTYPE.LCCT_INTRINSIC ||
                    ((_LIBCAT_CLASSTYPE)dwClassType) == _LIBCAT_CLASSTYPE.LCCT_NSPC)
                {
                    continue;
                }

                // Nur öffentliche Methoden
                if ((dwClassAccess & (uint)_LIBCAT_CLASSACCESS.LCCA_PUBLIC) == 0)
                {
                    continue;
                }

                // Suche den Knoten
                typeRoot.FindNameSpace(0, sNamespace, true).Add(i, sTypeName);
            }

            iLastTypeUpdated = Environment.TickCount;
        }         // proc UpdateTypeList