コード例 #1
0
        public override void OnToolWindowCreated()
        {
            Guid commandUiGuid = Microsoft.VisualStudio.VSConstants.GUID_TextEditorFactory;

            ((IVsWindowFrame)Frame).SetGuidProperty((int)__VSFPROPID.VSFPROPID_InheritKeyBindings, ref commandUiGuid);

            var earlyFilter = new EarlyCommandFilter(this);

            ErrorHandler.ThrowOnFailure(_view.AddCommandFilter(earlyFilter, out earlyFilter._nextTarget));
            _commandService = new OleMenuCommandService(this, (IOleCommandTarget)_view);

            AddCommand(VSConstants.VSStd2KCmdID.CANCEL, () => _replWindow.Cancel());

            AddCommand(VSConstants.VSStd2KCmdID.UP, _replWindow.SmartUpArrow);
            AddCommand(VSConstants.VSStd2KCmdID.DOWN, _replWindow.SmartDownArrow);
            AddCommand(VSConstants.VSStd2KCmdID.BOL, () => _replWindow.Home(false));
            AddCommand(VSConstants.VSStd2KCmdID.BOL_EXT, () => _replWindow.Home(true));

            AddCommand(VSConstants.VSStd2KCmdID.SHOWCONTEXTMENU, ShowContextMenu);

            var id  = new CommandID(GuidList.guidIronStudioCmdSet, (int)PkgCmdIDList.cmdidBreakRepl);
            var cmd = new OleMenuCommand(BreakRepl, id);

            _commandService.AddCommand(cmd);

            id  = new CommandID(GuidList.guidIronStudioCmdSet, (int)PkgCmdIDList.cmdidResetRepl);
            cmd = new OleMenuCommand(ResetRepl, id);
            _commandService.AddCommand(cmd);

            id  = new CommandID(GuidList.guidIronStudioCmdSet, (int)PkgCmdIDList.cmdidSmartExecute);
            cmd = new OleMenuCommand(SmartExecute, id);
            _commandService.AddCommand(cmd);


            id  = new CommandID(GuidList.guidIronStudioCmdSet, (int)PkgCmdIDList.cmdidReplHistoryNext);
            cmd = new OleMenuCommand(SmartExecute, id);
            _commandService.AddCommand(cmd);

            id  = new CommandID(GuidList.guidIronStudioCmdSet, (int)PkgCmdIDList.cmdidBreakLine);
            cmd = new OleMenuCommand(SmartExecute, id);
            _commandService.AddCommand(cmd);


            id  = new CommandID(GuidList.guidIronStudioCmdSet, (int)PkgCmdIDList.cmdidReplHistoryPrevious);
            cmd = new OleMenuCommand(SmartExecute, id);
            _commandService.AddCommand(cmd);

            base.OnToolWindowCreated();
        }