Пример #1
0
 private void OnMappingsChanged(object sender, MappingsChangedEventArgs e)
 {
     if (e.Mappings.Count > 0)
     {
         _languageBuffer.MappingsChanged -= OnMappingsChanged;
         IContainedLanguageHost host = ContainedLanguageHost.GetHost(TextView, _languageBuffer.IProjectionBuffer);
         host.SetContainedCommandTarget(TextView, ContainedLanguageTarget);
         ContainedLanguageTarget = null;
         TextView        = null;
         _languageBuffer = null;
     }
 }
Пример #2
0
        protected override void OnTextViewConnected(ITextView textView, ITextBuffer textBuffer) {
            RMainController.Attach(textView, textBuffer, Shell);
            if (textBuffer != textView.TextBuffer) {
                // Projected scenario
                _containedLanguageHost = ContainedLanguageHost.GetHost(textView, textBuffer, Shell);
                if (_containedLanguageHost != null) {
                    _containedLanguageHost.Closing += OnContainedLanguageHostClosing;
                    _textBuffer = textBuffer;

                    var mainController = RMainController.FromTextView(textView);
                    var nextTarget = _containedLanguageHost.SetContainedCommandTarget(textView, 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);
        }
Пример #3
0
        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);
        }