LogEditorOptions CopyTo(LogEditorOptions other) { base.CopyTo(other); other.ExtraRoles.Clear(); other.ExtraRoles.AddRange(ExtraRoles); return(other); }
public LogEditor(LogEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) { dispatcher = Dispatcher.CurrentDispatcher; cachedColorsList = new CachedColorsList(); options = options?.Clone() ?? new LogEditorOptions(); options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this)); var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType; var textBuffer = textBufferFactoryService.CreateTextBuffer(contentType); CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList); var rolesList = new List<string>(defaultRoles); rolesList.AddRange(options.ExtraRoles); var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(rolesList); var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options); var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false); this.wpfTextViewHost = wpfTextViewHost; wpfTextView = wpfTextViewHost.TextView; wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false); wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true); wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true); SetNewDocument(); }
IOutputTextPane Create(Guid guid, string name, object contentTypeObj) { if (name == null) throw new ArgumentNullException(nameof(name)); var vm = OutputBuffers.FirstOrDefault(a => a.Guid == guid); Debug.Assert(vm == null || vm.Name == name); if (vm != null) return vm; var logEditorOptions = new LogEditorOptions { MenuGuid = new Guid(MenuConstants.GUIDOBJ_LOG_TEXTEDITORCONTROL_GUID), ContentType = contentTypeObj as IContentType, ContentTypeString = contentTypeObj as string, CreateGuidObjects = args => CreateGuidObjects(args), }; logEditorOptions.ExtraRoles.Add(PredefinedDsTextViewRoles.OutputTextPane); var logEditor = logEditorProvider.Create(logEditorOptions); logEditor.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.OutputWindow); // Prevent toolwindow's ctx menu from showing up when right-clicking in the left margin menuService.InitializeContextMenu(logEditor.TextViewHost.HostControl, Guid.NewGuid()); vm = new OutputBufferVM(editorOperationsFactoryService, guid, name, logEditor); int index = GetSortedInsertIndex(vm); OutputBuffers.Insert(index, vm); while (index < OutputBuffers.Count) OutputBuffers[index].Index = index++; OutputTextPaneUtils.AddInstance(vm, logEditor.TextView); return vm; }
LogEditorOptions CopyTo(LogEditorOptions other) { base.CopyTo(other); other.ExtraRoles.Clear(); other.ExtraRoles.AddRange(ExtraRoles); return other; }