コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }