private static void Show(Microsoft.VisualStudio.Shell.SVsServiceProvider serviceProvider, EnvDTE.Project project) { var shell = serviceProvider.GetService(typeof(SVsShell)) as IVsShell; if (shell != null) { // Get the main window handle to host our InfoBar shell.GetProperty((int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost, out var obj); var host = (IVsInfoBarHost)obj; //If we cannot find the handle, we cannot do much, so return. if (host == null) { return; } InfoBarModel infoBarModel = CreateInfoBarModel(project); //Get the factory object from IVsInfoBarUIFactory, create it and add it to host. var factory = serviceProvider.GetService(typeof(SVsInfoBarUIFactory)) as IVsInfoBarUIFactory; IVsInfoBarUIElement element = factory.CreateInfoBar(infoBarModel); var infoBarEventsHandler = new InfoBarEventsHandler(serviceProvider, project); element.Advise(infoBarEventsHandler, out var _cookie); host.AddInfoBar(element); } }
private static IPackageSearchRemoteControlService CreateRemoteControlService(VSShell.SVsServiceProvider serviceProvider) { var vsService = serviceProvider.GetService(typeof(SVsRemoteControlService)); if (vsService == null) { // If we can't access the file update service, then there's nothing we can do. return(null); } return(new RemoteControlService(vsService)); }
public VisualStudioSymbolSearchService( VisualStudioWorkspaceImpl workspace, VSShell.SVsServiceProvider serviceProvider) : base(workspace, SymbolSearchOptions.Enabled, SymbolSearchOptions.SuggestForTypesInReferenceAssemblies, SymbolSearchOptions.SuggestForTypesInNuGetPackages) { _workspace = workspace; _installerService = workspace.Services.GetService <IPackageInstallerService>(); _localSettingsDirectory = new ShellSettingsManager(serviceProvider).GetApplicationDataFolder(ApplicationDataFolder.LocalSettings); _logService = new LogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog))); }
public IMouseProcessor GetAssociatedProcessor(IWpfTextView view) { if (App.OptionsPage?.DisableShiftClick == null) { return(null); } var buffer = view.TextBuffer; IOleCommandTarget shellCommandDispatcher = GetShellCommandDispatcher(view); if (shellCommandDispatcher == null) { return(null); } return(new GoToModuleMouseHandler( (DTE2)GlobalServiceProvider.GetService(typeof(SDTE)), view, shellCommandDispatcher, AggregatorFactory.GetClassifier(buffer), NavigatorService.GetTextStructureNavigator(buffer), CtrlKeyState.GetStateForView(view))); }
public PackageSearchService(VSShell.SVsServiceProvider serviceProvider, IPackageInstallerService installerService) : this(installerService, CreateRemoteControlService(serviceProvider), new LogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog))), new DelayService(), new IOService(), new PatchService(), new DatabaseFactoryService(), new ShellSettingsManager(serviceProvider).GetApplicationDataFolder(ApplicationDataFolder.LocalSettings), // Report all exceptions we encounter, but don't crash on them. FatalError.ReportWithoutCrash, new CancellationTokenSource()) { installerService.PackageSourcesChanged += OnPackageSourcesChanged; OnPackageSourcesChanged(this, EventArgs.Empty); }
private StreamingFindUsagesPresenter( IMSBuildEditorHost host, Microsoft.VisualStudio.Shell.SVsServiceProvider serviceProvider, IEditorFormatMapService formatMapService, IClassificationFormatMapService classificationFormatMapService, IClassificationTypeRegistryService classificationTypeRegistry, IEnumerable <ITableColumnDefinition> columns) { Host = host; _serviceProvider = serviceProvider; FormatMapService = formatMapService; ClassificationFormatMap = classificationFormatMapService.GetClassificationFormatMap("tooltip"); ClassificationTypeRegistry = classificationTypeRegistry; _vsFindAllReferencesService = serviceProvider.GetService <SVsFindAllReferences, IFindAllReferencesService> (true); _customColumns = columns.OfType <AbstractFindUsagesCustomColumnDefinition> ().ToImmutableArray(); }
public SymbolSearchService( VisualStudioWorkspaceImpl workspace, VSShell.SVsServiceProvider serviceProvider) : this(workspace, workspace.Services.GetService <IPackageInstallerService>(), CreateRemoteControlService(serviceProvider), new LogService((IVsActivityLog)serviceProvider.GetService(typeof(SVsActivityLog))), new DelayService(), new IOService(), new PatchService(), new DatabaseFactoryService(), new ShellSettingsManager(serviceProvider).GetApplicationDataFolder(ApplicationDataFolder.LocalSettings), // Report all exceptions we encounter, but don't crash on them. FatalError.ReportWithoutCrash, new CancellationTokenSource()) { }
public VisualStudioSymbolSearchProgressService(VSShell.SVsServiceProvider serviceProvider) { _taskCenterServiceOpt = new Lazy <IVsTaskStatusCenterService>(() => (IVsTaskStatusCenterService)serviceProvider.GetService(typeof(SVsTaskStatusCenterService))); }