コード例 #1
0
        /// <summary>
        /// Clears any exising search filtering in the solution explorer so that items not matching
        /// the query can be found.
        /// </summary>
        private void ClearSolutionExplorerSearchFilter()
        {
            var solutionExplorer = VsShellUtilities.GetUIHierarchyWindow(Package, VSConstants.StandardToolWindows.SolutionExplorer);
            var ws = solutionExplorer as IVsWindowSearch;

            ws?.ClearSearch();
        }
コード例 #2
0
        public ListBox GetHierarchyListBox()
        {
            SolutionHierarchy = VsShellUtilities.GetUIHierarchyWindow(ServiceLocator.GetInstance <IServiceProvider>(), VSConstants.StandardToolWindows.SolutionExplorer);

            ContentGrid = SolutionHierarchy.GetValue("Content") as Panel;
            if (ContentGrid == null || ContentGrid.Children.Count == 0)
            {
                return(null);
            }

            ContentPresenter = ContentGrid.Children[0] as ContentPresenter;
            if (ContentPresenter == null)
            {
                return(null);
            }

            ListBox listBox = null;

            switch (ContentPresenter.Content.GetType().FullName)
            {
            case SolutionPivotNavigator:
                listBox = ContentPresenter.Content.GetType().GetProperties()
                          .Single(p => p.Name == "TreeView" && p.PropertyType.FullName == SolutionPivotTreeView)
                          .GetValue(ContentPresenter.Content) as ListBox;
                break;

            case WorkspaceTreeView:
                listBox = ContentPresenter.Content as ListBox;
                break;
            }

            return(listBox);
        }
コード例 #3
0
        public async void LoadAsync(IServiceProvider serviceProvider)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IsLoading = true;
            var uiHierarchy  = VsShellUtilities.GetUIHierarchyWindow(serviceProvider, new Guid(ToolWindowGuids80.SolutionExplorer));
            var uiHierarchy2 = uiHierarchy as IVsUIHierarchyWindow2;

            uiHierarchy2.GetCurrentSelection(out var hierarchy, out var itemId, out var multiSelect);
            hierarchy.GetGuidProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ProjectIDGuid, out var projectId);
            hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ProjectName, out var projectName);



            if (hierarchy != null)
            {
                ProjectId     = projectId;
                VSProjectName = projectName.ToString();

                var settings = SentryProjectOptions.LoadOptions(projectId);
                if (settings != null)
                {
                    ServerUrl     = settings.ServerUrl;
                    SentryProject = settings.Project;
                    SentryApiKey  = settings.ApiKey;
                    Organization  = settings.Organization;
                }
            }
            IsLoading = false;
        }
コード例 #4
0
ファイル: OAProjectItem.cs プロジェクト: Blady-Com/gnatvm-src
        /// <summary>
        /// Expands the view of Solution Explorer to show project items.
        /// </summary>
        public virtual void ExpandView()
        {
            if (this.node == null || this.node.ProjectMgr == null || this.node.ProjectMgr.IsClosed || this.node.ProjectMgr.Site == null)
            {
                throw new InvalidOperationException();
            }

            IVsExtensibility3 extensibility = this.Node.ProjectMgr.Site.GetService(typeof(IVsExtensibility)) as IVsExtensibility3;

            if (extensibility == null)
            {
                throw new InvalidOperationException();
            }

            extensibility.EnterAutomationFunction();

            try
            {
                IVsUIHierarchyWindow uiHierarchy = VsShellUtilities.GetUIHierarchyWindow(this.node.ProjectMgr.Site, HierarchyNode.SolutionExplorer);
                if (uiHierarchy == null)
                {
                    throw new InvalidOperationException();
                }

                uiHierarchy.ExpandItem(this.node.ProjectMgr, this.node.ID, EXPANDFLAGS.EXPF_ExpandFolder);
            }
            finally
            {
                extensibility.ExitAutomationFunction();
            }
        }
コード例 #5
0
        public static FileInfo LookingForSelectedItem(IServiceProvider serviceProvider)
        {
            IVsUIHierarchyWindow hierarchyWindow = VsShellUtilities.GetUIHierarchyWindow(serviceProvider,
                VSConstants.StandardToolWindows.SolutionExplorer);

            ThreadHelper.ThrowIfNotOnUIThread();

            var pane = hierarchyWindow as WindowPane;
            if (pane == null)
            {
                throw new FileNotFoundException("Unable to find the items full path");
            }

            var paneContent = pane.Content as Panel;
            if (paneContent == null || paneContent.Children.Count == 0)
            {
                throw new FileNotFoundException("Unable to find the items full path");
            }

            foreach (ContentPresenter contentPresenter in paneContent.Children)
            {
                try
                {
                    if (contentPresenter == null)
                    {
                        continue;
                    }

                    var listBox = contentPresenter.Content.GetType().GetProperties().Single(p => p.Name == "TreeView" &&
                                            p.PropertyType.FullName == "Microsoft.VisualStudio.PlatformUI.SolutionPivotTreeView")
                        .GetValue(contentPresenter.Content) as ListBox;

                    if (listBox.SelectedItem == null)
                    {
                        continue;
                    }

                    var selectedItemNode = listBox.SelectedItem as Microsoft.Internal.VisualStudio.PlatformUI.IVirtualizingTreeNode;
                    if (selectedItemNode == null)
                    {
                        continue;
                    }

                    var sourceItem = selectedItemNode.Item.GetType().GetProperties().Single(p => p.Name == "SourceItem")
                        .GetValue(selectedItemNode.Item);

                    var canonicalName = sourceItem.GetType().GetProperties().Single(p => p.Name == "CanonicalName")
                        .GetValue(sourceItem) as string;

                    return new FileInfo(canonicalName);
                }
                catch
                {
                    continue;
                }
            }

            throw new FileNotFoundException("Unable to find the items full path");
        }
コード例 #6
0
        private static IVsUIHierarchyWindow GetSolutionExplorerHierarchyWindow()
        {
            Debug.Assert(ThreadHelper.CheckAccess());

            return(VsShellUtilities.GetUIHierarchyWindow(
                       ServiceLocator.GetInstance <IServiceProvider>(),
                       new Guid(VsWindowKindSolutionExplorer)));
        }
コード例 #7
0
        private static async Task <IVsUIHierarchyWindow> GetSolutionExplorerHierarchyWindowAsync()
        {
            var serviceProvider = await ServiceLocator.GetServiceProviderAsync();

            return(VsShellUtilities.GetUIHierarchyWindow(
                       serviceProvider,
                       new Guid(VsWindowKindSolutionExplorer)));
        }
コード例 #8
0
ファイル: Utilities.cs プロジェクト: yangfan79/MPFProj10
        /// <summary>
        /// Performs the EXPANDFLAGS action on a node with nodeID.
        /// </summary>
        internal static void ManipulateNode(ProjectNode project, uint nodeID, EXPANDFLAGS flag)
        {
            IVsUIHierarchyWindow uiHierarchy = VsShellUtilities.GetUIHierarchyWindow(project.Site, HierarchyNode.SolutionExplorer);

            if (uiHierarchy == null)
            {
                return;
            }

            uiHierarchy.ExpandItem(project, nodeID, flag);
        }
コード例 #9
0
ファイル: Utilities.cs プロジェクト: yangfan79/MPFProj10
        /// <summary>
        /// Selects all nodes of type T in the project.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="project"></param>
        /// <returns>The id's of the selected nodes.</returns>
        internal static T SelectAnyNodeOfType <T>(ProjectNode project)
            where T : HierarchyNode
        {
            IVsUIHierarchyWindow uiHierarchy = VsShellUtilities.GetUIHierarchyWindow(project.Site, HierarchyNode.SolutionExplorer);

            if (uiHierarchy == null)
            {
                return(null);
            }

            List <T> nodes = GetNodesOfType <T>(project);

            if (nodes.Count > 0)
            {
                uiHierarchy.ExpandItem(project, nodes[0].Id, EXPANDFLAGS.EXPF_SelectItem);
                return(nodes[0]);
            }

            return(null);
        }
コード例 #10
0
        public IHierarchyNode GetSelectedProject()
        {
            IVsUIHierarchyWindow uiWindow = VsShellUtilities.GetUIHierarchyWindow(provider, new Guid(ToolWindowGuids.SolutionExplorer));
            IntPtr             pHier;
            uint               pItemId;
            IVsMultiItemSelect itemSelection;
            int hr = uiWindow.GetCurrentSelection(out pHier, out pItemId, out itemSelection);

            if (hr != VSConstants.S_OK)
            {
                throw new HierarchyNodeException(Resources.HierarchyNodeFactory_ErrorNoToolWindow);
            }

            IVsHierarchy selectedHier = Marshal.GetObjectForIUnknown(pHier) as IVsHierarchy;

            Debug.Assert(selectedHier != null);

            HierarchyNode node = new HierarchyNode(solution, selectedHier);

            return(node);
        }
コード例 #11
0
        public IHierarchyNode GetSelectedProject()
        {
            IVsUIHierarchyWindow uiWindow = VsShellUtilities.GetUIHierarchyWindow(_provider, new Guid(ToolWindowGuids.SolutionExplorer));
            uint pItemId;
            IVsMultiItemSelect itemSelection;
            int hr = uiWindow.GetCurrentSelection(out IntPtr pHier, out pItemId, out itemSelection);

            if (hr != VSConstants.S_OK)
            {
                throw new HierarchyNodeException("Could not retrieve tool window.");
            }

            IVsHierarchy selectedHier = Marshal.GetObjectForIUnknown(pHier) as IVsHierarchy;

            Debug.Assert(selectedHier != null);

            HierarchyNode node = new HierarchyNode(_solution, selectedHier);

            // TODO: Should we Marshall.Release selectedHier?

            return(node);
        }
コード例 #12
0
ファイル: Utilities.cs プロジェクト: yangfan79/MPFProj10
        /// <summary>
        /// Selects all nodes of type T in the project.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="project"></param>
        /// <returns>The id's of the selected nodes.</returns>
        internal static List <uint> SelectOrUnselectNodes <T>(ProjectNode project, bool select)
            where T : HierarchyNode
        {
            List <uint>          selectedNodeIds = new List <uint>();
            IVsUIHierarchyWindow uiHierarchy     = VsShellUtilities.GetUIHierarchyWindow(project.Site, HierarchyNode.SolutionExplorer);

            if (uiHierarchy == null)
            {
                return(selectedNodeIds);
            }

            List <T> nodes = GetNodesOfType <T>(project);

            if (nodes.Count > 0)
            {
                foreach (T node in nodes)
                {
                    uiHierarchy.ExpandItem(project, node.Id, (select) ? EXPANDFLAGS.EXPF_SelectItem : EXPANDFLAGS.EXPF_UnSelectItem);
                    selectedNodeIds.Add(node.Id);
                }
            }

            return(selectedNodeIds);
        }
コード例 #13
0
        public void OpenFolderView()
        {
            if (ProductEnvironment.Instance.Package == null)
            {
                return;
            }

            var provider = ProductEnvironment.Instance.Package as IServiceProvider;
            IVsUIHierarchyWindow hierarchyWindow = VsShellUtilities.GetUIHierarchyWindow(provider,
                                                                                         VSConstants.StandardToolWindows.SolutionExplorer);

            ThreadHelper.ThrowIfNotOnUIThread();

            var pane = hierarchyWindow as WindowPane;

            if (pane == null)
            {
                throw new Exception("Cannot find the hirarchy pane in solution explorer");
            }

            var paneContent = pane.Content as System.Windows.Controls.Panel;

            if (paneContent == null || paneContent.Children.Count == 0)
            {
                throw new Exception("Cannot find the control panel in solution explorer");
            }

            var contentPresenter = paneContent.Children[0] as System.Windows.Controls.ContentPresenter;

            if (contentPresenter == null)
            {
                throw new Exception("Cannot find the content presenter in solution explorer");
            }

            var listBox = contentPresenter.Content as System.Windows.Controls.ListBox;

            if (listBox == null || listBox.SelectedItem == null)
            {
                throw new Exception("Cannot find the listbox in solution explorer");
            }

            var selectedItemNode = listBox.SelectedItem as Microsoft.Internal.VisualStudio.PlatformUI.IVirtualizingTreeNode;

            if (selectedItemNode == null)
            {
                throw new Exception("Cannot find the selected tree node in solution explorer");
            }

            var selectedItem = selectedItemNode.Item as Microsoft.VisualStudio.Workspace.VSIntegration.UI.IUINode;

            if (selectedItem == null)
            {
                throw new Exception("Cannot find the selected UI node in solution explorer");
            }

            var fileSystemItem = selectedItem.WorkspaceVisualNode as Microsoft.VisualStudio.Workspace.VSIntegration.UI.IFileSystemNode;

            if (fileSystemItem == null)
            {
                throw new Exception("Cannot find the selected file system item in solution explorer");
            }

            string         path = fileSystemItem.FullPath;
            FileAttributes attr = File.GetAttributes(path);

            if (attr.HasFlag(FileAttributes.Directory) == false)
            {
                var file = new FileInfo(path);
                path = file.Directory.FullName;
            }

            if (string.IsNullOrWhiteSpace(path) == false)
            {
                SendChangeFolder(path);
                return;
            }
        }
コード例 #14
0
        public void TestAutomationOnProjectItem()
        {
            UIThreadInvoker.Invoke((ThreadInvoker) delegate()
            {
                //Get the global service provider and the dte
                IServiceProvider sp = VsIdeTestHostContext.ServiceProvider;
                DTE dte             = (DTE)sp.GetService(typeof(DTE));

                string destination = Path.Combine(TestContext.TestDir, TestContext.TestName);
                Utilities.CreateMyNestedProject(sp, dte, TestContext.TestName, destination, true);

                OAProject automation = Utilities.FindExtObject(sp, Utilities.NestedProjectGuid, TestContext.TestName) as OAProject;
                Assert.IsNotNull(automation, "Failed to create a project using automation");

                ProjectNode project = automation.Project;

                // Get the AssemblyInfo.cs, try to open it and then ask using automation that it is opened.
                EnvDTE.ProjectItem item = automation.ProjectItems.Item("AssemblyInfo.cs");
                Assert.IsNotNull(item, "Could not retrieve AssemblyInfo.cs");

                EnvDTE.Window window = item.Open(VSConstants.LOGVIEWID_Primary.ToString());
                Assert.IsNotNull(window, "Could not open the AssemblyInfo.cs");
                window.Activate();

                bool isOpen = item.get_IsOpen(VSConstants.LOGVIEWID_Primary.ToString());
                Assert.IsTrue(isOpen, "The AssemblyInfo.cs file should have been opened");

                // Now save it
                item.Save("");

                Assert.IsTrue(item.Saved, "The renamed AssemblyInfo.cs has not been saved");

                // Get the Document
                EnvDTE.Document document = item.Document;
                Assert.IsNotNull(document, "Could not retrieve the document object");
                Assert.IsTrue(document.Name == "AssemblyInfo.cs", "The document for the file item is incorrect. It's name should be AssemblyInfo.cs");

                // Try the properties on a nested item
                EnvDTE.ProjectItem nestedProject     = automation.ProjectItems.Item("ANestedProject");
                EnvDTE.ProjectItem nestedProjectItem = nestedProject.ProjectItems.Item("Program.cs");
                EnvDTE.Properties nesteditemsProps   = nestedProjectItem.Properties;
                EnvDTE.Property nestedItemProperty   = nesteditemsProps.Item("BuildAction");
                Assert.IsNotNull(nestedItemProperty, "Could not retrieve the BuildAction property from the nested project item");
                nestedItemProperty.Value = BuildAction.Content;
                Assert.AreEqual((BuildAction)nestedItemProperty.Value, BuildAction.Content);

                // Now try the properties on the top project item
                EnvDTE.Properties props = item.Properties;
                Assert.IsNotNull(props, "Could not retrieve the BuildAction property from the nested project item");

                EnvDTE.Property itemProperty = props.Item("BuildAction");
                Assert.IsNotNull(itemProperty, "Could not retrieve the BuildAction property from the nested project item");
                Assert.IsFalse(itemProperty is OANullProperty, "Could not retrieve the BuildAction property from the nested project item");
                itemProperty.Value = BuildAction.Content;
                Assert.AreEqual(itemProperty.Value, BuildAction.Content);

                // Now save as
                Assert.IsTrue(item.SaveAs("AssemblyInfo1.cs"), "The file AssemblyInfo.cs could not be reanmed to AssemblyInfo1.cs");
                Assert.IsTrue(item.Name == "AssemblyInfo1.cs", "File item has been renamed to AssemblyInfo1.cs but the Name property has not");

                // Now try the Program.cs. That should not be opened
                EnvDTE.ProjectItem item1 = automation.ProjectItems.Item("Program.cs");

                Assert.IsNotNull(item1, "Could not retrieve AssemblyInfo.cs");

                isOpen = item1.get_IsOpen(VSConstants.LOGVIEWID_Primary.ToString());

                Assert.IsFalse(isOpen, "The Program.cs should not have been opened");

                // Now get the Reference folder as a project item and expand it.
                EnvDTE.ProjectItem references = automation.ProjectItems.Item("References");
                references.ExpandView();

                // Check that actually it was expanded.
                IVsUIHierarchyWindow uiHierarchy     = VsShellUtilities.GetUIHierarchyWindow(project.Site, HierarchyNode.SolutionExplorer);
                System.Reflection.MethodInfo mi      = typeof(ProjectNode).GetMethod("FindChild", BindingFlags.NonPublic | BindingFlags.Instance);
                ReferenceContainerNode containerNode = (ReferenceContainerNode)mi.Invoke(project, new object[] { "References" });

                __VSHIERARCHYITEMSTATE state;
                uint stateAsInt;
                uiHierarchy.GetItemState(project, (uint)containerNode.ID, (uint)__VSHIERARCHYITEMSTATE.HIS_Expanded, out stateAsInt);
                state = (__VSHIERARCHYITEMSTATE)stateAsInt;
                Assert.IsTrue(state == __VSHIERARCHYITEMSTATE.HIS_Expanded, "The References folder has not been expanded");
            });
        }
コード例 #15
0
 private static IVsUIHierarchyWindow GetSolutionExplorerHierarchyWindow()
 {
     return(VsShellUtilities.GetUIHierarchyWindow(
                ServiceLocator.GetInstance <IServiceProvider>(),
                new Guid(VsConstants.VsWindowKindSolutionExplorer)));
 }
コード例 #16
0
        public override void OnExecute(CommandEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            AnkhMessageBox mb = new AnkhMessageBox(e.Context);

            // Cache items to avoid problems when selection changes by opening editor
            List <SvnItem> items = new List <SvnItem>(e.Selection.GetSelectedSvnItems(false));

            foreach (SvnItem item in items)
            {
                if (!item.Exists)
                {
                    continue;
                }

                bool selectInSolutionExplorer = false;

                try
                {
                    switch (e.Command)
                    {
                    case AnkhCommand.ItemOpenVisualStudio:
                        IProjectFileMapper mapper = e.GetService <IProjectFileMapper>();

                        if (mapper.IsProjectFileOrSolution(item.FullPath))
                        {
                            selectInSolutionExplorer = true;
                            break;
                        }
                        if (item.IsDirectory)
                        {
                            goto case AnkhCommand.ItemOpenWindows;
                        }

                        VsShellUtilities.OpenDocument(e.Context, item.FullPath);
                        break;

                    case AnkhCommand.ItemOpenTextEditor:
                    {
                        IVsUIHierarchy hier;
                        IVsWindowFrame frame;
                        uint           id;

                        if (!item.IsFile)
                        {
                            continue;
                        }

                        VsShellUtilities.OpenDocument(e.Context, item.FullPath, VSConstants.LOGVIEWID_TextView, out hier, out id, out frame);
                    }
                    break;

                    case AnkhCommand.ItemOpenWindows:
                        System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(item.FullPath);
                        psi.Verb = "open";
                        System.Diagnostics.Process.Start(psi);
                        break;
                    }
                }
                catch (IOException ee)
                {
                    mb.Show(ee.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (COMException ee)
                {
                    mb.Show(ee.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (InvalidOperationException ee)
                {
                    mb.Show(ee.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (System.ComponentModel.Win32Exception ee)
                {
                    mb.Show(ee.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (selectInSolutionExplorer)
                {
                    IVsUIHierarchyWindow hierWindow = VsShellUtilities.GetUIHierarchyWindow(e.Context, new Guid(ToolWindowGuids80.SolutionExplorer));

                    IVsProject project = VsShellUtilities.GetProject(e.Context, item.FullPath) as IVsProject;

                    if (hierWindow != null)
                    {
                        int  found;
                        uint id;
                        VSDOCUMENTPRIORITY[] prio = new VSDOCUMENTPRIORITY[1];
                        if (project != null && VSErr.Succeeded(project.IsDocumentInProject(item.FullPath, out found, prio, out id)) && found != 0)
                        {
                            hierWindow.ExpandItem(project as IVsUIHierarchy, id, EXPANDFLAGS.EXPF_SelectItem);
                        }
                        else if (string.Equals(item.FullPath, e.Selection.SolutionFilename, StringComparison.OrdinalIgnoreCase))
                        {
                            hierWindow.ExpandItem(e.GetService <IVsUIHierarchy>(typeof(SVsSolution)), VSItemId.Root, EXPANDFLAGS.EXPF_SelectItem);
                        }

                        // Now try to activate the solution explorer
                        IVsWindowFrame solutionExplorer;
                        Guid           solutionExplorerGuid = new Guid(ToolWindowGuids80.SolutionExplorer);
                        IVsUIShell     shell = e.GetService <IVsUIShell>(typeof(SVsUIShell));

                        if (shell != null)
                        {
                            shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref solutionExplorerGuid, out solutionExplorer);

                            if (solutionExplorer != null)
                            {
                                solutionExplorer.Show();
                            }
                        }
                    }
                }
            }
        }
コード例 #17
0
        public override void OnExecute(CommandEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            SvnItem node = EnumTools.GetFirst(e.Selection.GetSelectedSvnItems(false));

            IAnkhCommandService cmd = e.GetService <IAnkhCommandService>();

            switch (e.Command)
            {
            case AnkhCommand.ItemSelectInRepositoryExplorer:
                if (node == null || node.Uri == null)
                {
                    return;
                }

                if (cmd != null)
                {
                    cmd.DirectlyExecCommand(AnkhCommand.RepositoryBrowse, node.FullPath);
                }
                break;

            case AnkhCommand.ItemSelectInWorkingCopyExplorer:
                if (node == null || !node.Exists)
                {
                    return;
                }

                if (cmd != null)
                {
                    cmd.DirectlyExecCommand(AnkhCommand.WorkingCopyBrowse, node.FullPath);
                }
                break;

            case AnkhCommand.ItemSelectInFileExplorer:
                if (node == null || !node.Exists)
                {
                    return;
                }

                SelectInFileExplorer(node.FullPath);
                break;

            case AnkhCommand.ItemSelectInSolutionExplorer:
                if (node == null)
                {
                    return;
                }

                IVsUIHierarchyWindow hierWindow = VsShellUtilities.GetUIHierarchyWindow(e.Context, new Guid(ToolWindowGuids80.SolutionExplorer));

                IVsProject project = VsShellUtilities.GetProject(e.Context, node.FullPath) as IVsProject;

                if (hierWindow != null)
                {
                    int  found;
                    uint id;
                    VSDOCUMENTPRIORITY[] prio = new VSDOCUMENTPRIORITY[1];
                    if (project != null && VSErr.Succeeded(project.IsDocumentInProject(node.FullPath, out found, prio, out id)) && found != 0)
                    {
                        hierWindow.ExpandItem(project as IVsUIHierarchy, id, EXPANDFLAGS.EXPF_SelectItem);
                    }
                    else if (string.Equals(node.FullPath, e.Selection.SolutionFilename, StringComparison.OrdinalIgnoreCase))
                    {
                        hierWindow.ExpandItem(e.GetService <IVsUIHierarchy>(typeof(SVsSolution)), VSItemId.Root, EXPANDFLAGS.EXPF_SelectItem);
                    }

                    // Now try to activate the solution explorer
                    IVsWindowFrame solutionExplorer;
                    Guid           solutionExplorerGuid = new Guid(ToolWindowGuids80.SolutionExplorer);
                    IVsUIShell     shell = e.GetService <IVsUIShell>(typeof(SVsUIShell));

                    if (shell != null)
                    {
                        shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref solutionExplorerGuid, out solutionExplorer);

                        if (solutionExplorer != null)
                        {
                            solutionExplorer.Show();
                        }
                    }
                }
                break;
            }
        }