public CustomSolutionNode(IVsSolutionHierarchyNode node, Lazy <ITreeNode> parent, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapterService) : base(SolutionNodeKind.Custom, node, parent, nodeFactory, adapterService) { }
public ItemProperties(ItemNode item) { this.node = item.HierarchyNode; this.item = item.HierarchyNode.ExtensibilityObject as ProjectItem; this.msBuild = item.HierarchyNode.VsHierarchy as IVsBuildPropertyStorage; if (System.Diagnostics.Debugger.IsAttached) debugString = string.Join(Environment.NewLine, GetDynamicMemberNames() .Select(name => name + "=" + GetValue(name))); }
public ItemProperties(ItemNode item) { this.node = item.HierarchyNode; this.item = item.HierarchyNode.ExtensibilityObject as ProjectItem; this.msBuild = item.HierarchyNode.VsHierarchy as IVsBuildPropertyStorage; if (System.Diagnostics.Debugger.IsAttached) { debugString = string.Join(Environment.NewLine, GetDynamicMemberNames() .Select(name => name + "=" + GetValue(name))); } }
/// <summary> /// Initializes a new instance of the <see cref="ReferencesNode"/> 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 ReferencesNode( IVsSolutionHierarchyNode hierarchyNode, Lazy <ITreeNode> parentNode, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) : base(SolutionNodeKind.ReferencesFolder, hierarchyNode, parentNode, nodeFactory, adapter) { Guard.NotNull(() => parentNode, parentNode); this.References = new Lazy <References>(() => ((VSProject)((Project)hierarchyNode.VsHierarchy.Properties(VSConstants.VSITEMID_ROOT).ExtenderObject).Object).References); }
/// <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( IVsSolutionHierarchyNode hierarchyNode, Lazy <ITreeNode> parentNode, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) : base(SolutionNodeKind.Folder, hierarchyNode, parentNode, nodeFactory, adapter) { Guard.NotNull(() => parentNode, parentNode); this.Folder = new Lazy <EnvDTE.ProjectItem>( () => (EnvDTE.ProjectItem)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject); }
/// <summary> /// Initializes a new instance of the <see cref="ReferenceNode"/> 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 ReferenceNode( IVsSolutionHierarchyNode hierarchyNode, Lazy <ITreeNode> parentNode, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) : base(SolutionNodeKind.Reference, hierarchyNode, parentNode, nodeFactory, adapter) { Guard.NotNull(() => parentNode, parentNode); this.Reference = new Lazy <VSLangProj.Reference>( () => (VSLangProj.Reference)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject); }
private ISolutionExplorerNode CreateNode(IVsSolutionHierarchyNode hierarchyNode) { Func<IVsSolutionHierarchyNode, Lazy<ITreeNode>> getParent = null; Func<IVsSolutionHierarchyNode, ITreeNode> getNode = null; getParent = hierarchy => hierarchy.Parent == null ? null : new Lazy<ITreeNode>(() => this.nodeFactory.Value.CreateNode(getParent(hierarchy.Parent), hierarchy.Parent)); getNode = hierarchy => hierarchy == null ? null : this.nodeFactory.Value.CreateNode(getParent(hierarchy), hierarchy); return getNode(hierarchyNode) as ISolutionExplorerNode; }
private ISolutionExplorerNode CreateNode(IVsSolutionHierarchyNode hierarchyNode) { Func <IVsSolutionHierarchyNode, Lazy <ITreeNode> > getParent = null; Func <IVsSolutionHierarchyNode, ITreeNode> getNode = null; getNode = hierarchy => hierarchy == null ? null : this.nodeFactory.Value.CreateNode(getParent(hierarchy), hierarchy); getParent = hierarchy => hierarchy.Parent == null ? null : new Lazy <ITreeNode>(() => this.nodeFactory.Value.CreateNode(getParent(hierarchy.Parent), hierarchy.Parent)); return(getNode(hierarchyNode) as ISolutionExplorerNode); }
/// <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="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 ProjectNode( IVsSolutionHierarchyNode hierarchyNode, Lazy <ITreeNode> parentNode, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) : base(SolutionNodeKind.Project, hierarchyNode, parentNode, nodeFactory, adapter) { Guard.NotNull(() => parentNode, parentNode); this.Project = new Lazy <EnvDTE.Project>(() => (EnvDTE.Project)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject); this.properties = new Lazy <GlobalProjectProperties>(() => new GlobalProjectProperties(this)); this.Configuration = new ProjectConfiguration(this); }
/// <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="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 ProjectItemNode( SolutionNodeKind kind, IVsSolutionHierarchyNode hierarchyNode, Lazy<ITreeNode> parentNode, ITreeNodeFactory<IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) : base(kind, hierarchyNode, parentNode, nodeFactory, adapter) { this.nodeFactory = nodeFactory; this.owningProject = new Lazy<IProjectNode>(() => { var owningHierarchy = new VsSolutionHierarchyNode(hierarchyNode.VsHierarchy, VSConstants.VSITEMID_ROOT); return this.nodeFactory.CreateNode(GetParent(owningHierarchy), owningHierarchy) as IProjectNode; }); }
/// <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="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 ProjectItemNode( SolutionNodeKind kind, IVsSolutionHierarchyNode hierarchyNode, Lazy <ITreeNode> parentNode, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) : base(kind, hierarchyNode, parentNode, nodeFactory, adapter) { this.nodeFactory = nodeFactory; this.owningProject = new Lazy <IProjectNode>(() => { var owningHierarchy = new VsSolutionHierarchyNode(hierarchyNode.VsHierarchy, VSConstants.VSITEMID_ROOT); return(this.nodeFactory.CreateNode(GetParent(owningHierarchy), owningHierarchy) as IProjectNode); }); }
/// <summary> /// Initializes a new instance of the <see cref="SolutionTreeNode"/> class. /// </summary> /// <param name="nodeKind">Kind of the node.</param> /// <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> protected SolutionTreeNode( SolutionNodeKind nodeKind, IVsSolutionHierarchyNode hierarchyNode, Lazy <ITreeNode> parentNode, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) { Guard.NotNull(() => hierarchyNode, hierarchyNode); Guard.NotNull(() => nodeFactory, nodeFactory); Guard.NotNull(() => adapter, adapter); this.hierarchyNode = hierarchyNode; this.factory = nodeFactory; this.adapter = adapter; this.window = new Lazy <IVsUIHierarchyWindow>(() => GetWindow(this.hierarchyNode.ServiceProvider)); this.parent = parentNode ?? new Lazy <ITreeNode>(() => null); this.DisplayName = this.hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).DisplayName; this.Kind = nodeKind; Func <bool> getHiddenProperty = () => GetProperty <bool?>( this.hierarchyNode.VsHierarchy, __VSHPROPID.VSHPROPID_IsHiddenItem, this.hierarchyNode.ItemId).GetValueOrDefault(); this.isHidden = parentNode != null ? new Lazy <bool>(() => getHiddenProperty() || parentNode.Value.IsHidden) : new Lazy <bool>(() => getHiddenProperty()); if (System.Diagnostics.Debugger.IsAttached) { this.debuggerDisplay = BuildDebuggerDisplay(); } this.solutionNode = new Lazy <ISolutionNode>(() => { var solutionHierarchy = new VsSolutionHierarchyNode( (IVsHierarchy)this.hierarchyNode.ServiceProvider.GetService <SVsSolution, IVsSolution>(), VSConstants.VSITEMID_ROOT); return((ISolutionNode)this.factory.CreateNode(null, solutionHierarchy)); }); }
/// <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="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 SolutionItemNode( IVsSolutionHierarchyNode hierarchyNode, Lazy <ITreeNode> parentNode, ITreeNodeFactory <IVsSolutionHierarchyNode> nodeFactory, IAdapterService adapter) : base(SolutionNodeKind.SolutionItem, hierarchyNode, parentNode, nodeFactory, adapter) { Guard.NotNull(() => parentNode, parentNode); this.nodeFactory = nodeFactory; this.Item = new Lazy <EnvDTE.ProjectItem>( () => (EnvDTE.ProjectItem)hierarchyNode.VsHierarchy.Properties(hierarchyNode.ItemId).ExtenderObject); this.owningFolder = new Lazy <ISolutionFolderNode>(() => { var owningHierarchy = new VsSolutionHierarchyNode(hierarchyNode.VsHierarchy, VSConstants.VSITEMID_ROOT); return(this.nodeFactory.CreateNode(GetParent(owningHierarchy), owningHierarchy) as ISolutionFolderNode); }); }
/// <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="childNodeFactory">The factory for child nodes.</param> /// <param name="looseNodeFactory">The explorer node factory used to create "loose" nodes from solution explorer.</param> /// <param name="locator">The service locator.</param> /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param> /// <param name="solutionEvents">The solution events.</param> /// <param name="uiThread">The UI thread.</param> public SolutionNode( IVsSolutionHierarchyNode hierarchyNode, // This is the regular node factory for trees, that receives a lazy // pointer to the parent tree node. ITreeNodeFactory <IVsSolutionHierarchyNode> childNodeFactory, // This factory is used to create "loose" nodes from solution explorer ISolutionExplorerNodeFactory looseNodeFactory, IServiceLocator locator, IAdapterService adapter, ISolutionEvents solutionEvents, // Retrieving current selection must be done on the UI thread. IUIThread uiThread) : base(SolutionNodeKind.Solution, hierarchyNode, null, childNodeFactory, adapter) { this.Solution = new Lazy <EnvDTE.Solution>(() => hierarchyNode.ServiceProvider.GetService <EnvDTE.DTE>().Solution); this.nodeFactory = childNodeFactory; this.explorerNodeFactory = looseNodeFactory; this.events = solutionEvents; this.selection = new Lazy <IVsMonitorSelection>(() => locator.GetService <SVsShellMonitorSelection, IVsMonitorSelection>()); this.uiThread = uiThread; }
private Lazy<ITreeNode> GetParent(IVsSolutionHierarchyNode hierarchy) { return hierarchy.Parent == null ? null : new Lazy<ITreeNode>(() => this.nodeFactory.CreateNode(GetParent(hierarchy.Parent), hierarchy.Parent)); }
public ISolutionExplorerNode Create(IVsSolutionHierarchyNode hierarchyNode) { return CreateNode(hierarchyNode); }
private ITreeNode GetNode(IVsSolutionHierarchyNode hierarchy) { return hierarchy == null ? null : this.nodeFactory.Value.CreateNode(GetParent(hierarchy), hierarchy); }
public ISolutionExplorerNode Create(IVsSolutionHierarchyNode hierarchyNode) { var cacheKey = Tuple.Create(hierarchyNode.VsHierarchy, hierarchyNode.ItemId); return nodeCache.GetOrAdd(cacheKey, _ => CreateNode(hierarchyNode)); }
public ISolutionExplorerNode Create(IVsSolutionHierarchyNode hierarchyNode) { var cacheKey = Tuple.Create(hierarchyNode.VsHierarchy, hierarchyNode.ItemId); return(nodeCache.GetOrAdd(cacheKey, _ => CreateNode(hierarchyNode))); }
/// <summary> /// Creates a new child node using the node factory received in the constructor. /// </summary> /// <param name="hierarchyNode">The hierarchy node to create the child node for.</param> /// <remarks> /// This method is used for example when the node exposes child node creation APIs, such as /// the <see cref="FolderNode"/>. /// </remarks> protected virtual ITreeNode CreateNode(IVsSolutionHierarchyNode hierarchyNode) { return(this.factory.CreateNode(new Lazy <ITreeNode>(() => this), hierarchyNode)); }
private ITreeNode GetNode(IVsSolutionHierarchyNode hierarchy) { return(hierarchy == null ? null : this.nodeFactory.Value.CreateNode(GetParent(hierarchy), hierarchy)); }
private Lazy <ITreeNode> GetParent(IVsSolutionHierarchyNode hierarchy) { return(hierarchy.Parent == null ? null : new Lazy <ITreeNode>(() => this.nodeFactory.CreateNode(GetParent(hierarchy.Parent), hierarchy.Parent))); }