public override void Close() { ServiceManager.RemoveService<VsMdEditorDocument>(TextBuffer); base.Close(); _editorInstance?.Dispose(); _editorInstance = null; }
public VsMdEditorDocument(IEditorInstance editorInstance, IProjectionBufferFactoryService projectionBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService) : base(editorInstance.ViewBuffer, projectionBufferFactoryService, contentTypeRegistryService) { _editorInstance = editorInstance; ServiceManager.AddService <VsMdEditorDocument>(this, TextBuffer); }
public override void Close() { ServiceManager.RemoveService <VsMdEditorDocument>(TextBuffer); base.Close(); _editorInstance?.Dispose(); _editorInstance = null; }
public override void Close() { ServiceManager.RemoveService<VsREditorDocument>(TextBuffer); base.Close(); // Prevent stack overflow var instance = _editorInstance; _editorInstance = null; instance?.Dispose(); }
private void InitEditorInstance(ITextBuffer textBuffer) { if (ServiceManager.GetService <IEditorInstance>(textBuffer) == null) { ContentTypeImportComposer <IEditorFactory> importComposer = new ContentTypeImportComposer <IEditorFactory>(_shell.CompositionService); IEditorFactory factory = importComposer.GetImport(textBuffer.ContentType.TypeName); IEditorInstance editorInstance = factory.CreateEditorInstance(textBuffer, new RDocumentFactory(_shell)); } }
public void Start(string map) { if (editor != null) { Log.Warning("Editor is already started"); return; } editor = Game.GameFactory.CreateEditor(Game, map); editor?.Initialize(); }
protected override void OnTextBufferDisposing(ITextBuffer textBuffer) { IEditorInstance editorInstance = ServiceManager.GetService <IEditorInstance>(textBuffer); if (editorInstance != null) { editorInstance.Dispose(); } base.OnTextBufferDisposing(textBuffer); }
private void CreateTextViewHost(string text, string filePath) { if (text == null) { text = string.Empty; } var diskBuffer = TextBufferFactoryService.CreateTextBuffer(text, ContentType); _editorIntance = EditorInstanceFactory.CreateEditorInstance(diskBuffer, _compositionService); ITextDataModel textDataModel; if (_editorIntance != null) { textDataModel = new TextDataModel(diskBuffer, _editorIntance.ViewBuffer); } else { textDataModel = new TextDataModel(diskBuffer, diskBuffer); } var textBuffer = textDataModel.DocumentBuffer; TextDocument = TextDocumentFactoryService.CreateTextDocument(textBuffer, filePath); SetGlobalEditorOptions(); var textView = TextEditorFactoryService.CreateTextView(textDataModel, new DefaultTextViewRoleSet(), GlobalOptions); _wpftextViewHost = TextEditorFactoryService.CreateTextViewHost(textView, true); ApplyDefaultSettings(); _contentControl.Content = _wpftextViewHost.HostControl; var baseController = new BaseController(); BaseController = baseController; if (_editorIntance != null) { CommandTarget = _editorIntance.GetCommandTarget(textView); var controller = CommandTarget as Microsoft.Languages.Editor.Controller.Controller; controller.ChainedController = baseController; } else { CommandTarget = baseController; } baseController.Initialize(textView, EditorOperations, UndoManager, _coreShell); }
public override void Close() { ServiceManager.RemoveService <VsREditorDocument>(TextBuffer); base.Close(); // Prevent stack overflow var instance = _editorInstance; _editorInstance = null; instance?.Dispose(); }
public void Close() { if (_wpftextViewHost != null) { _wpftextViewHost.Close(); _wpftextViewHost = null; } if (_editorIntance != null) { _editorIntance.Dispose(); _editorIntance = null; } }
private void InitEditorInstance(ITextBuffer textBuffer) { if (ServiceManager.GetService <IEditorInstance>(textBuffer) == null) { ITextDocument textDocument; textBuffer.Properties.TryGetProperty <ITextDocument>(typeof(ITextDocument), out textDocument); Debug.Assert(textDocument != null); ContentTypeImportComposer <IEditorFactory> importComposer = new ContentTypeImportComposer <IEditorFactory>(VsAppShell.Current.CompositionService); IEditorFactory factory = importComposer.GetImport(textBuffer.ContentType.TypeName); IEditorInstance editorInstance = factory.CreateEditorInstance(textBuffer, new VsREditorDocumentFactory()); } }
protected override void OnTextBufferDisposing(ITextBuffer textBuffer) { IEditorInstance editorInstance = ServiceManager.GetService <IEditorInstance>(textBuffer); if (editorInstance != null) { editorInstance.Dispose(); } else { IREditorDocument doc = REditorDocument.TryFromTextBuffer(textBuffer); if (doc != null) { doc.Dispose(); } } base.OnTextBufferDisposing(textBuffer); }
public int OnLoadCompleted(int fReload) { var adapterService = VsAppShell.Current.ExportProvider.GetExport <IVsEditorAdaptersFactoryService>().Value; // Set language service ID as early as possible, since it may change content type of the buffer, // e.g. in a weird scenario when someone does "Open With X Editor" on an Y file. Calling this // will change content type to the one language service specifies instead of the default one for // the file extension, and will ensure that correct editor factory is used. _textLines.SetLanguageServiceID(ref _languageServiceGuid); ITextBuffer diskBuffer = adapterService.GetDocumentBuffer(_textLines); Debug.Assert(diskBuffer != null); try { var importComposer = new ContentTypeImportComposer <IEditorFactory>(VsAppShell.Current.CompositionService); var factory = importComposer.GetImport(diskBuffer.ContentType.TypeName); var documentFactoryImportComposer = new ContentTypeImportComposer <IVsEditorDocumentFactory>(VsAppShell.Current.CompositionService); var documentFactory = documentFactoryImportComposer.GetImport(diskBuffer.ContentType.TypeName); IEditorInstance editorInstance = ServiceManager.GetService <IEditorInstance>(diskBuffer); if (factory != null && editorInstance == null) { editorInstance = factory.CreateEditorInstance(diskBuffer, documentFactory); adapterService.SetDataBuffer(_textLines, editorInstance.ViewBuffer); } } finally { cp.Unadvise(cookie); cookie = 0; _textLines = null; _hierarchy = null; _trackers.Remove(this); _trackers = null; } return(VSConstants.S_OK); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return(new MdEditorDocument(editorInstance.DiskBuffer, _projectionBufferFactoryService, _contentTypeRegistryService, _shell)); }
private void CreateTextViewHost(string text, string filePath) { if (text == null) text = string.Empty; var diskBuffer = TextBufferFactoryService.CreateTextBuffer(text, ContentType); _editorIntance = EditorInstanceFactory.CreateEditorInstance(diskBuffer, _compositionService); ITextDataModel textDataModel; if (_editorIntance != null) { textDataModel = new TextDataModel(diskBuffer, _editorIntance.ViewBuffer); } else { textDataModel = new TextDataModel(diskBuffer, diskBuffer); } var textBuffer = textDataModel.DocumentBuffer; TextDocument = TextDocumentFactoryService.CreateTextDocument(textBuffer, filePath); SetGlobalEditorOptions(); var textView = TextEditorFactoryService.CreateTextView(textDataModel, new DefaultTextViewRoleSet(), GlobalOptions); _wpftextViewHost = TextEditorFactoryService.CreateTextViewHost(textView, true); ApplyDefaultSettings(); _contentControl.Content = _wpftextViewHost.HostControl; var baseController = new BaseController(); BaseController = baseController; if (_editorIntance != null) { CommandTarget = _editorIntance.GetCommandTarget(textView); var controller = CommandTarget as Microsoft.Languages.Editor.Controller.Controller; controller.ChainedController = baseController; } else { CommandTarget = baseController; } baseController.Initialize(textView, EditorOperations, UndoManager, _coreShell); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return(new VsREditorDocument(editorInstance, _shell)); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return new VsREditorDocument(editorInstance, _shell); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return(new REditorDocument(editorInstance.DiskBuffer)); }
public VsREditorDocument(IEditorInstance editorInstance, ICoreShell shell) : base(editorInstance.ViewBuffer, shell) { _editorInstance = editorInstance; ServiceManager.AddService<VsREditorDocument>(this, TextBuffer, shell); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return new MdEditorDocument(editorInstance.ViewBuffer); }
public VsMdEditorDocument(IEditorInstance editorInstance) : base(editorInstance.ViewBuffer) { _editorInstance = editorInstance; ServiceManager.AddService<VsMdEditorDocument>(this, TextBuffer); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return new REditorDocument(editorInstance.DiskBuffer, _shell); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return new MdEditorDocument(editorInstance.DiskBuffer, _projectionBufferFactoryService, _contentTypeRegistryService, _shell); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return(new VsMdEditorDocument(editorInstance)); }
public VsREditorDocument(IEditorInstance editorInstance) : base(editorInstance.ViewBuffer) { _editorInstance = editorInstance; ServiceManager.AddService <VsREditorDocument>(this, TextBuffer); }
public VsREditorDocument(IEditorInstance editorInstance, ICoreShell shell) : base(editorInstance.ViewBuffer, shell) { _editorInstance = editorInstance; ServiceManager.AddService <VsREditorDocument>(this, TextBuffer, shell); }
public VsMdEditorDocument(IEditorInstance editorInstance, IProjectionBufferFactoryService projectionBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, ICoreShell shell) : base(editorInstance.ViewBuffer, projectionBufferFactoryService, contentTypeRegistryService, shell) { _editorInstance = editorInstance; ServiceManager.AddService<VsMdEditorDocument>(this, TextBuffer, shell); }
public IEditorDocument CreateDocument(IEditorInstance editorInstance) { return(new MdEditorDocument(editorInstance.ViewBuffer)); }