Exemplo n.º 1
0
        private IVsCodeWindow CreateCodeView(string documentMoniker, IVsTextLines textLines, bool createdDocData, ref string editorCaption, ref Guid cmdUI)
        {
            Type codeWindowType = typeof(IVsCodeWindow);
            var  compModel      = _package.AsVsServiceProvider().GetComponentModel();
            var  adapterService = compModel.GetService <IVsEditorAdaptersFactoryService>();

            var window = adapterService.CreateVsCodeWindowAdapter(_oleServiceProvider);

            ErrorHandler.ThrowOnFailure(window.SetBuffer(textLines));
            ErrorHandler.ThrowOnFailure(window.SetBaseEditorCaption(null));
            ErrorHandler.ThrowOnFailure(window.GetEditorCaption(READONLYSTATUS.ROSTATUS_Unknown, out editorCaption));

            cmdUI = VSConstants.GUID_TextEditorFactory;

            var textMgr             = _package.AsVsServiceProvider().GetTextManager();
            var bufferEventListener = new TextBufferEventListener(this, compModel, textLines, textMgr, window);

            if (!createdDocData)
            {
                // we have a pre-created buffer, go ahead and initialize now as the buffer already
                // exists and is initialized.
                bufferEventListener.OnLoadCompleted(0);
            }

            return(window);
        }
Exemplo n.º 2
0
 protected LanguageInfoBase(LanguagePackageBase languagePackage)
 {
     _languagePackage = languagePackage;
     _serviceProvider = languagePackage.AsVsServiceProvider();
 }