Beispiel #1
0
        public static bool SelectProjectInSolutionExplorer(Project Project)
        {
            UnrealVSPackage.Instance.DTE.ExecuteCommand("View.SolutionExplorer");
            if (Project.ParentProjectItem != null)
            {
                Project.ParentProjectItem.ExpandView();
            }

            UIHierarchy SolutionExplorerHierarachy = UnrealVSPackage.Instance.DTE2.ToolWindows.SolutionExplorer;

            Utils.UITreeItem SolutionExplorerTree = Utils.GetUIHierarchyTree(SolutionExplorerHierarachy);
            var UIHierarachyProjects = Utils.GetUITreeItemsByObjectType <Project>(SolutionExplorerTree);

            var SelectableUIItem = UIHierarachyProjects.FirstOrDefault(uihp => uihp.Object as Project == Project);

            if (SelectableUIItem != null)
            {
                if (Project.ParentProjectItem != null)
                {
                    SelectableUIItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
                    return(true);
                }
            }

            return(false);
        }