当前位置: 首页>>代码示例>>C#>>正文


C# IOleCommandTarget类代码示例

本文整理汇总了C#中IOleCommandTarget的典型用法代码示例。如果您正苦于以下问题:C# IOleCommandTarget类的具体用法?C# IOleCommandTarget怎么用?C# IOleCommandTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IOleCommandTarget类属于命名空间,在下文中一共展示了IOleCommandTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCommandTarget

 public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget)
 {
     var target = new ScriptingOleCommandTarget(textView, _commandHandlerServiceFactory, _editorAdaptersFactory, _serviceProvider);
     target.RefreshCommandFilters();
     target.NextCommandTarget = nextTarget;
     return target;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:CSharpVsInteractiveWindowCommandProvider.cs

示例2: VSCodeEditorWindow

        public VSCodeEditorWindow(ServiceBroker sb, UserControl parent)
        {
            services = sb;
            coreEditor = new VSCodeEditor(parent.Handle, services);

            //Create window            
            IVsCodeWindow win = coreEditor.CodeWindow;
            cmdTarget = win as IOleCommandTarget;

            IVsTextView textView;
            int hr = win.GetPrimaryView(out textView);
            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            // assign the window handle
            IntPtr commandHwnd = textView.GetWindowHandle();
            AssignHandle(commandHwnd);

            //Register priority command target
            hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
                0, (IOleCommandTarget)this, out cmdTargetCookie);

            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            //Add message filter
            Application.AddMessageFilter((System.Windows.Forms.IMessageFilter)this);
        }
开发者ID:elevate,项目名称:mysqlconnector-.net,代码行数:28,代码来源:VSCodeEditorWindow.cs

示例3: IsJSLSInstalled

 ///<summary>Attempts to figure out whether the JSLS language service has been installed yet.</summary>
 static bool IsJSLSInstalled(IOleCommandTarget next)
 {
     Guid cmdGroup = VSConstants.VSStd2K;
     var cmds = new[] { new OLECMD { cmdID = (uint)VSConstants.VSStd2KCmdID.AUTOCOMPLETE } };
     ErrorHandler.ThrowOnFailure(next.QueryStatus(ref cmdGroup, 1, cmds, IntPtr.Zero));
     return cmds[0].cmdf == 3;
 }
开发者ID:Russe11,项目名称:WebEssentials2013,代码行数:8,代码来源:JavaScriptCompletionController.cs

示例4: VsCommandTargetTest

        public VsCommandTargetTest()
        {
            _textView = CreateTextView("");
            _buffer = Vim.CreateVimBuffer(_textView);
            _bufferCoordinator = new VimBufferCoordinator(_buffer);
            _vim = _buffer.Vim;
            _factory = new MockRepository(MockBehavior.Strict);

            // By default Resharper isn't loaded
            _resharperUtil = _factory.Create<IResharperUtil>();
            _resharperUtil.SetupGet(x => x.IsInstalled).Returns(false);

            _nextTarget = _factory.Create<IOleCommandTarget>(MockBehavior.Strict);
            _vsAdapter = _factory.Create<IVsAdapter>();
            _vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(InputManager.Current.PrimaryKeyboardDevice);
            _vsAdapter.Setup(x => x.InAutomationFunction).Returns(false);
            _vsAdapter.Setup(x => x.InDebugMode).Returns(false);
            _vsAdapter.Setup(x => x.IsIncrementalSearchActive(It.IsAny<ITextView>())).Returns(false);

            _broker = _factory.Create<IDisplayWindowBroker>(MockBehavior.Loose);

            var oldCommandFilter = _nextTarget.Object;
            var vsTextView = _factory.Create<IVsTextView>(MockBehavior.Loose);
            vsTextView.Setup(x => x.AddCommandFilter(It.IsAny<IOleCommandTarget>(), out oldCommandFilter)).Returns(0);
            var result = VsCommandTarget.Create(
                _bufferCoordinator,
                vsTextView.Object,
                _vsAdapter.Object,
                _broker.Object,
                _resharperUtil.Object,
                KeyUtil);
            Assert.True(result.IsSuccess);
            _targetRaw = result.Value;
            _target = _targetRaw;
        }
开发者ID:kcprogrammer,项目名称:VsVim,代码行数:35,代码来源:VsCommandTargetTest.cs

示例5: WrapQueryStatus

    public static int WrapQueryStatus(
      IOleCommandTarget receiver,
      IOleCommandTarget implementer,
      ref System.Guid pguidCmdGroup,
      uint cCmds,
      OLECMD[] prgCmds,
      System.IntPtr pCmdText) {
      Debug.Assert(receiver != null);

      var commandId = new CommandID(pguidCmdGroup, (int)prgCmds[0].cmdID);
      if (LogCommand(commandId)) {
        Logger.LogInfo("WrapQueryStatus: => recv={0}, impl={1}, parent={2}",
          receiver,
          GetImplementerString(implementer),
          GetParentTargetString(implementer));
      }

      var hr = (implementer == null)
        ? (int)Constants.OLECMDERR_E_NOTSUPPORTED
        : implementer.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);

      if (LogCommand(commandId)) {
        Logger.LogInfo("WrapQueryStatus: <= recv={0}, impl={1}, parent={2}, hr={3}, cmdf={4}",
          receiver,
          GetImplementerString(implementer),
          GetParentTargetString(implementer),
          HrToString(hr),
          CmdFlagsToString(prgCmds));
      }
      return hr;
    }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:31,代码来源:OleCommandTargetSpy.cs

示例6: RebarController

        public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite)
        {
            this.tabbar = tabbar;
            this.bandObjectSite = bandObjectSite;
            ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2);
            Handle = hwndReBar;
            rebarController = new NativeWindowController(hwndReBar);
            rebarController.MessageCaptured += RebarMessageCaptured;

            REBARBANDINFO structure = new REBARBANDINFO();
            structure.cbSize = Marshal.SizeOf(structure);
            structure.fMask = RBBIM.CHILD | RBBIM.ID;
            int num = (int)PInvoke.SendMessage(Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero);
            for(int i = 0; i < num; i++) {
                PInvoke.SendMessage(Handle, RB.GETBANDINFO, (IntPtr)i, ref structure);
                if(PInvoke.GetClassName(structure.hwndChild) == "ToolbarWindow32" && structure.wID == 1) {
                    menuController = new NativeWindowController(structure.hwndChild);
                    menuController.MessageCaptured += MenuMessageCaptured;
                    break;
                }
            }

            if(Config.Skin.UseRebarBGColor) {
                if(DefaultRebarCOLORREF == -1) {
                    DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
                }
                int num2 = QTUtility2.MakeCOLORREF(Config.Skin.RebarColor);
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2);
            }

            EnsureMenuBarIsCorrect();
        }
开发者ID:svn2github,项目名称:QTTabBar,代码行数:32,代码来源:RebarController.cs

示例7: GetCommandTarget

        public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) {
            IOleCommandTarget target = ServiceManager.GetService<IOleCommandTarget>(textView);
            if (target == null) {
                ReplCommandController controller = ReplCommandController.Attach(textView, textView.TextBuffer);

                // Wrap controller into OLE command target
                target = VsAppShell.Current.TranslateToHostCommandTarget(textView, controller) as IOleCommandTarget;
                Debug.Assert(target != null);

                ServiceManager.AddService(target, textView);

                // Wrap next OLE target in the chain into ICommandTarget so we can have 
                // chain like: OLE Target -> Shim -> ICommandTarget -> Shim -> Next OLE target
                ICommandTarget nextCommandTarget = VsAppShell.Current.TranslateCommandTarget(textView, nextTarget);
                controller.ChainedController = nextCommandTarget;

                // We need to listed when R projected buffer is attached and 
                // create R editor document over it.
                textView.BufferGraph.GraphBuffersChanged += OnGraphBuffersChanged;
                IProjectionBuffer pb = textView.TextBuffer as IProjectionBuffer;
                if (pb != null) {
                    pb.SourceBuffersChanged += OnSourceBuffersChanged;
                }

                textView.Closed += TextView_Closed;
            }

            return target;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:29,代码来源:ReplCommandTargetProvider.cs

示例8: CommandTargetHelper

 public CommandTargetHelper(IOleCommandTarget commandTarget)
 {
     if (null == commandTarget)
     {
         throw new ArgumentNullException("commandTarget");
     }
     this.target = commandTarget;
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:CommandTargetHelper.cs

示例9:

        int IVsSmartTagData.GetContextMenuInfo(out Guid guidID, out int nMenuID, out IOleCommandTarget pCmdTarget)
        {
            guidID     = MenuCmd.guidNemerleProjectCmdSet;
            nMenuID    = (int)MenuCmd.CmdId.SmartTagContextMenu;
            pCmdTarget = this;

            return VSConstants.S_OK;
        }
开发者ID:vestild,项目名称:nemerle,代码行数:8,代码来源:NemerleSmartTagData.cs

示例10: IntelliSenseManager

 public IntelliSenseManager(ICompletionBroker broker, SVsServiceProvider provider, IOleCommandTarget commandHandler, ITextView textView)
 {
     _broker = broker;
     NextCommandHandler = commandHandler;
     _textView = textView;
     _isRepl = _textView.Properties.ContainsProperty(BufferProperties.FromRepl);
     _serviceProvider = provider;
 }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:8,代码来源:IntelliSenseManager.cs

示例11: OleMenuCommandService

 /// <include file='doc\OleMenuCommandService.uex' path='docs/doc[@for="OleMenuCommandService.OleMenuCommandService1"]/*' />
 /// <devdoc>
 ///     Creates a new menu command service.
 /// </devdoc>
 public OleMenuCommandService(IServiceProvider serviceProvider, IOleCommandTarget parentCommandTarget)
     : base(serviceProvider)
 {
     if (parentCommandTarget == null) {
         throw new ArgumentNullException("parentCommandTarget");
     }
     _parentTarget = parentCommandTarget;
     _provider = serviceProvider;
 }
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:13,代码来源:OleMenuCommandService.cs

示例12: AddCommandTarget

        public void AddCommandTarget(Ankh.UI.VSContainerForm form, IOleCommandTarget commandTarget)
        {
            VSCommandRouting routing = VSCommandRouting.FromForm(form);

            if (routing != null)
                routing.AddCommandTarget(commandTarget);
            else
                throw new InvalidOperationException("Command routing not initialized yet");
        }
开发者ID:necora,项目名称:ank_git,代码行数:9,代码来源:AnkhDialogOwner.cs

示例13:

        ICommandTarget ICommandTargetFactory.CreateCommandTarget(IOleCommandTarget nextCommandTarget, IVimBufferCoordinator vimBufferCoordinator)
        {
            if (!_reSharperUtil.IsInstalled)
            {
                return null;
            }

            return ReSharperKeyUtil.GetOrCreate(vimBufferCoordinator);
        }
开发者ID:louisfeng,项目名称:VsVim,代码行数:9,代码来源:ReSharperKeyUtil.cs

示例14: TextViewWrapper

 internal TextViewWrapper(IVsContainedLanguageHost languageHost, IVsIntellisenseHost intellisenseHost, IVsTextBufferCoordinator coordinator, IOleCommandTarget nextTarget)
 {
     if (null == intellisenseHost) {
         throw new ArgumentNullException("buffer");
     }
     this.intellisenseHost = intellisenseHost;
     this.bufferCoordinator = coordinator;
     this.languageHost = languageHost;
     this.nextTarget = nextTarget;
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:10,代码来源:TextViewWrapper.cs

示例15: DialogContainerWithToolbar

        /// <include file='doc\DialogContainerWithToolbar.uex' path='docs/doc[@for="DialogContainerWithToolbar.DialogContainerWithToolbar"]/*' />
        /// <devdoc>
        /// Constructor of the DialogContainerWithToolbar. This constructor allow the caller to set a IServiceProvider,
        /// the conatined control and an additional IOleCommandTarget implementation that will be chained to the one
        /// implemented by OleMenuCommandTarget.
        /// </devdoc>
        public DialogContainerWithToolbar(IServiceProvider sp, Control contained, IOleCommandTarget parentCommandTarget)
        {
            if (null == contained)
                throw new ArgumentNullException("contained");

            if (null == sp)
                throw new ArgumentNullException("sp");

            PrivateInit(sp, contained, parentCommandTarget);
        }
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:16,代码来源:DialogContainerWithToolbar.cs


注:本文中的IOleCommandTarget类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。