public void VsTextViewCreated(IVsTextView textViewAdapter) { IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter); view.TextBuffer.Properties.GetOrCreateSingletonProperty(() => view); _errorList = view.TextBuffer.Properties.GetOrCreateSingletonProperty(() => new ErrorListProvider(ServiceProvider)); if (_errorList == null) return; if (ExtensibilityToolsPackage.Options.PkgdefShowIntellisense) { PkgdefCompletionController completion = new PkgdefCompletionController(view, CompletionBroker); IOleCommandTarget completionNext; textViewAdapter.AddCommandFilter(completion, out completionNext); completion.Next = completionNext; } PkgdefFormatter formatter = new PkgdefFormatter(view); IOleCommandTarget formatterNext; textViewAdapter.AddCommandFilter(formatter, out formatterNext); formatter.Next = formatterNext; view.Closed += OnViewClosed; }
public VsInteractiveWindowCommandFilter(IVsEditorAdaptersFactoryService adapterFactory, IInteractiveWindow window, IVsTextView textViewAdapter, IVsTextBuffer bufferAdapter, IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders, IContentTypeRegistryService contentTypeRegistry) { _window = window; _oleCommandTargetProviders = oleCommandTargetProviders; _contentTypeRegistry = contentTypeRegistry; this.textViewAdapter = textViewAdapter; // make us a code window so we'll have the same colors as a normal code window. IVsTextEditorPropertyContainer propContainer; ErrorHandler.ThrowOnFailure(((IVsTextEditorPropertyCategoryContainer)textViewAdapter).GetPropertyCategory(Microsoft.VisualStudio.Editor.DefGuidList.guidEditPropCategoryViewMasterSettings, out propContainer)); propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewComposite_AllCodeWindowDefaults, true); propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewGlobalOpt_AutoScrollCaretOnTextEntry, true); // editor services are initialized in textViewAdapter.Initialize - hook underneath them: _preEditorCommandFilter = new CommandFilter(this, CommandFilterLayer.PreEditor); ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preEditorCommandFilter, out _editorCommandFilter)); textViewAdapter.Initialize( (IVsTextLines)bufferAdapter, IntPtr.Zero, (uint)TextViewInitFlags.VIF_HSCROLL | (uint)TextViewInitFlags.VIF_VSCROLL | (uint)TextViewInitFlags3.VIF_NO_HWND_SUPPORT, new[] { new INITVIEW { fSelectionMargin = 0, fWidgetMargin = 0, fVirtualSpace = 0, fDragDropMove = 1 } }); // disable change tracking because everything will be changed var textViewHost = adapterFactory.GetWpfTextViewHost(textViewAdapter); _preLanguageCommandFilter = new CommandFilter(this, CommandFilterLayer.PreLanguage); ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preLanguageCommandFilter, out _editorServicesCommandFilter)); _textViewHost = textViewHost; }
internal TypeCharFilter(IVsTextView adapter, ITextView textView, TypingSpeedMeter adornment) { this.textView = textView; this.adornment = adornment; adapter.AddCommandFilter(this, out nextCommandHandler); }
internal void AttachKeyboardFilter(IVsTextView vsTextView) { if (_next == null) { ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next)); } }
protected OleCommandFilter(IVsTextView vsTextView) { IOleCommandTarget oldChain; ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out oldChain)); OldChain = oldChain; }
public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document) { textViewAdapter.AddCommandFilter(this, out _nextCommandTarget); _view = view; _dte = dte; _document = document; }
internal CompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, CompletionHandlerProvider provider) { this.txtView = textView; this.handlerProvider = provider; textViewAdapter.AddCommandFilter(this, out nextCommandHandler); }
public void VsTextViewCreated(IVsTextView textViewAdapter) { var commandFilter = new EditorCommandFilter(serviceProvider: this.serviceProvider); IOleCommandTarget nextTarget; ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(commandFilter, out nextTarget)); commandFilter.NextCommandTarget = nextTarget; }
public async void VsTextViewCreated(IVsTextView textViewAdapter) { IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter); Debug.Assert(view != null); int tries = 0; // Ugly ugly hack // Keep trying to register our filter until after the JSLS CommandFilter // is added so we can catch completion before JSLS swallows all of them. // To confirm this, click Debug, New Breakpoint, Break at Function, type // Microsoft.VisualStudio.JSLS.TextView.TextView.CreateCommandFilter, // then make sure that our last filter is added after that runs. JsCommandFilter filter = new JsCommandFilter(view, CompletionBroker, _standardClassifications); while (true) { IOleCommandTarget next; textViewAdapter.AddCommandFilter(filter, out next); filter.Next = next; if (IsJSLSInstalled(next) || ++tries > 10) return; await Task.Delay(500); textViewAdapter.RemoveCommandFilter(filter); // Remove the too-early filter and try again. } }
public ShaderlabCompletionCommandHandlder(IVsTextView textViewAdapter, ITextView textView, ShaderlabCompletionHandlerPrvider handlerProvider) { this.textView = textView; this.completionHandlerProvider = handlerProvider; textViewAdapter.AddCommandFilter(this, out nextCommandHandler); }
public PasteCommandHandler(IVsTextView adapter, ITextView textView, DTE2 dte) { _textView = textView; _dte = dte; adapter.AddCommandFilter(this, out _nextCommandTarget); this.package = package; }
public static void Register(IVsTextView interopTextView, IWpfTextView textView, Services services) { var dispatcher = new StandardCommandDispatcher(); dispatcher._textView = textView; dispatcher._services = services; interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain); }
public CommandTargetBase(IVsTextView adapter, IWpfTextView textView, Guid commandGroup, params uint[] commandIds) { this.CommandGroup = commandGroup; this.CommandIds = commandIds; this.TextView = textView; adapter.AddCommandFilter(this, out _nextCommandTarget); }
internal CommandFilter(IVsTextView textViewAdapter, IWpfTextView textView) { recorder = new Recorder(); listening = false; this.textView = textView; textViewAdapter.AddCommandFilter(this, out nextFilter); // trying to get document path from TextBuffer ITextBuffer buffer = this.textView.TextBuffer; ITextDocument document; var result = buffer.Properties.TryGetProperty<ITextDocument>( typeof(ITextDocument), out document); if (result) { string documentFullPath = document.FilePath; recordFullPath = documentFullPath + ".rec"; } else { // TODO: save to some folder recordFullPath = "document.rec"; } // subscribe to RecorderControl event RecorderControl.RecordStateChanged += new EventHandler<RecordStateChangedArgs>(OnRecordStateChanged); }
internal VsKeyProcessorAdditional(VsHost host, IVsTextView view, System.IServiceProvider provider) { _host = host; _textView = view; _serviceProvider = provider; var hr = view.AddCommandFilter(this, out _nextTarget); }
internal VsCommandFilter(IVimBuffer buffer, IVsTextView view, IServiceProvider provider) { _buffer = buffer; _textView = view; _serviceProvider = provider; var hr = view.AddCommandFilter(this, out _nextTarget); }
//, ISignatureHelpBroker broker) internal CompletionController(IVsTextView textViewAdapter, ITextView textView, CompletionControllerProvider provider) { this.textView = textView; this.provider = provider; //this.broker = broker; textViewAdapter.AddCommandFilter(this, out nextCommandHandler); }
public CompletionHandler(IVsTextView TextViewAdapter, ITextView TextView, CompletionHandlerProvider Provider) { this.TextView = TextView; this.Provider = Provider; //add the command to the command chain TextViewAdapter.AddCommandFilter(this, out NextHandler); }
internal NitraCompletionCommandHandler(IVsTextView textViewAdapter, IWpfTextView textView, NitraCompletionHandlerProvider provider) { _wpfTextView = textView; _provider = provider; //add the command to the command chain textViewAdapter.AddCommandFilter(this, out _nextTarget); }
//ICompletionSession m_session; internal TestCompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, ICompletionBroker broker) { this.m_textView = textView; this.m_broker = broker; //add the command to the command chain textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler); }
public Visual64TassCommandTarget(IWpfTextView wpfTextView, IVsTextView textViewAdapter) { Contract.Requires(wpfTextView != null); Contract.Requires(textViewAdapter != null); this.wpfTextView = wpfTextView; textViewAdapter.AddCommandFilter(this, out this.nextCommandTarget); }
public void VsTextViewCreated(IVsTextView textViewAdapter) { var filter = new MacroCommandFilter(); IOleCommandTarget next; if (ErrorHandler.Succeeded(textViewAdapter.AddCommandFilter(filter, out next))) filter.Next = next; }
internal CompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, CompletionHandlerProvider provider) { this.m_textView = textView; this.m_provider = provider; //add the command to the command chain textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler); }
public ViewFilter(LanguageService service, Source source, IVsTextView view) { this.service = service; this.source = source; this.textView = view; view.AddCommandFilter(this, out nextTarget); this.IID_IVsTextViewEvents = typeof(IVsTextViewEvents).GUID; this.cookie = VsShell.Connect(view, this, ref IID_IVsTextViewEvents); }
public void VsTextViewCreated(IVsTextView textViewAdapter) { CommandFilter filter = new CommandFilter(_dte, textViewAdapter, AdaptersFactory); IOleCommandTarget next; if (ErrorHandler.Succeeded(textViewAdapter.AddCommandFilter(filter, out next))) filter.Next = next; }
public void VsTextViewCreated(IVsTextView textViewAdapter) { $safeitemname$ filter = new $safeitemname$(); IOleCommandTarget next; if (ErrorHandler.Succeeded(textViewAdapter.AddCommandFilter(filter, out next))) filter.Next = next; }
public XamlCompletionHandler(IVsTextView textViewAdapter, ITextView textView, TextViewListener listener) { this.textView = textView; this.listener = listener; //add the command to the command chain textViewAdapter.AddCommandFilter(this, out nextCommandHandler); }
public CompletionHandler(IVsTextView textViewAdapter, ITextView textView, CompletionHandlerProvider provider) { this.textView = textView; this.provider = provider; //add the command to the command chain textViewAdapter.AddCommandFilter(this, out nextHandler); }
private TemplateCompletionHandler CreateHandler(IVsTextView viewAdapter, IWpfTextView textView) { var handler = new TemplateCompletionHandler(); handler.TextView = textView; handler.ServiceProvider = this.serviceProvider; handler.CompletionBroker = this.completionBroker; ErrorHandler.ThrowOnFailure(viewAdapter.AddCommandFilter(handler, out handler.NextHandler)); return handler; }
public void VsTextViewCreated(IVsTextView textViewAdapter) { var view = AdaptersFactory.GetWpfTextView(textViewAdapter); var watcher = new ScriptCompletionWatcher(view, CompletionBroker); IOleCommandTarget nextCmdTarget; textViewAdapter.AddCommandFilter(watcher, out nextCmdTarget); watcher.NextCmdTarget = nextCmdTarget; }
public void VsTextViewCreated(IVsTextView textViewAdapter) { var textView = editorAdaptersFactory.GetWpfTextView(textViewAdapter); var operations = editorOperationsFactory.GetEditorOperations(textView); var navigator = textStructureNavigatorFacrtory.GetTextStructureNavigator(textView.TextBuffer); if (textView == null) { Debug.Fail("Unable to get IWpfTextView from text view adapter."); return; } var commandFilter = new SubwordNavigationCommandFilter(textView, operations, navigator); var hr = textViewAdapter.AddCommandFilter(commandFilter, out IOleCommandTarget next); if (ErrorHandler.Succeeded(hr)) { commandFilter.Next = next; } }
private static void AddCommandFilter(IVsTextView viewAdapter, KeyFilter commandFilter) { if (commandFilter.Added) { return; } //get the view adapter from the editor factory IOleCommandTarget next; var hr = viewAdapter.AddCommandFilter(commandFilter, out next); if (hr != VSConstants.S_OK) { return; } commandFilter.Added = true; //you'll need the next target for Exec and QueryStatus if (next != null) { commandFilter.NextTarget = next; } }
void AddCommandFilter(IWpfTextView textView, KeyBindingCommandFilter commandFilter) { if (commandFilter.m_added == false) { //get the view adapter from the editor factory IOleCommandTarget next; IVsTextView view = editorFactory.GetViewAdapter(textView); int hr = view.AddCommandFilter(commandFilter, out next); if (hr == VSConstants.S_OK) { commandFilter.m_added = true; //you'll need the next target for Exec and QueryStatus if (next != null) { commandFilter.m_nextTarget = next; } } } }
private EditFilter( IVsTextView vsTextView, ITextView textView, IEditorOperations editorOps, IServiceProvider serviceProvider, IOleCommandTarget next ) { _vsTextView = vsTextView; _textView = textView; _editorOps = editorOps; _serviceProvider = serviceProvider; _componentModel = _serviceProvider.GetComponentModel(); _pyService = _serviceProvider.GetPythonToolsService(); _next = next; BraceMatcher.WatchBraceHighlights(textView, _componentModel); if (_next == null) { ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next)); } }
//===================================================================== /// <inheritdoc /> public void VsTextViewCreated(IVsTextView textViewAdapter) { var options = new MefProviderOptions(ServiceProvider); if (options.EnableGoToDefinition) { var textView = editorAdaptersFactoryService.GetWpfTextView(textViewAdapter); if (textView != null) { var filter = new GoToDefinitionCommandTarget(textView, this, !textView.TextBuffer.ContentType.IsOfType("xml")); if (ErrorHandler.Succeeded(textViewAdapter.AddCommandFilter(filter, out IOleCommandTarget nextTarget))) { filter.NextTarget = nextTarget; textView.Properties.GetOrCreateSingletonProperty(() => filter); } } } }
public void VsTextViewCreated(IVsTextView textViewAdapter) { IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter); view.TextBuffer.Properties.GetOrCreateSingletonProperty(() => view); _errorList = view.TextBuffer.Properties.GetOrCreateSingletonProperty(() => new ErrorListProvider(ServiceProvider)); if (_errorList == null) { return; } CommandFilter filter = new CommandFilter(view, CompletionBroker); IOleCommandTarget next; textViewAdapter.AddCommandFilter(filter, out next); filter.Next = next; view.Closed += OnViewClosed; }
//===================================================================== /// <summary> /// This connects our command filter to the text view adapter /// </summary> /// <param name="textViewAdapter">The text view adapter to use</param> public void VsTextViewCreated(IVsTextView textViewAdapter) { HtmlEncodingCommandTarget filter; IOleCommandTarget nextTarget; var wpfTextView = adaptersFactory.GetWpfTextView(textViewAdapter); if (wpfTextView == null) { Debug.Fail("Unable to get IWpfTextView from text view adapter"); return; } filter = new HtmlEncodingCommandTarget(wpfTextView); if (ErrorHandler.Succeeded(textViewAdapter.AddCommandFilter(filter, out nextTarget))) { filter.NextTarget = nextTarget; wpfTextView.Properties.GetOrCreateSingletonProperty(() => filter); } }
public CommandFilter(TrackState state, ITextView textView, IVsTextView textViewAdapter, IEditorOperations operations, SVsServiceProvider service, ICompletionBroker broker) { ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(this, out _nextCommandTarget)); if (DTE == null) { DTE = service.GetService(typeof(DTE)) as DTE2; } _state = state; TextView = textView; Operations = operations; Broker = broker; Service = service; textView.Caret.PositionChanged += (s, e) => { _state._justCompletedFunc = false; if (_state._justCompletedAutoBrace && !_state._justCompletedAutoBraceTrack.GetSpan(e.NewPosition.BufferPosition.Snapshot).Contains(e.NewPosition.BufferPosition)) { string txt = _state._justCompletedAutoBraceTrack.GetSpan(e.NewPosition.BufferPosition.Snapshot).GetText(); _state._justCompletedAutoBrace = false; _state._justCompletedAutoBraceTrack = null; } }; textView.TextBuffer.Changed += (s, e) => { _state._justCompletedFunc = false; _state._justCompletedAutoBrace = false; if (_state._justCompletedWordVer != null && e.AfterVersion != _state._justCompletedWordVer) { _state._justCompletedFunc = true; } _state._justCompletedWordVer = null; }; }
public CommandFilter( IVsTextView textView, IWpfTextView wpfTextView, IHtmlBuilderService htmlBuilderService, IRtfBuilderService rtfBuilderService, IEditorOperations editorOperations, ITextUndoHistory undoHistory, IEditorOptions editorOptions, IViewPrimitives viewPrimitives, ITelemetrySession telemetrySession) { _htmlBuilderService = htmlBuilderService; _rtfBuilderService = rtfBuilderService; _undoHistory = undoHistory; _textView = wpfTextView; _editorOperations = editorOperations; _editorOptions = editorOptions; _viewPrimitives = viewPrimitives; _telemetrySession = telemetrySession; textView.AddCommandFilter(this, out _nextCommandTargetInChain); }
/// <summary> /// Constructor. /// </summary> /// <param name="textViewAdapter">The <see cref="IVsTextView"/>.</param> /// <param name="textView">The <see cref="ITextView"/>.</param> /// <param name="dte">The <see cref="DTE"/>.</param> /// <param name="provider">The <see cref="XmlCommentCompletionCommandHandlerProvider"/>.</param> public XmlCommentCompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, DTE dte, XmlCommentCompletionCommandHandlerProvider provider) { // Check if the arguments are valid if (textViewAdapter == null || textView == null || dte == null || provider == null) { return; } // Initialize this.textView = textView; this.provider = provider; this.dte = dte; // Add to command chain and get the next command handler try { textViewAdapter.AddCommandFilter(this, out this.nextCommandHandler); } catch (Exception) { } }
public AdapterCommand(IVsTextView adapter, System.IServiceProvider provider, Guid menuGroup, uint cmdID, Action commandEvent, Func <bool> queryEvent = null) { this.provider = provider; this.menuGroup = menuGroup; this.cmdID = cmdID; this.commandEvent = commandEvent; this.queryEvent = queryEvent ?? (() => true); var mcs = provider.GetService(typeof(IMenuCommandService)) as IMenuCommandService; if (mcs != null) { mcs.AddCommand(menuGroup, (int)cmdID, commandEvent, cmd => { cmd.Visible = cmd.Enabled = this.queryEvent(); }); } Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => { ErrorHandler.ThrowOnFailure(adapter.AddCommandFilter(this, out nextCommandTarget)); }), DispatcherPriority.ApplicationIdle, null); }
private void AddCommandFilter(IWpfTextView textView, NextOcurrenceCommandFilter commandFilter) { // Se ainda não foi adicionado if (commandFilter.IsAdded == false) { IOleCommandTarget next; IVsTextView view = editorFactory.GetViewAdapter(textView); int hr = view.AddCommandFilter(commandFilter, out next); if (hr == VSConstants.S_OK) { commandFilter.IsAdded = true; textView.Properties.AddProperty(typeof(NextOcurrenceCommandFilter), commandFilter); if (next != null) { commandFilter._nextTarget = next; } } } }
public void VsTextViewCreated(IVsTextView textViewAdapter) { IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter); Debug.WriteLineIf(view != null, "No WPF editor view found"); if (view == null) { return; } var languageService = GherkinLanguageServiceFactory.GetLanguageService(view.TextBuffer); var editorContext = new GherkinEditorContext(languageService, view); var editorCommandFilter = ContainerProvider.ObjectContainer.Resolve <EditorCommandFilter>(); var commandFilter = new EditorCommandFilterInstance(editorCommandFilter, editorContext); IOleCommandTarget next; textViewAdapter.AddCommandFilter(commandFilter, out next); commandFilter.Next = next; }
public void VsTextViewCreated(IVsTextView textViewAdapter) { IWpfTextView textView = _editorFactory.GetWpfTextView(textViewAdapter); if (textView == null) { return; } if (_telemetrySession == null) { _telemetrySession = TelemetrySessionForPPT.Create(this.GetType().Assembly); } IOleCommandTarget next; var commandFilter = new CommandFilter(textView, _peekBroker, _telemetrySession); int hr = textViewAdapter.AddCommandFilter(commandFilter, out next); if (next != null) { commandFilter.Next = next; } }
public void Attach(IVsTextView textViewAdapter) { if (!ApplyToView(textViewAdapter)) { return; } if (_textViewAdapter != null) { throw new InvalidOperationException("ViewHandler instance is already attached to a view. Create a new instance?"); } _textViewAdapter = textViewAdapter; _textView = _adaptersFactoryService.GetWpfTextView(textViewAdapter); var target = new SimpleCommandTarget( new CommandID(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.ECMD_LEFTCLICK), Execute, HandlesCommand, () => true); var targetWrapper = new OleCommandTarget("NugetConsoleViewHandler", target); _textViewAdapter.AddCommandFilter(targetWrapper, out targetWrapper.NextCommandTarget); }
public void VsTextViewCreated(IVsTextView textViewAdapter) { if (!IntegrationOptionsProvider.GetOptions().EnableIntelliSense) { return; } IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter); Debug.WriteLineIf(view != null, "No WPF editor view found"); if (view == null) { return; } var languageService = GherkinLanguageServiceFactory.GetLanguageService(view.TextBuffer); var commandFilter = new GherkinCompletionCommandFilter(view, CompletionBroker, languageService, Tracer); IOleCommandTarget next; textViewAdapter.AddCommandFilter(commandFilter, out next); commandFilter.Next = next; }
int IVsImmediateStatementCompletion2.InstallStatementCompletion(int install, IVsTextView textView, int initialEnable) { // We'll install a filter whenever the debugger asks, but it won't do anything but call // the next filter until the context is set. To ensure that we correctly install and // uninstall from the many possible textviews we can work on, we maintain a dictionary // of textview->filters. if (install != 0) { DebuggerIntelliSenseFilter <TPackage, TLanguageService, TProject> filter; if (this.filters.ContainsKey(textView)) { // We already have a filter in this textview. Return. return(VSConstants.S_OK); } else { filter = new DebuggerIntelliSenseFilter <TPackage, TLanguageService, TProject>(this, this.EditorAdaptersFactoryService.GetWpfTextView(textView), this.Package.ComponentModel.GetService <IVsEditorAdaptersFactoryService>(), this.Package.ComponentModel.GetService <ICommandHandlerServiceFactory>()); this.filters[textView] = filter; IOleCommandTarget nextFilter; Marshal.ThrowExceptionForHR(textView.AddCommandFilter(filter, out nextFilter)); filter.SetNextFilter(nextFilter); } } else { Marshal.ThrowExceptionForHR(textView.RemoveCommandFilter(this.filters[textView])); this.filters[textView].Dispose(); this.filters.Remove(textView); } return(VSConstants.S_OK); }
public PasteCommandHandler(IVsTextView adapter, ITextView textView, DTE2 dte) { _textView = textView; _dte = dte; adapter.AddCommandFilter(this, out _nextCommandTarget); }
private void AddCommandFilter(IVsTextView textViewAdapter, BaseCommand command) { textViewAdapter.AddCommandFilter(command, out var next); command.Next = next; }
public void AddFilter() { vsTextView.AddCommandFilter(this, out nextCommandHandler); }
public JavaCommandHandler(IVsTextView textViewAdapter, ITextView textView, JavaCommandHandlerProvider provider) { TextView = textView; Provider = provider; textViewAdapter.AddCommandFilter(this, out NextCmdHandler); }
public ArrowsCommandTarget(IVsTextView adapter, ITextView textView) { this._textView = textView; ErrorHandler.ThrowOnFailure(adapter.AddCommandFilter(this, out _nextCommandTarget)); }
public AutoCompletionHandler(IVsTextView textView, IWpfTextView wpfTextView, AutoCompletionHandlerProvider autoCompletionHandlerProvider) { this.autoCompletionHandlerProvider = autoCompletionHandlerProvider; this.wpfTextView = wpfTextView; textView.AddCommandFilter(this, out nextCommandTarget); }
/// <summary> /// Function called when the window frame is set on this tool window. /// </summary> public override void OnToolWindowCreated() { // Call the base class's implementation. base.OnToolWindowCreated(); // Register this object as command filter for the text view so that it will // be possible to intercept some command. IOleCommandTarget originalFilter; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure( textView.AddCommandFilter((IOleCommandTarget)this, out originalFilter)); // Create a command service that will use the previous command target // as parent target and will route to it the commands that it can not handle. if (null == originalFilter) { commandService = new OleMenuCommandService(this); } else { commandService = new OleMenuCommandService(this, originalFilter); } // Add the command handler for RETURN. CommandID id = new CommandID( typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd2KCmdID.RETURN); OleMenuCommand cmd = new OleMenuCommand(new EventHandler(OnReturn), id); cmd.BeforeQueryStatus += new EventHandler(UnsupportedOnCompletion); commandService.AddCommand(cmd); // Command handler for UP and DOWN arrows. These commands are needed to implement // the history in the console, but at the moment the implementation is empty. id = new CommandID(typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd2KCmdID.UP); cmd = new OleMenuCommand(new EventHandler(OnHistory), id); cmd.BeforeQueryStatus += new EventHandler(SupportCommandOnInputPosition); commandService.AddCommand(cmd); id = new CommandID(typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd2KCmdID.DOWN); cmd = new OleMenuCommand(new EventHandler(OnHistory), id); cmd.BeforeQueryStatus += new EventHandler(SupportCommandOnInputPosition); commandService.AddCommand(cmd); // Command handler for the LEFT arrow. This command handler is needed in order to // avoid that the user uses the left arrow to move to the previous line or over the // command prompt. id = new CommandID(typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd2KCmdID.LEFT); cmd = new OleMenuCommand(new EventHandler(OnNoAction), id); cmd.BeforeQueryStatus += new EventHandler(OnBeforeMoveLeft); commandService.AddCommand(cmd); // Handle also the HOME command. id = new CommandID(typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd2KCmdID.BOL); cmd = new OleMenuCommand(new EventHandler(OnHome), id); commandService.AddCommand(cmd); id = new CommandID(typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd2KCmdID.BOL_EXT); cmd = new OleMenuCommand(new EventHandler(OnShiftHome), id); cmd.BeforeQueryStatus += new EventHandler(SupportCommandOnInputPosition); commandService.AddCommand(cmd); // Adding support for "Clear Pane" command. id = new CommandID(typeof(Microsoft.VisualStudio.VSConstants.VSStd97CmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd97CmdID.ClearPane); cmd = new OleMenuCommand(new EventHandler(OnClearPane), id); commandService.AddCommand(cmd); // Add a command handler for the context menu. id = new CommandID(typeof(Microsoft.VisualStudio.VSConstants.VSStd2KCmdID).GUID, (int)Microsoft.VisualStudio.VSConstants.VSStd2KCmdID.SHOWCONTEXTMENU); cmd = new OleMenuCommand(new EventHandler(ShowContextMenu), id); commandService.AddCommand(cmd); // Now we set the key binding for this frame to the same value as the text editor // so that there will be the same mapping for the commands. Guid commandUiGuid = VSConstants.GUID_TextEditorFactory; ((IVsWindowFrame)Frame).SetGuidProperty((int)__VSFPROPID.VSFPROPID_InheritKeyBindings, ref commandUiGuid); }
public CommandExceptionFilter(IVsTextView adapter, ITextView textView, ITextUndoHistoryRegistry undoRegistry) { ErrorHandler.ThrowOnFailure(adapter.AddCommandFilter(this, out _nextCommandTarget)); _textView = textView; _undoRegistry = undoRegistry; }
private void ChainTheNextCommand(IVsTextView textViewAdapter) { textViewAdapter.AddCommandFilter(this, out _nextCommand); }
public RetriggerTarget(IVsTextView adapter, ITextView textView, ICompletionBroker broker) { _textView = textView; _broker = broker; adapter.AddCommandFilter(this, out _nextCommandTarget); }
public FormattingController(IVsTextView textViewAdapter, ITextView textView) { this.textView = textView; textViewAdapter.AddCommandFilter(this, out nextCommandHandler); }
public CompletionController(IVsTextView adapter, ITextView textView, ICompletionBroker broker) { _textView = textView; _broker = broker; ErrorHandler.ThrowOnFailure(adapter.AddCommandFilter(this, out _nextCommandTarget)); }