public VsUIHierarchyWindowProvider( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, JoinableTaskContext jtc) { this.serviceProvider = serviceProvider; solutionExplorer = new JoinableLazy<IVsUIHierarchyWindow>(() => GetHierarchyWindow(EnvDTE.Constants.vsWindowKindSolutionExplorer), jtc.Factory, true); }
public ShellInitializedObservable(JoinableLazy <IVsShell> shell) { this.shell = shell; initialized = new AsyncManualResetEvent(); object zombie; ErrorHandler.ThrowOnFailure(shell.GetValue().GetProperty((int)__VSSPROPID.VSSPROPID_Zombie, out zombie)); var isZombie = (bool)zombie; observable = Observable.Create <ShellInitialized>(async o => { if (isZombie) { await initialized.WaitAsync(); } o.OnNext(data); o.OnCompleted(); return(Disposable.Empty); }); if (isZombie) { ErrorHandler.ThrowOnFailure(shell.GetValue().AdviseShellPropertyChanges(this, out cookie)); } }
public VsHierarchyItemManagerProvider([Import(typeof(SAsyncServiceProvider))] IAsyncServiceProvider services, JoinableTaskContext context) { hierarchyManager = new JoinableLazy <IVsHierarchyItemManager>(async() => { var componentModel = await services.GetServiceAsync(typeof(SComponentModel)) as IComponentModel; return(componentModel?.GetService <IVsHierarchyItemManager>()); }, context?.Factory, executeOnMainThread: true); }
public VsServicesExports( [Import(typeof(SVsServiceProvider))] IServiceProvider services, JoinableTaskContext context) { jtf = context.Factory; vsSolution = new JoinableLazy <IVsSolution>(() => services.GetService <SVsSolution, IVsSolution>(), jtf, true); vsStatusBar = new JoinableLazy <IVsStatusbar>(() => services.GetService <SVsStatusbar, IVsStatusbar>(), jtf, true); outputWindow = new JoinableLazy <IVsOutputWindow>(() => services.GetService <SVsOutputWindow, IVsOutputWindow>(), jtf, true); vsShell = new JoinableLazy <IVsShell>(() => services.GetService <SVsShell, IVsShell>(), jtf, true); vsUIShell = new JoinableLazy <IVsUIShell>(() => services.GetService <SVsUIShell, IVsUIShell>(), jtf, true); }
public VsBooleanSymbolExpressionEvaluatorProvider([Import(typeof(SVsServiceProvider))] IServiceProvider services, JoinableTaskContext context) { expressionEvaluator = new JoinableLazy <IVsBooleanSymbolExpressionEvaluator>(() => { var registry = services.GetService <SLocalRegistry>() as ILocalRegistry; // dev14+ should provide the evaluator using the BooleanSymbolExpressionEvaluator clsid var value = registry?.CreateInstance(BooleanSymbolExpressionEvaluatorClsid) as IVsBooleanSymbolExpressionEvaluator; // Previous versions of VS provides the service using the VsProjectCapabilityExpressionMatcher interface return(value ?? registry?.CreateInstance(typeof(VsProjectCapabilityExpressionMatcher).GUID) as IVsBooleanSymbolExpressionEvaluator); }, context?.Factory, executeOnMainThread: true); }
public MsBuildAdapter( JoinableLazy <IVsSolution> vsSolution, Lazy <ISolutionExplorerNodeFactory> nodeFactory, Lazy <ISolutionExplorer> solutionExplorer, JoinableLazy <IVsHierarchyItemManager> hierarchyItemManager, JoinableTaskContext jtc) { this.vsSolution = vsSolution; this.nodeFactory = nodeFactory; this.solutionExplorer = solutionExplorer; this.hierarchyItemManager = hierarchyItemManager; this.asyncManager = jtc.Factory; }
public ProjectNodeProvider( JoinableTaskContext jtc, UnconfiguredProject unconfiguredProject, ISolutionExplorer solutionExplorer) { this.jtc = jtc; this.unconfiguredProject = unconfiguredProject; this.solutionExplorer = solutionExplorer; projectNode = new JoinableLazy <IProjectNode>(async() => (await solutionExplorer.Solution) .FindProject(x => string.Equals( x.PhysicalPath, unconfiguredProject.FullPath, StringComparison.OrdinalIgnoreCase)), jtc.Factory); }
public ShellInitializedObservable(JoinableLazy <IVsShell> shell) { this.shell = shell; object zombie; ErrorHandler.ThrowOnFailure(shell.GetValue().GetProperty((int)__VSSPROPID.VSSPROPID_Zombie, out zombie)); var isZombie = (bool)zombie; if (isZombie) { ErrorHandler.ThrowOnFailure(shell.GetValue().AdviseShellPropertyChanges(this, out cookie)); } else { cts.Cancel(); } }
public SolutionNodeSpec() { var components = GlobalServices.GetService <SComponentModel, IComponentModel>(); var factory = components.GetService <ISolutionExplorerNodeFactory>(); var adapter = components.GetService <IAdapterService>(); var manager = components.DefaultExportProvider.GetExportedValue <IVsHierarchyItemManager>(ContractNames.Interop.IVsHierarchyItemManager); var selection = components.GetService <IVsSolutionSelection>(); var solutionExplorer = components.DefaultExportProvider.GetExport <IVsUIHierarchyWindow>(ContractNames.Interop.SolutionExplorerWindow); var item = manager.GetHierarchyItem(GlobalServices.GetService <SVsSolution, IVsHierarchy>(), (uint)VSConstants.VSITEMID.Root); #pragma warning disable VSSDK005 // Avoid instantiating JoinableTaskContext solution = new SolutionNode(GlobalServices.Instance, item, factory, adapter, selection, JoinableLazy.Create(() => solutionExplorer.Value, taskFactory: new JoinableTaskContext().Factory)); #pragma warning restore VSSDK005 // Avoid instantiating JoinableTaskContext }