Main R editor command controller
Inheritance: Microsoft.Languages.Editor.Controller.ViewController
Esempio n. 1
0
        /// <summary>
        /// Attaches command controller to the view and projected buffer
        /// </summary>
        public static RMainController Attach(ITextView textView, ITextBuffer textBuffer) {
            RMainController controller = FromTextView(textView);
            if (controller == null) {
                controller = new RMainController(textView, textBuffer);
            }

            return controller;
        }
Esempio n. 2
0
        /// <summary>
        /// Attaches command controller to the view and projected buffer
        /// </summary>
        public static RMainController Attach(ITextView textView, ITextBuffer textBuffer) {
            RMainController controller = FromTextView(textView);
            if (controller == null) {
                controller = new RMainController(textView, textBuffer);
            }

            return controller;
        }
        protected override void OnTextViewConnected(ITextView textView, ITextBuffer textBuffer)
        {
            var mainController = RMainController.Attach(textView, textBuffer, Services);

            if (textBuffer != textView.TextBuffer)
            {
                // Projected scenario
                _containedLanguageHost = textBuffer.GetService <IContainedLanguageHost>();
                if (_containedLanguageHost != null)
                {
                    _containedLanguageHost.Closing += OnContainedLanguageHostClosing;
                    _textBuffer = textBuffer;

                    var nextTarget = _containedLanguageHost.SetContainedCommandTarget(textView.ToEditorView(), mainController);
                    // Convert chained target to ICommandTarget (chained target might be IOleCommandTarget and host will create a shim then).
                    mainController.ChainedController = nextTarget;
                }
            }
            base.OnTextViewConnected(textView, textBuffer);
        }
        protected override void OnTextViewConnected(ITextView textView, ITextBuffer textBuffer)
        {
            RMainController.Attach(textView, textBuffer);

            base.OnTextViewConnected(textView, textBuffer);
        }