private IVsDropdownBarClient CreateDropdownBarClient() { var componentModel = ServiceProvider.GetComponentModel(); var editorAdaptersFactory = componentModel.DefaultExportProvider.GetExportedValueOrDefault <IVsEditorAdaptersFactoryService>(); var bufferGraphFactoryService = componentModel.DefaultExportProvider.GetExportedValue <IBufferGraphFactoryService>(); var textView = editorAdaptersFactory.GetWpfTextView(CodeWindow.GetPrimaryView()); var editorNavigationSourceProvider = componentModel.DefaultExportProvider.GetExportedValueOrDefault <EditorNavigationSourceProvider>(); var editorNavigationSource = editorNavigationSourceProvider.TryCreateEditorNavigationSource(textView.TextBuffer); return(new EditorNavigationDropdownBarClient(CodeWindow, editorAdaptersFactory, editorNavigationSource, bufferGraphFactoryService)); }
public int AddAdornments() { IVsTextView textView; if (ErrorHandler.Succeeded(CodeWindow.GetPrimaryView(out textView)) && textView != null) { ErrorHandler.ThrowOnFailure(OnNewView(textView)); } if (ErrorHandler.Succeeded(CodeWindow.GetSecondaryView(out textView)) && textView != null) { ErrorHandler.ThrowOnFailure(OnNewView(textView)); } if (ServiceProvider.GetHlslToolsService().LanguagePreferences.NavigationBar) { return(AddDropDownBar()); } return(VSConstants.S_OK); }
public virtual int AddAdornments() { IVsTextView textView; if (ErrorHandler.Succeeded(CodeWindow.GetPrimaryView(out textView)) && textView != null) { ErrorHandler.ThrowOnFailure(OnNewView(textView)); } if (ErrorHandler.Succeeded(CodeWindow.GetSecondaryView(out textView)) && textView != null) { ErrorHandler.ThrowOnFailure(OnNewView(textView)); } int comboBoxCount; IVsDropdownBarClient client; if (LanguagePreferences.ShowDropdownBar && TryCreateDropdownBarClient(out comboBoxCount, out client)) { ErrorHandler.ThrowOnFailure(AddDropdownBar(comboBoxCount, client)); _dropdownBarClient = client; } return(VSConstants.S_OK); }