本文整理汇总了C#中IEditorOperationsFactoryService.GetEditorOperations方法的典型用法代码示例。如果您正苦于以下问题:C# IEditorOperationsFactoryService.GetEditorOperations方法的具体用法?C# IEditorOperationsFactoryService.GetEditorOperations怎么用?C# IEditorOperationsFactoryService.GetEditorOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditorOperationsFactoryService
的用法示例。
在下文中一共展示了IEditorOperationsFactoryService.GetEditorOperations方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OutputBufferVM
public OutputBufferVM(IEditorOperationsFactoryService editorOperationsFactoryService, Guid guid, string name, ILogEditor logEditor) {
editorOperations = editorOperationsFactoryService.GetEditorOperations(logEditor.TextView);
Guid = guid;
Name = name;
this.logEditor = logEditor;
index = -1;
needTimestamp = true;
}
示例2: IncrementalSearch
public IncrementalSearch(ITextView textView, ITextSearchService textSearchService, IEditorOperationsFactoryService editorOperationsFactoryService) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
if (textSearchService == null)
throw new ArgumentNullException(nameof(textSearchService));
if (editorOperationsFactoryService == null)
throw new ArgumentNullException(nameof(editorOperationsFactoryService));
TextView = textView;
this.textSearchService = textSearchService;
editorOperations = editorOperationsFactoryService.GetEditorOperations(textView);
SearchString = string.Empty;
}
示例3: BraceCompletionSession
public BraceCompletionSession(
ITextView textView, ITextBuffer subjectBuffer,
SnapshotPoint openingPoint, char openingBrace, char closingBrace, ITextUndoHistory undoHistory,
IEditorOperationsFactoryService editorOperationsFactoryService, IEditorBraceCompletionSession session)
{
this.TextView = textView;
this.SubjectBuffer = subjectBuffer;
this.OpeningBrace = openingBrace;
this.ClosingBrace = closingBrace;
this.ClosingPoint = SubjectBuffer.CurrentSnapshot.CreateTrackingPoint(openingPoint.Position, PointTrackingMode.Positive);
_undoHistory = undoHistory;
_editorOperations = editorOperationsFactoryService.GetEditorOperations(textView);
_session = session;
}
示例4: CaretPreservingEditTransaction
public CaretPreservingEditTransaction(
string description,
ITextView textView,
ITextUndoHistoryRegistry undoHistoryRegistry,
IEditorOperationsFactoryService editorOperationsFactoryService)
{
_editorOperations = editorOperationsFactoryService.GetEditorOperations(textView);
_undoHistory = undoHistoryRegistry.GetHistory(textView.TextBuffer);
_active = true;
if (_undoHistory != null)
{
_transaction = new HACK_TextUndoTransactionThatRollsBackProperly(_undoHistory.CreateTransaction(description));
_editorOperations.AddBeforeTextBufferChangePrimitive();
}
}
示例5: 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;
}
示例6: VsSimulation
internal VsSimulation(IVimBufferCoordinator bufferCoordinator, bool simulateResharper, bool simulateStandardKeyMappings, IEditorOperationsFactoryService editorOperationsFactoryService)
{
_wpfTextView = (IWpfTextView)bufferCoordinator.VimBuffer.TextView;
_factory = new MockRepository(MockBehavior.Strict);
_defaultKeyboardDevice = new DefaultKeyboardDevice(InputManager.Current);
_testableSynchronizationContext = new TestableSynchronizationContext();
// Create the IVsAdapter and pick reasonable defaults here. Consumers can modify
// this via an exposed property
_vsAdapter = _factory.Create<IVsAdapter>();
_vsAdapter.SetupGet(x => x.InAutomationFunction).Returns(false);
_vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(_defaultKeyboardDevice);
_vsAdapter.Setup(x => x.IsReadOnly(It.IsAny<ITextBuffer>())).Returns(false);
_vsAdapter.Setup(x => x.IsIncrementalSearchActive(_wpfTextView)).Returns(false);
_resharperUtil = _factory.Create<IResharperUtil>();
_resharperUtil.SetupGet(x => x.IsInstalled).Returns(simulateResharper);
_displayWindowBroker = _factory.Create<IDisplayWindowBroker>();
_displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
_displayWindowBroker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
_displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
_displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);
_defaultCommandTarget = new DefaultCommandTarget(
bufferCoordinator.VimBuffer.TextView,
editorOperationsFactoryService.GetEditorOperations(bufferCoordinator.VimBuffer.TextView));
// Visual Studio hides the default IOleCommandTarget inside of the IWpfTextView property
// bag. The default KeyProcessor implementation looks here for IOleCommandTarget to
// process text input
_wpfTextView.Properties[typeof(IOleCommandTarget)] = _defaultCommandTarget;
// Create the VsCommandTarget. It's next is the final and default Visual Studio
// command target
var vsTextView = _factory.Create<IVsTextView>();
IOleCommandTarget nextCommandTarget = _defaultCommandTarget;
vsTextView.Setup(x => x.AddCommandFilter(It.IsAny<IOleCommandTarget>(), out nextCommandTarget)).Returns(VSConstants.S_OK);
var vsCommandTarget = VsCommandTarget.Create(
bufferCoordinator,
vsTextView.Object,
_vsAdapter.Object,
_displayWindowBroker.Object,
_resharperUtil.Object).Value;
// Time to setup the start command target. If we are simulating R# then put them ahead of VsVim
// on the IOleCommandTarget chain. VsVim doesn't try to fight R# and prefers instead to be
// behind them
if (simulateResharper)
{
var resharperCommandTarget = new ResharperCommandTarget(_wpfTextView, vsCommandTarget);
_commandTarget = resharperCommandTarget;
}
else
{
_commandTarget = vsCommandTarget;
}
// Create the input controller. Make sure that the VsVim one is ahead in the list
// from the default Visual Studio one. We can guarantee this is true due to MEF
// ordering of the components
var keyProcessors = new List<Microsoft.VisualStudio.Text.Editor.KeyProcessor>();
keyProcessors.Add(new VsKeyProcessor(_vsAdapter.Object, bufferCoordinator));
keyProcessors.Add(new SimulationKeyProcessor(bufferCoordinator.VimBuffer.TextView));
_defaultInputController = new DefaultInputController(bufferCoordinator.VimBuffer.TextView, keyProcessors);
}
示例7: SearchService
public SearchService(IWpfTextView wpfTextView, ITextSearchService2 textSearchService2, ISearchSettings searchSettings, IMessageBoxService messageBoxService, ITextStructureNavigator textStructureNavigator, Lazy<IReplaceListenerProvider>[] replaceListenerProviders, IEditorOperationsFactoryService editorOperationsFactoryService) {
if (wpfTextView == null)
throw new ArgumentNullException(nameof(wpfTextView));
if (textSearchService2 == null)
throw new ArgumentNullException(nameof(textSearchService2));
if (searchSettings == null)
throw new ArgumentNullException(nameof(searchSettings));
if (messageBoxService == null)
throw new ArgumentNullException(nameof(messageBoxService));
if (textStructureNavigator == null)
throw new ArgumentNullException(nameof(textStructureNavigator));
if (replaceListenerProviders == null)
throw new ArgumentNullException(nameof(replaceListenerProviders));
this.wpfTextView = wpfTextView;
editorOperations = editorOperationsFactoryService.GetEditorOperations(wpfTextView);
this.textSearchService2 = textSearchService2;
this.searchSettings = searchSettings;
this.messageBoxService = messageBoxService;
this.textStructureNavigator = textStructureNavigator;
this.replaceListenerProviders = replaceListenerProviders;
listeners = new List<ITextMarkerListener>();
searchString = string.Empty;
replaceString = string.Empty;
searchKind = SearchKind.None;
searchControlPosition = SearchControlPosition.Default;
wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (s, e) => ShowFind()));
wpfTextView.VisualElement.CommandBindings.Add(new CommandBinding(ApplicationCommands.Replace, (s, e) => ShowReplace()));
wpfTextView.Closed += WpfTextView_Closed;
UseGlobalSettings(true);
}
示例8: 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);
}
示例9: VsSimulation
internal VsSimulation(IVimBufferCoordinator bufferCoordinator, bool simulateResharper, bool simulateStandardKeyMappings, IEditorOperationsFactoryService editorOperationsFactoryService, IKeyUtil keyUtil)
{
_keyUtil = keyUtil;
_wpfTextView = (IWpfTextView)bufferCoordinator.VimBuffer.TextView;
_factory = new MockRepository(MockBehavior.Strict);
_vsKeyboardInputSimulation = new VsKeyboardInputSimulation(this, _wpfTextView);
_testableSynchronizationContext = new TestableSynchronizationContext();
_simulateStandardKeyMappings = simulateStandardKeyMappings;
// Create the IVsAdapter and pick reasonable defaults here. Consumers can modify
// this via an exposed property
_vsAdapter = _factory.Create<IVsAdapter>();
_vsAdapter.SetupGet(x => x.InAutomationFunction).Returns(false);
_vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(_vsKeyboardInputSimulation.KeyBoardDevice);
_vsAdapter.Setup(x => x.IsReadOnly(It.IsAny<ITextBuffer>())).Returns(false);
_vsAdapter.Setup(x => x.IsReadOnly(It.IsAny<ITextView>())).Returns(false);
_vsAdapter.Setup(x => x.IsIncrementalSearchActive(_wpfTextView)).Returns(false);
_reportDesignerUtil = _factory.Create<IReportDesignerUtil>();
_reportDesignerUtil.Setup(x => x.IsExpressionView(_wpfTextView)).Returns(false);
_displayWindowBroker = _factory.Create<IDisplayWindowBroker>();
_displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
_displayWindowBroker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
_displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
_displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);
_vimApplicationSettings = _factory.Create<IVimApplicationSettings>();
_vimApplicationSettings.SetupGet(x => x.UseEditorDefaults).Returns(true);
_vimApplicationSettings.SetupGet(x => x.UseEditorIndent).Returns(true);
_vimApplicationSettings.SetupGet(x => x.UseEditorTabAndBackspace).Returns(true);
_vsSimulationCommandTarget = new SimulationCommandTarget(
bufferCoordinator.VimBuffer.TextView,
editorOperationsFactoryService.GetEditorOperations(bufferCoordinator.VimBuffer.TextView));
var textManager = _factory.Create<ITextManager>();
var commandTargets = new List<ICommandTarget>();
if (simulateResharper)
{
commandTargets.Add(ReSharperKeyUtil.GetOrCreate(bufferCoordinator));
}
commandTargets.Add(new StandardCommandTarget(bufferCoordinator, textManager.Object, _displayWindowBroker.Object, _vsSimulationCommandTarget));
// Create the VsCommandTarget. It's next is the final and default Visual Studio
// command target
_vsCommandTarget = new VsCommandTarget(
bufferCoordinator,
textManager.Object,
_vsAdapter.Object,
_displayWindowBroker.Object,
_keyUtil,
_vimApplicationSettings.Object,
_vsSimulationCommandTarget,
commandTargets.ToReadOnlyCollectionShallow());
// Time to setup the start command target. If we are simulating R# then put them ahead of VsVim
// on the IOleCommandTarget chain. VsVim doesn't try to fight R# and prefers instead to be
// behind them
if (simulateResharper)
{
_reSharperCommandTarget = new ReSharperCommandTargetSimulation(_wpfTextView, _vsCommandTarget);
_commandTarget = _reSharperCommandTarget;
}
else
{
_commandTarget = _vsCommandTarget;
}
// Visual Studio hides the default IOleCommandTarget inside of the IWpfTextView property
// bag. The default KeyProcessor implementation looks here for IOleCommandTarget to
// process text input.
//
// This should always point to the head of the IOleCommandTarget chain. In the implementation
// it actually points to the IVsTextView implementation which then immediately routes to the
// IOleCommandTarget head
_wpfTextView.Properties[typeof(IOleCommandTarget)] = _commandTarget;
// Create the input controller. Make sure that the VsVim one is ahead in the list
// from the default Visual Studio one. We can guarantee this is true due to MEF
// ordering of the components
if (simulateResharper)
{
_vsKeyboardInputSimulation.KeyProcessors.Add(ReSharperKeyUtil.GetOrCreate(bufferCoordinator));
}
_vsKeyboardInputSimulation.KeyProcessors.Add(new VsVimKeyProcessor(_vsAdapter.Object, bufferCoordinator, _keyUtil, _reportDesignerUtil.Object));
_vsKeyboardInputSimulation.KeyProcessors.Add((KeyProcessor)bufferCoordinator);
_vsKeyboardInputSimulation.KeyProcessors.Add(new SimulationKeyProcessor(bufferCoordinator.VimBuffer.TextView));
}
示例10: DefaultTextViewMouseProcessor
public DefaultTextViewMouseProcessor(IWpfTextView wpfTextView, IEditorOperationsFactoryService editorOperationsFactoryService) {
if (wpfTextView == null)
throw new ArgumentNullException(nameof(wpfTextView));
this.wpfTextView = wpfTextView;
editorOperations = editorOperationsFactoryService.GetEditorOperations(wpfTextView);
}
示例11: DefaultTextViewCommandTarget
public DefaultTextViewCommandTarget(ITextView textView, IEditorOperationsFactoryService editorOperationsFactoryService) {
if (textView == null)
throw new ArgumentNullException(nameof(textView));
this.textView = textView;
EditorOperations = editorOperationsFactoryService.GetEditorOperations(textView);
}
示例12: ReplEditorOperations
public ReplEditorOperations(IReplEditor2 replEditor, IWpfTextView wpfTextView, IEditorOperationsFactoryService editorOperationsFactoryService) {
this.replEditor = replEditor;
this.wpfTextView = wpfTextView;
EditorOperations = editorOperationsFactoryService.GetEditorOperations(wpfTextView);
}