示例#1
0
 // Methods
 internal void AddHierarchyItemIdentity(HierarchyItemIdentity identity)
 {
     this._hierarchyIdentities[identity.HierarchyInfo] = identity;
     if (identity.IsNestedItem)
     {
         this._hierarchyIdentities[identity.NestedInfo] = identity;
     }
 }
示例#2
0
        //public void ClearHierarchyEvents(IVsHierarchy hierarchy)
        //{
        //    HierarchyIdentity identity = new HierarchyIdentity(hierarchy);
        //    HierarchyEventSink sink = this.TryGetHierarchyEventSink(identity);
        //    if (sink != null)
        //    {
        //        sink.Dispose();
        //        this._weakHierarchies.Remove(identity);
        //    }
        //}

        public void ClearItem(HierarchyItemIdentity identity)
        {
            this._weakItems.Remove(identity);
            this._hierarchyIdentities.Remove(identity.HierarchyInfo);
            if (identity.IsNestedItem)
            {
                this._hierarchyIdentities.Remove(identity.NestedInfo);
            }
        }
示例#3
0
        public static Project GetProject(HierarchyItemIdentity hierarchyItem)
        {
            object obj2;

            if ((hierarchyItem != null) && ErrorHandler.Succeeded(hierarchyItem.NestedHierarchy.GetProperty(0xfffffffe, -2027, out obj2)))
            {
                return(obj2 as Project);
            }
            return(null);
        }
示例#4
0
        public override bool Equals(object obj)
        {
            HierarchyItemIdentity identity = obj as HierarchyItemIdentity;

            if (identity == null)
            {
                return(false);
            }
            return(this.HierarchyInfo == identity.HierarchyInfo);
        }
示例#5
0
        public static HierarchyItemIdentity Create(IVsHierarchy hierarchy, uint itemid)
        {
            HierarchyItemIdentity identity = HierarchyManager.Current.TryGetHierarchyItemIdentity(hierarchy, itemid);

            if (identity == null)
            {
                identity = new HierarchyItemIdentity(hierarchy, itemid);
                HierarchyManager.Current.AddHierarchyItemIdentity(identity);
            }
            return(identity);
        }
示例#6
0
        public static bool IsStartupProject(HierarchyItemIdentity hierarchyIdentity)
        {
            IVsHierarchy hierarchy;

            if (!IsProject(hierarchyIdentity))
            {
                return(false);
            }
            IVsSolutionBuildManager solutionBuildManager = GlobalServices.SolutionBuildManager;

            if (solutionBuildManager == null)
            {
                return(false);
            }
            if ((solutionBuildManager.get_StartupProject(out hierarchy) < 0) || (hierarchy == null))
            {
                return(false);
            }
            HierarchyItemIdentity identity = HierarchyItemIdentity.Create(hierarchy, 0xfffffffe);

            return(hierarchyIdentity.Equals(identity));
        }
示例#7
0
        public static bool IsSolutionFolder(HierarchyItemIdentity hierarchyIdentity)
        {
            Project project = GetProject(hierarchyIdentity);

            return((project != null) && (project.Kind == "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}"));
        }
示例#8
0
 public static bool IsProject(HierarchyItemIdentity hierarchyIdentity)
 {
     return((hierarchyIdentity.NestedHierarchy is IVsProject) && (hierarchyIdentity.NestedItemID == 0xfffffffe));
 }