private void CollapseRecursively(SolutionExplorerWindow solutionExplorer, SolutionItem item) { while (item != null) { solutionExplorer.Collapse(item); item = item.Parent; } }
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExplorerWindow solutionExplorer = await VS.Windows.GetSolutionExplorerWindowAsync(); if (solutionExplorer != null) { solutionExplorer.Collapse(await solutionExplorer.GetSelectionAsync()); } }
public NavigateToProjectCommand( UnconfiguredProject project, IProjectThreadingService threadingService, IVsProjectServices projectServices, SolutionExplorerWindow solutionExplorer) { _project = project; _threadingService = threadingService; _projectServices = projectServices; _solutionExplorer = solutionExplorer; }
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExplorerWindow solutionExplorer = await VS.Windows.GetSolutionExplorerWindowAsync(); if (solutionExplorer != null) { SolutionItem item = (await solutionExplorer.GetSelectionAsync()).FirstOrDefault(); if (item != null) { solutionExplorer.EditLabel(item); } } }
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExplorerWindow solutionExplorer = await VS.Windows.GetSolutionExplorerWindowAsync(); if (solutionExplorer != null) { if (solutionExplorer.IsFilterEnabled <VsixManifestFilterProvider>()) { solutionExplorer.DisableFilter(); } else { solutionExplorer.EnableFilter <VsixManifestFilterProvider>(); } } }
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExplorerWindow solutionExplorer = await VS.Windows.GetSolutionExplorerWindowAsync(); if (solutionExplorer != null) { IEnumerable <SolutionItem> items = await solutionExplorer.GetSelectionAsync(); SolutionItemExpansionMode mode = SolutionItemExpansionMode.None; ModifierKeys modifiers = Keyboard.Modifiers; if (modifiers == ModifierKeys.None) { mode = SolutionItemExpansionMode.Single; } else { if ((modifiers & ModifierKeys.Control) == ModifierKeys.Control) { mode |= SolutionItemExpansionMode.Recursive; } if ((modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) { // To expand to the selected items, theose items and their ancestors // all need to be collapsed, so collapse them first, then pause for a // moment so that you can see that we start from a collapsed state. foreach (SolutionItem item in items) { CollapseRecursively(solutionExplorer, item); } await Task.Delay(2000); mode |= SolutionItemExpansionMode.Ancestors; } } solutionExplorer.Expand(items, mode); } }
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExplorerWindow solutionExplorer = await VS.Windows.GetSolutionExplorerWindowAsync(); if (solutionExplorer != null) { List <SolutionItem> projects = new List <SolutionItem>(); foreach (SolutionItem item in await solutionExplorer.GetSelectionAsync()) { SolutionItem project = item.FindParent(SolutionItemType.Project); if (project != null) { projects.Add(project); } } if (projects.Count > 0) { solutionExplorer.SetSelection(projects); } } }