/// <summary> /// Initializes a new instance of the <see cref="FolderNode"/> class. /// </summary> /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param> /// <param name="parentNode">The parent node accessor.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param> public FolderNode(IVsHierarchyItem hierarchyNode, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) : base(SolutionNodeKind.Folder, hierarchyNode, nodeFactory, adapter, solutionExplorer) { }
public DevEnvImpl( Lazy <IServiceLocator> serviceLocator, Lazy <IDialogWindowFactory> dialogFactory, Lazy <IMessageBoxService> messageBox, Lazy <IErrorsManager> errorsManager, Lazy <IOutputWindowManager> outputWindow, Lazy <IStatusBar> status, JoinableLazy <DevEnvInfo> devEnvInfo, JoinableTaskContext context) { jtf = context.Factory; this.serviceLocator = serviceLocator; this.dialogFactory = dialogFactory; this.messageBox = messageBox; this.status = status; this.errorsManager = errorsManager; this.outputWindow = outputWindow; this.devEnvInfo = devEnvInfo; TracingExtensions.ErrorsManager = this.errorsManager.Value; isElevated = JoinableLazy.Create(() => { ThreadHelper.ThrowIfNotOnUIThread(); var shell = ServiceLocator.TryGetService <SVsShell, IVsShell3>(); if (shell == null) { return(false); } shell.IsRunningElevated(out var elevated); return(elevated); }, jtf, executeOnMainThread: true); }
public MessageBoxService( JoinableLazy <IVsUIShell> uiShell, JoinableTaskContext context) { this.uiShell = uiShell; jtf = context.Factory; }
public DialogWindowFactory( JoinableLazy <IVsUIShell> uiShell, JoinableTaskContext context) { this.uiShell = uiShell; jtf = context.Factory; }
public VsToSolutionAdapter( Lazy <ISolutionExplorerNodeFactory> nodeFactory, JoinableLazy <IVsHierarchyItemManager> hierarchyItemManager) { this.nodeFactory = nodeFactory; this.hierarchyItemManager = hierarchyItemManager; }
public DevEnvInfoProvider(Lazy <IServiceLocator> serviceLocator, JoinableTaskContext context) { devEnvInfo = JoinableLazy.Create(() => { ThreadHelper.ThrowIfNotOnUIThread(); return(GetDevEnvInfo(serviceLocator.Value)); }, context.Factory, executeOnMainThread: true); }
public DialogWindowFactory( JoinableLazy <IVsUIShell> uiShell, JoinableTaskContext context, IEventStream eventStream) { this.uiShell = uiShell; this.eventStream = eventStream; jtf = context.Factory; }
/// <summary> /// Initializes a new instance of the <see cref="ItemNode"/> class. /// </summary> /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param> public ItemNode( IVsHierarchyItem hierarchyNode, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) : base(SolutionNodeKind.Item, hierarchyNode, nodeFactory, adapter, solutionExplorer) { properties = new Lazy <ItemProperties>(() => new ItemProperties(this)); }
public OutputWindowManager( JoinableLazy <IVsOutputWindow> vsOutputWindow, Lazy <IEventStream> eventStream, JoinableTaskContext context) { this.vsOutputWindow = vsOutputWindow; this.eventStream = eventStream; jtf = context.Factory; }
public ItemNodeFactory( Lazy <ISolutionExplorerNodeFactory> childNodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) { this.childNodeFactory = childNodeFactory; this.adapter = adapter; this.solutionExplorer = solutionExplorer; }
public DteToSolutionAdapter( JoinableLazy <IVsSolution> vsSolution, Lazy <ISolutionExplorerNodeFactory> nodeFactory, JoinableLazy <IVsHierarchyItemManager> hierarchyItemManager) { this.vsSolution = vsSolution; this.nodeFactory = nodeFactory; this.hierarchyItemManager = hierarchyItemManager; }
public VsToSolutionAdapter( JoinableTaskContext jtc, Lazy <ISolutionExplorerNodeFactory> nodeFactory, JoinableLazy <IVsHierarchyItemManager> hierarchyItemManager) { asyncManager = jtc.Factory; this.nodeFactory = nodeFactory; this.hierarchyItemManager = hierarchyItemManager; }
/// <summary> /// Initializes a new instance of the <see cref="SolutionFolderNode"/> class. /// </summary> /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param> public SolutionFolderNode( IVsHierarchyItem hierarchyNode, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) : base(SolutionNodeKind.SolutionFolder, hierarchyNode, nodeFactory, adapter, solutionExplorer) { SolutionFolder = new Lazy <SolutionFolder>( () => (SolutionFolder)((Project)hierarchyNode.GetExtenderObject()).Object); }
public ReferencesNodeFactory( Lazy <ISolutionExplorerNodeFactory> childNodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer, JoinableTaskContext jtc) { this.childNodeFactory = childNodeFactory; this.adapter = adapter; this.solutionExplorer = solutionExplorer; this.asyncManager = jtc.Factory; }
public SolutionExplorerNodeFactory( [ImportMany(ContractNames.FallbackNodeFactory)] IEnumerable <ICustomSolutionExplorerNodeFactory> defaultFactories, [ImportMany] IEnumerable <ICustomSolutionExplorerNodeFactory> customFactories, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) { this.defaultFactories = defaultFactories.ToList(); this.customFactories = customFactories.ToList(); this.adapter = adapter; this.solutionExplorer = solutionExplorer; }
/// <summary> /// Initializes a new instance of the <see cref="ProjectItemNode"/> class. /// </summary> /// <param name="kind">The kind of project node.</param> /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ISolutionExplorerNode.As{T}"/>.</param> public ProjectItemNode( SolutionNodeKind kind, IVsHierarchyItem hierarchyNode, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) : base(kind, hierarchyNode, nodeFactory, adapter, solutionExplorer) { this.nodeFactory = nodeFactory; owningProject = new Lazy <IProjectNode>(() => this.nodeFactory.CreateNode(hierarchyNode.GetRoot()) as IProjectNode); }
/// <summary> /// Initializes a new instance of the <see cref="SolutionItemNode"/> class. /// </summary> /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param> public SolutionItemNode( IVsHierarchyItem hierarchyNode, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) : base(SolutionNodeKind.SolutionItem, hierarchyNode, nodeFactory, adapter, solutionExplorer) { this.nodeFactory = nodeFactory; Item = new Lazy <ProjectItem>(() => (ProjectItem)hierarchyNode.GetExtenderObject()); owningFolder = new Lazy <ISolutionFolderNode>(() => this.nodeFactory.CreateNode(hierarchyNode.GetRoot()) as ISolutionFolderNode); }
public SolutionNodeFactory( [Import(typeof(SVsServiceProvider))] IServiceProvider services, Lazy <ISolutionExplorerNodeFactory> nodeFactory, IAdapterService adapter, IVsSolutionSelection selection, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) { this.services = services; this.nodeFactory = nodeFactory; this.adapter = adapter; this.selection = selection; this.solutionExplorer = solutionExplorer; }
/// <summary> /// Initializes a new instance of the <see cref="ProjectNode"/> class. /// </summary> /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param> public ProjectNode( IVsHierarchyItem hierarchyNode, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer, JoinableLazy <IVsBooleanSymbolExpressionEvaluator> expressionEvaluator, IVsHierarchy flavorHierarchy = null) : base(SolutionNodeKind.Project, hierarchyNode, nodeFactory, adapter, solutionExplorer) { this.flavorHierarchy = flavorHierarchy; properties = new Lazy <GlobalProjectProperties>(() => new GlobalProjectProperties(this)); ExpressionEvaluator = expressionEvaluator; Configuration = new ProjectConfiguration(new Lazy <EnvDTE.Project>(() => As <EnvDTE.Project>())); }
/// <summary> /// Initializes a new instance of the <see cref="SolutionNode"/> class. /// </summary> /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ISolutionExplorerNode.As{T}"/>.</param> /// <param name="selection">The solution selection service.</param> /// <param name="solutionExplorer">The solution explorer window.</param> public SolutionNode( IServiceProvider services, IVsHierarchyItem hierarchyNode, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, IVsSolutionSelection selection, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) : base(SolutionNodeKind.Solution, hierarchyNode, nodeFactory, adapter, solutionExplorer) { this.nodeFactory = nodeFactory; dteSolution = new Lazy <Solution2>(() => (Solution2)services.GetService <DTE>().Solution); this.selection = selection; solution = (IVsSolution2)hierarchyNode.HierarchyIdentity.Hierarchy; Configuration = new SolutionConfiguration(new Lazy <Solution>(() => this.AsSolution())); }
public ProjectNodeFactory( [Import(typeof(SVsServiceProvider))] IServiceProvider services, IVsHierarchyItemManager hierarchyManager, Lazy <ISolutionExplorerNodeFactory> childNodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer, JoinableTaskContext jtc, [Import(Clide.ContractNames.Interop.IVsBooleanSymbolExpressionEvaluator)] JoinableLazy <IVsBooleanSymbolExpressionEvaluator> expressionEvaluator) { solution = new JoinableLazy <IVsSolution>(() => services.GetService <SVsSolution, IVsSolution>(), jtc.Factory, true); this.hierarchyManager = hierarchyManager; this.childNodeFactory = childNodeFactory; this.adapter = adapter; this.solutionExplorer = solutionExplorer; this.expressionEvaluator = expressionEvaluator; this.asyncManager = jtc.Factory; }
/// <summary> /// Initializes a new instance of the <see cref="SolutionExplorerNode"/> class. /// </summary> /// <param name="nodeKind">Kind of the node.</param> /// <param name="hierarchyItem">The underlying hierarchy represented by this node.</param> /// <param name="nodeFactory">The factory for child nodes.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ISolutionExplorerNode.As{T}"/>.</param> protected SolutionExplorerNode( SolutionNodeKind nodeKind, IVsHierarchyItem hierarchyItem, ISolutionExplorerNodeFactory nodeFactory, IAdapterService adapter, JoinableLazy <IVsUIHierarchyWindow> solutionExplorer) { Guard.NotNull(nameof(hierarchyItem), hierarchyItem); Guard.NotNull(nameof(nodeFactory), nodeFactory); Guard.NotNull(nameof(adapter), adapter); Guard.NotNull(nameof(solutionExplorer), solutionExplorer); this.hierarchyItem = hierarchyItem; this.nodeFactory = nodeFactory; this.adapter = adapter; this.solutionExplorer = solutionExplorer; Kind = nodeKind; parent = hierarchyItem.Parent == null ? new Lazy <ISolutionExplorerNode>(() => null) : new Lazy <ISolutionExplorerNode>(() => nodeFactory.CreateNode(hierarchyItem.Parent)); name = new Lazy <string>(() => hierarchyItem.GetProperty(VsHierarchyPropID.Name, "")); Func <bool> getHiddenProperty = () => this.hierarchyItem.GetProperty(VsHierarchyPropID.IsHiddenItem, false); isHidden = hierarchyItem.Parent != null ? new Lazy <bool>(() => getHiddenProperty() || parent.Value.IsHidden) : new Lazy <bool>(() => getHiddenProperty()); solutionNode = new JoinableLazy <ISolutionNode>(async() => await ServiceLocator.Global.GetExport <ISolutionExplorer>().Solution); if (hierarchyItem.HierarchyIdentity.IsNestedItem) { hierarchy = hierarchyItem.HierarchyIdentity.NestedHierarchy; itemId = hierarchyItem.HierarchyIdentity.NestedItemID; } else { hierarchy = hierarchyItem.HierarchyIdentity.Hierarchy; itemId = hierarchyItem.HierarchyIdentity.ItemID; } }
public StatusBar(JoinableLazy <IVsStatusbar> vsStatusBar) { this.vsStatusBar = vsStatusBar; }
public SolutionFixture(string solutionFile, bool useCopy = false) { if (!Path.IsPathRooted(solutionFile)) { var rootedFile = Path.Combine(Path.GetDirectoryName(GetType().Assembly.ManifestModule.FullyQualifiedName), solutionFile); if (!File.Exists(rootedFile)) { rootedFile = Path.Combine(baseDirectory, solutionFile); var currentDir = new DirectoryInfo(Directory.GetCurrentDirectory()); while (!File.Exists(rootedFile) && currentDir != null) { rootedFile = Path.Combine(currentDir.FullName, solutionFile); currentDir = currentDir.Parent; } } solutionFile = rootedFile; } this.solutionFile = solutionFile; if (!File.Exists(solutionFile)) { throw new FileNotFoundException("Could not find solution file " + solutionFile, solutionFile); } if (useCopy) { tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); if (!Directory.Exists(tempDir)) { Directory.CreateDirectory(tempDir); } DirectoryCopy(Path.GetDirectoryName(solutionFile), tempDir, true); solutionFile = Path.Combine(tempDir, Path.GetFileName(solutionFile)); } solution = new JoinableLazy <ISolutionNode>(async() => { try { var dte = GlobalServices.GetService <DTE>(); if (!dte.Solution.IsOpen || !dte.Solution.FullName.Equals(this.solutionFile, StringComparison.OrdinalIgnoreCase)) { // Ensure no .suo is loaded, since that would dirty the state across runs. var suoFile = Path.ChangeExtension(this.solutionFile, ".suo"); if (File.Exists(suoFile)) { Try(() => File.Delete(suoFile)); } var sdfFile = Path.ChangeExtension(this.solutionFile, ".sdf"); if (File.Exists(sdfFile)) { Try(() => File.Delete(sdfFile)); } var vsDir = Path.Combine(Path.GetDirectoryName(this.solutionFile), ".vs"); if (Directory.Exists(vsDir)) { Try(() => Directory.Delete(vsDir, true)); } dte.Solution.Open(this.solutionFile); GlobalServices.GetService <SVsSolution, IVsSolution4>() .EnsureSolutionIsLoaded((uint)(__VSBSLFLAGS.VSBSLFLAGS_LoadAllPendingProjects | __VSBSLFLAGS.VSBSLFLAGS_LoadBuildDependencies)); } return(await GlobalServices.GetService <SComponentModel, IComponentModel>().GetService <ISolutionExplorer>().Solution); } catch (Exception ex) { throw new ArgumentException("Failed to open and access solution: " + solutionFile, ex); } }); // If the collection is being created inside the VS process, // instantiate the value right now to cause the solution to open. if (GlobalServices.GetService <DTE>() != null) { Assert.NotNull(solution.GetValue()); } }