private void textEditorMenuItem_BeforeQueryStatus(object sender, System.EventArgs e) { OleMenuCommand menuItem = sender as OleMenuCommand; ToolWindowPane window = this.package.FindToolWindow(typeof(AlfredWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException("Cannot create tool window"); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); AlfredWindow alfredWindow = window as AlfredWindow; if (alfredWindow != null && !String.IsNullOrEmpty(VisualStudioHandler.GetCurrentLineSelectedText())) { menuItem.Enabled = true; menuItem.Visible = true; } else { menuItem.Enabled = false; menuItem.Visible = false; } }
public Task <IEnumerable <SuggestedActionSet> > GetActionSetsAsync(CancellationToken cancellationToken) { AlfredSuggestedActionItem actionItem; List <SuggestedActionSet> suggestedActionSetList = new List <SuggestedActionSet>(); List <VisualStudioErrorCodeItem> visualStudioErrorCodeItemList = VisualStudioHandler.GetCurrentLineErrorList(); foreach (VisualStudioErrorCodeItem codeItem in visualStudioErrorCodeItemList) { actionItem = new AlfredSuggestedActionItem(codeItem); suggestedActionSetList.Add(new SuggestedActionSet(new ISuggestedAction[] { actionItem })); } return(System.Threading.Tasks.Task.FromResult <IEnumerable <SuggestedActionSet> >(suggestedActionSetList)); }
private void ExecuteToolMenuTextEditorMenu(object sender, System.EventArgs e) { OleMenuCommand menuItem = sender as OleMenuCommand; ToolWindowPane window = this.package.FindToolWindow(typeof(AlfredWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException("Cannot create tool window"); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); AlfredWindow alfredWindow = window as AlfredWindow; string selectedText = VisualStudioHandler.GetCurrentLineSelectedText(); AlfredInput alfredInput = AlfredInputManager.Instance.GetInputForAlfredWindowSearchBar(selectedText); alfredWindow.SearchSpecificInput(alfredInput); }