Exemple #1
0
        public LogEditor(LogEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            this.dispatcher       = Dispatcher.CurrentDispatcher;
            this.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;
            this.wpfTextView     = wpfTextViewHost.TextView;
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
            SetNewDocument();
        }
 LogEditorProvider(IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
 {
     this.dsTextEditorFactoryService  = dsTextEditorFactoryService;
     this.contentTypeRegistryService  = contentTypeRegistryService;
     this.textBufferFactoryService    = textBufferFactoryService;
     this.editorOptionsFactoryService = editorOptionsFactoryService;
 }
		DocumentViewerProvider(IWpfCommandService wpfCommandService, IMenuService menuService, IDocumentViewerServiceImpl documentViewerServiceImpl, ITextBufferFactoryService textBufferFactoryService, IDsTextEditorFactoryService dsTextEditorFactoryService) {
			this.wpfCommandService = wpfCommandService;
			this.menuService = menuService;
			this.documentViewerServiceImpl = documentViewerServiceImpl;
			this.textBufferFactoryService = textBufferFactoryService;
			this.dsTextEditorFactoryService = dsTextEditorFactoryService;
		}
 ReplEditorProvider(IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, IPickSaveFilename pickSaveFilename)
 {
     this.dsTextEditorFactoryService        = dsTextEditorFactoryService;
     this.contentTypeRegistryService        = contentTypeRegistryService;
     this.textBufferFactoryService          = textBufferFactoryService;
     this.editorOperationsFactoryService    = editorOperationsFactoryService;
     this.editorOptionsFactoryService       = editorOptionsFactoryService;
     this.classificationTypeRegistryService = classificationTypeRegistryService;
     this.themeClassificationTypeService    = themeClassificationTypeService;
     this.pickSaveFilename = pickSaveFilename;
 }
		ReplEditorProvider(IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, IPickSaveFilename pickSaveFilename, ITextViewUndoManagerProvider textViewUndoManagerProvider) {
			this.dsTextEditorFactoryService = dsTextEditorFactoryService;
			this.contentTypeRegistryService = contentTypeRegistryService;
			this.textBufferFactoryService = textBufferFactoryService;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
			this.editorOptionsFactoryService = editorOptionsFactoryService;
			this.classificationTypeRegistryService = classificationTypeRegistryService;
			this.themeClassificationTypeService = themeClassificationTypeService;
			this.pickSaveFilename = pickSaveFilename;
			this.textViewUndoManagerProvider = textViewUndoManagerProvider;
		}
Exemple #6
0
		public CodeEditor(CodeEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) {
			options = options?.Clone() ?? new CodeEditorOptions();
			options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
			var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
			var textBuffer = options.TextBuffer;
			if (textBuffer == null)
				textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
			var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
			var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
			TextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
			TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
			TextViewHost.TextView.Options.SetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeId, true);
		}
Exemple #7
0
        public CodeEditor(CodeEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService)
        {
            options = options?.Clone() ?? new CodeEditorOptions();
            options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = options.TextBuffer;

            if (textBuffer == null)
            {
                textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
            }
            var roles    = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
            var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);

            TextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
            TextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.CodeEditor);
            TextViewHost.TextView.Options.SetOptionValue(DefaultDsTextViewOptions.RefreshScreenOnChangeId, true);
        }
Exemple #8
0
        public ReplEditor(ReplEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, IPickSaveFilename pickSaveFilename)
        {
            this.dispatcher       = Dispatcher.CurrentDispatcher;
            this.pickSaveFilename = pickSaveFilename;
            options = options?.Clone() ?? new ReplEditorOptions();
            options.CreateGuidObjects     = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
            this.PrimaryPrompt            = options.PrimaryPrompt;
            this.SecondaryPrompt          = options.SecondaryPrompt;
            this.subBuffers               = new List <ReplSubBuffer>();
            this.cachedColorsList         = new CachedColorsList();
            TextClassificationType        = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.Text);
            ReplPrompt1ClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.ReplPrompt1);
            ReplPrompt2ClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.ReplPrompt2);

            var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
            var textBuffer  = textBufferFactoryService.CreateTextBuffer(contentType);

            CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
            var roles           = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
            var textView        = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
            var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);

            this.wpfTextViewHost = wpfTextViewHost;
            this.wpfTextView     = wpfTextViewHost.TextView;
            ReplEditorUtils.AddInstance(this, wpfTextView);
            wpfTextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.REPL);
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
            //TODO: ReplEditorOperations doesn't support virtual space
            wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.UseVirtualSpaceId, false);
            //TODO: Support box selection
            wpfTextView.Options.SetOptionValue(DefaultDsTextViewOptions.AllowBoxSelectionId, false);
            wpfTextView.Options.OptionChanged         += Options_OptionChanged;
            wpfTextView.TextBuffer.ChangedLowPriority += TextBuffer_ChangedLowPriority;
            wpfTextView.Closed += WpfTextView_Closed;
            this.wpfTextView.TextBuffer.Changed += TextBuffer_Changed;
            AddNewDocument();
            WriteOffsetOfPrompt(null, true);
            ReplEditorOperations              = new ReplEditorOperations(this, wpfTextView, editorOperationsFactoryService);
            wpfTextView.VisualElement.Loaded += WpfTextView_Loaded;
            UpdateRefreshScreenOnChange();
            CustomLineNumberMargin.SetOwner(wpfTextView, new ReplCustomLineNumberMarginOwner(this, themeClassificationTypeService));
        }
Exemple #9
0
		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();
		}
Exemple #10
0
		public ReplEditor(ReplEditorOptions options, IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, IClassificationTypeRegistryService classificationTypeRegistryService, IThemeClassificationTypeService themeClassificationTypeService, IPickSaveFilename pickSaveFilename, ITextViewUndoManagerProvider textViewUndoManagerProvider) {
			dispatcher = Dispatcher.CurrentDispatcher;
			this.pickSaveFilename = pickSaveFilename;
			options = options?.Clone() ?? new ReplEditorOptions();
			options.CreateGuidObjects = CommonGuidObjectsProvider.Create(options.CreateGuidObjects, new GuidObjectsProvider(this));
			PrimaryPrompt = options.PrimaryPrompt;
			SecondaryPrompt = options.SecondaryPrompt;
			subBuffers = new List<ReplSubBuffer>();
			cachedColorsList = new CachedColorsList();
			TextClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.Text);
			ReplPrompt1ClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.ReplPrompt1);
			ReplPrompt2ClassificationType = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.ReplPrompt2);

			var contentType = contentTypeRegistryService.GetContentType(options.ContentType, options.ContentTypeString) ?? textBufferFactoryService.TextContentType;
			var textBuffer = textBufferFactoryService.CreateTextBuffer(contentType);
			CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
			var roles = dsTextEditorFactoryService.CreateTextViewRoleSet(options.Roles);
			var textView = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, editorOptionsFactoryService.GlobalOptions, options);
			var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);
			this.wpfTextViewHost = wpfTextViewHost;
			wpfTextView = wpfTextViewHost.TextView;
			textViewUndoManager = textViewUndoManagerProvider.GetTextViewUndoManager(wpfTextView);
			ReplEditorUtils.AddInstance(this, wpfTextView);
			wpfTextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
			wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
			//TODO: ReplEditorOperations doesn't support virtual space
			wpfTextView.Options.SetOptionValue(DefaultTextViewOptions.UseVirtualSpaceId, false);
			//TODO: Support box selection
			wpfTextView.Options.SetOptionValue(DefaultDsTextViewOptions.AllowBoxSelectionId, false);
			wpfTextView.Options.OptionChanged += Options_OptionChanged;
			wpfTextView.TextBuffer.ChangedLowPriority += TextBuffer_ChangedLowPriority;
			wpfTextView.Closed += WpfTextView_Closed;
			wpfTextView.TextBuffer.Changed += TextBuffer_Changed;
			AddNewDocument();
			WriteOffsetOfPrompt(null, true);
			ReplEditorOperations = new ReplEditorOperations(this, wpfTextView, editorOperationsFactoryService);
			wpfTextView.VisualElement.Loaded += WpfTextView_Loaded;
			UpdateRefreshScreenOnChange();
			CustomLineNumberMargin.SetOwner(wpfTextView, new ReplCustomLineNumberMarginOwner(this, themeClassificationTypeService));
		}
        public DocumentViewerControl(ITextBufferFactoryService textBufferFactoryService, IDsTextEditorFactoryService dsTextEditorFactoryService, IDocumentViewerHelper textEditorHelper)
        {
            if (textBufferFactoryService == null)
            {
                throw new ArgumentNullException(nameof(textBufferFactoryService));
            }
            if (dsTextEditorFactoryService == null)
            {
                throw new ArgumentNullException(nameof(dsTextEditorFactoryService));
            }
            this.textEditorHelper   = textEditorHelper ?? throw new ArgumentNullException(nameof(textEditorHelper));
            defaultContentType      = textBufferFactoryService.TextContentType;
            cachedColorsList        = new CachedColorsList();
            emptyContent            = new DocumentViewerContent(string.Empty, CachedTextColorsCollection.Empty, SpanDataCollection <ReferenceInfo> .Empty, new Dictionary <string, object>());
            currentContent          = new CurrentContent(emptyContent, defaultContentType);
            spanReferenceCollection = SpanDataCollection <ReferenceAndId> .Empty;

            var textBuffer = textBufferFactoryService.CreateTextBuffer(textBufferFactoryService.TextContentType);

            CachedColorsListTaggerProvider.AddColorizer(textBuffer, cachedColorsList);
            var roles   = dsTextEditorFactoryService.CreateTextViewRoleSet(defaultRoles);
            var options = new TextViewCreatorOptions {
                EnableUndoHistory = false
            };
            var textView        = dsTextEditorFactoryService.CreateTextView(textBuffer, roles, options);
            var wpfTextViewHost = dsTextEditorFactoryService.CreateTextViewHost(textView, false);

            this.wpfTextViewHost = wpfTextViewHost;
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.TextEditor);
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewOptions.ViewProhibitUserInputId, true);
            wpfTextViewHost.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, true);
            Children.Add(wpfTextViewHost.HostControl);
        }
		CodeEditorProvider(IDsTextEditorFactoryService dsTextEditorFactoryService, IContentTypeRegistryService contentTypeRegistryService, ITextBufferFactoryService textBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService) {
			this.dsTextEditorFactoryService = dsTextEditorFactoryService;
			this.contentTypeRegistryService = contentTypeRegistryService;
			this.textBufferFactoryService = textBufferFactoryService;
			this.editorOptionsFactoryService = editorOptionsFactoryService;
		}