本文整理汇总了C#中ITextEditorFactoryService.CreateTextViewRoleSet方法的典型用法代码示例。如果您正苦于以下问题:C# ITextEditorFactoryService.CreateTextViewRoleSet方法的具体用法?C# ITextEditorFactoryService.CreateTextViewRoleSet怎么用?C# ITextEditorFactoryService.CreateTextViewRoleSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITextEditorFactoryService
的用法示例。
在下文中一共展示了ITextEditorFactoryService.CreateTextViewRoleSet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateShrunkenTextView
internal static IWpfTextView CreateShrunkenTextView(
ITextEditorFactoryService textEditorFactoryService,
ITextBuffer finalBuffer)
{
var roles = textEditorFactoryService.CreateTextViewRoleSet(OutliningRegionTextViewRole);
var view = textEditorFactoryService.CreateTextView(finalBuffer, roles);
view.Background = Brushes.Transparent;
view.SizeToFit();
// Zoom out a bit to shrink the text.
view.ZoomLevel *= 0.75;
return view;
}
示例2: CreateTextView
private static IWpfTextView CreateTextView(ITextBuffer historyTextBuffer, ITextEditorFactoryService textEditorFactory) {
var textView = textEditorFactory.CreateTextView(historyTextBuffer, textEditorFactory.DefaultRoles.UnionWith(textEditorFactory.CreateTextViewRoleSet(TextViewRole)));
textView.Options.SetOptionValue(DefaultTextViewHostOptions.VerticalScrollBarId, true);
textView.Options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true);
textView.Options.SetOptionValue(DefaultTextViewHostOptions.SelectionMarginId, false);
textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
textView.Options.SetOptionValue(DefaultTextViewHostOptions.ZoomControlId, false);
textView.Options.SetOptionValue(DefaultWpfViewOptions.EnableMouseWheelZoomId, false);
textView.Options.SetOptionValue(DefaultWpfViewOptions.EnableHighlightCurrentLineId, false);
textView.Options.SetOptionValue(DefaultTextViewOptions.AutoScrollId, true);
textView.Options.SetOptionValue(DefaultTextViewOptions.BraceCompletionEnabledOptionId, false);
textView.Options.SetOptionValue(DefaultTextViewOptions.DragDropEditingId, false);
textView.Options.SetOptionValue(DefaultTextViewOptions.UseVirtualSpaceId, false);
textView.Caret.IsHidden = true;
return textView;
}
示例3: PreviewFactoryService
public PreviewFactoryService(
ITextBufferFactoryService textBufferFactoryService,
IContentTypeRegistryService contentTypeRegistryService,
IProjectionBufferFactoryService projectionBufferFactoryService,
ITextEditorFactoryService textEditorFactoryService,
IEditorOptionsFactoryService editorOptionsFactoryService,
ITextDifferencingSelectorService differenceSelectorService,
IDifferenceBufferFactoryService differenceBufferService,
IWpfDifferenceViewerFactoryService differenceViewerService)
{
_textBufferFactoryService = textBufferFactoryService;
_contentTypeRegistryService = contentTypeRegistryService;
_projectionBufferFactoryService = projectionBufferFactoryService;
_editorOptionsFactoryService = editorOptionsFactoryService;
_differenceSelectorService = differenceSelectorService;
_differenceBufferService = differenceBufferService;
_differenceViewerService = differenceViewerService;
_previewRoleSet = textEditorFactoryService.CreateTextViewRoleSet(
TextViewRoles.PreviewRole, PredefinedTextViewRoles.Analyzable);
}
示例4: InteractiveWindow
public InteractiveWindow(
IInteractiveWindowEditorFactoryService host,
IContentTypeRegistryService contentTypeRegistry,
ITextBufferFactoryService bufferFactory,
IProjectionBufferFactoryService projectionBufferFactory,
IEditorOperationsFactoryService editorOperationsFactory,
ITextEditorFactoryService editorFactory,
IIntellisenseSessionStackMapService intellisenseSessionStackMap,
ISmartIndentationService smartIndenterService,
IInteractiveEvaluator evaluator)
{
if (evaluator == null)
{
throw new ArgumentNullException(nameof(evaluator));
}
_dangerous_uiOnly = new UIThreadOnly(this, host);
this.Properties = new PropertyCollection();
_history = new History();
_intellisenseSessionStackMap = intellisenseSessionStackMap;
_smartIndenterService = smartIndenterService;
var textContentType = contentTypeRegistry.GetContentType("text");
var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);
_outputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
_standardInputBuffer = bufferFactory.CreateTextBuffer();
var projBuffer = projectionBufferFactory.CreateProjectionBuffer(
new EditResolver(this),
Array.Empty<object>(),
ProjectionBufferOptions.None,
replContentType);
// we need to set IReplPromptProvider property before TextViewHost is instantiated so that ReplPromptTaggerProvider can bind to it
projBuffer.Properties.AddProperty(typeof(InteractiveWindow), this);
_projectionBuffer = projBuffer;
_dangerous_uiOnly.AppendNewOutputProjectionBuffer(); // Constructor runs on UI thread.
projBuffer.Changed += new EventHandler<TextContentChangedEventArgs>(ProjectionBufferChanged);
var roleSet = editorFactory.CreateTextViewRoleSet(
PredefinedTextViewRoles.Analyzable,
PredefinedTextViewRoles.Editable,
PredefinedTextViewRoles.Interactive,
PredefinedTextViewRoles.Zoomable,
PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);
_textView = host.CreateTextView(this, projBuffer, roleSet);
_textView.Caret.PositionChanged += CaretPositionChanged;
_textView.Options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, false);
_textView.Options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
_textView.Options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
_textView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
_textView.Options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.WordWrap);
_lineBreakString = _textView.Options.GetNewLineCharacter();
_dangerous_uiOnly.EditorOperations = editorOperationsFactory.GetEditorOperations(_textView); // Constructor runs on UI thread.
_buffer = new OutputBuffer(this);
_outputWriter = new InteractiveWindowWriter(this, spans: null);
SortedSpans errorSpans = new SortedSpans();
_errorOutputWriter = new InteractiveWindowWriter(this, errorSpans);
OutputClassifierProvider.AttachToBuffer(_outputBuffer, errorSpans);
RequiresUIThread();
evaluator.CurrentWindow = this;
_evaluator = evaluator;
}
示例5: UIThreadOnly
public UIThreadOnly(
InteractiveWindow window,
IInteractiveWindowEditorFactoryService factory,
IContentTypeRegistryService contentTypeRegistry,
ITextBufferFactoryService bufferFactory,
IProjectionBufferFactoryService projectionBufferFactory,
IEditorOperationsFactoryService editorOperationsFactory,
ITextEditorFactoryService editorFactory,
IRtfBuilderService rtfBuilderService,
IIntellisenseSessionStackMapService intellisenseSessionStackMap,
ISmartIndentationService smartIndenterService,
IInteractiveEvaluator evaluator,
IWaitIndicator waitIndicator)
{
_window = window;
_factory = factory;
_rtfBuilderService = (IRtfBuilderService2)rtfBuilderService;
_intellisenseSessionStackMap = intellisenseSessionStackMap;
_smartIndenterService = smartIndenterService;
_waitIndicator = waitIndicator;
Evaluator = evaluator;
var replContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveContentTypeName);
var replOutputContentType = contentTypeRegistry.GetContentType(PredefinedInteractiveContentTypes.InteractiveOutputContentTypeName);
OutputBuffer = bufferFactory.CreateTextBuffer(replOutputContentType);
StandardInputBuffer = bufferFactory.CreateTextBuffer();
_inertType = bufferFactory.InertContentType;
_projectionBuffer = projectionBufferFactory.CreateProjectionBuffer(
new EditResolver(window),
Array.Empty<object>(),
ProjectionBufferOptions.None,
replContentType);
_projectionBuffer.Properties.AddProperty(typeof(InteractiveWindow), window);
AppendNewOutputProjectionBuffer();
_projectionBuffer.Changed += new EventHandler<TextContentChangedEventArgs>(ProjectionBufferChanged);
var roleSet = editorFactory.CreateTextViewRoleSet(
PredefinedTextViewRoles.Analyzable,
PredefinedTextViewRoles.Editable,
PredefinedTextViewRoles.Interactive,
PredefinedTextViewRoles.Zoomable,
PredefinedInteractiveTextViewRoles.InteractiveTextViewRole);
TextView = factory.CreateTextView(window, _projectionBuffer, roleSet);
TextView.Caret.PositionChanged += CaretPositionChanged;
var options = TextView.Options;
options.SetOptionValue(DefaultTextViewHostOptions.HorizontalScrollBarId, true);
options.SetOptionValue(DefaultTextViewHostOptions.LineNumberMarginId, false);
options.SetOptionValue(DefaultTextViewHostOptions.OutliningMarginId, false);
options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, false);
options.SetOptionValue(DefaultTextViewOptions.WordWrapStyleId, WordWrapStyles.None);
_lineBreakString = options.GetNewLineCharacter();
EditorOperations = editorOperationsFactory.GetEditorOperations(TextView);
_buffer = new OutputBuffer(window);
OutputWriter = new InteractiveWindowWriter(window, spans: null);
SortedSpans errorSpans = new SortedSpans();
ErrorOutputWriter = new InteractiveWindowWriter(window, errorSpans);
OutputClassifierProvider.AttachToBuffer(OutputBuffer, errorSpans);
}