Esempio n. 1
0
        void OnFrameworkReferencesChanged(object sender, EventArgs e)
        {
            var          cache   = (FrameworkReferenceNodeCache)sender;
            ITreeBuilder builder = Context.GetTreeBuilder(cache.Project);

            if (builder == null)
            {
                return;
            }

            if (!builder.MoveToChild(DependenciesNode.NodeName, typeof(DependenciesNode)))
            {
                builder.UpdateAll();
                return;
            }

            if (builder.MoveToChild(FrameworkReferencesNode.NodeName, typeof(FrameworkReferencesNode)))
            {
                builder.UpdateAll();
            }
            else
            {
                builder.UpdateAll();
            }
        }
        void OnPackageDependenciesChanged(object sender, EventArgs e)
        {
            var          cache   = (PackageDependencyNodeCache)sender;
            var          project = cache.Project;
            ITreeBuilder builder = Context.GetTreeBuilder(project);

            if (builder == null)
            {
                return;
            }

            if (builder.MoveToChild(DependenciesNode.NodeName, typeof(DependenciesNode)))
            {
                if (builder.MoveToChild(PackageDependenciesNode.NodeName, typeof(PackageDependenciesNode)))
                {
                    var node = builder.DataItem as PackageDependenciesNode;
                    if (node != null && !node.HasChildNodes())
                    {
                        builder.Remove();
                        return;
                    }
                    builder.UpdateAll();
                }
            }
        }
        void AddClass(Project project, IType cls)
        {
            ITreeBuilder builder = Context.GetTreeBuilder();

            if (!builder.MoveToObject(project))
            {
                return;                 // The project is not there or may not yet be expanded
            }

            if (cls.Namespace == "")
            {
                builder.AddChild(new ClassData(project, cls));
            }
            else
            {
                if (builder.Options ["NestedNamespaces"])
                {
                    string[] nsparts = cls.Namespace.Split('.');
                    string   ns      = "";
                    foreach (string nsp in nsparts)
                    {
                        if (builder.Filled)
                        {
                            if (ns.Length > 0)
                            {
                                ns += ".";
                            }
                            ns += nsp;
                            if (!builder.MoveToChild(nsp, typeof(NamespaceData)))
                            {
                                builder.AddChild(new ProjectNamespaceData(project, ns), true);
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                    builder.AddChild(new ClassData(project, cls));
                }
                else
                {
                    if (builder.MoveToChild(cls.Namespace, typeof(NamespaceData)))
                    {
                        builder.AddChild(new ClassData(project, cls));
                    }
                    else
                    {
                        builder.AddChild(new ProjectNamespaceData(project, cls.Namespace));
                    }
                }
            }
        }
        void OnPackageDependenciesChanged(object sender, EventArgs e)
        {
            var          cache   = (PackageDependencyNodeCache)sender;
            var          project = cache.Project;
            ITreeBuilder builder = Context.GetTreeBuilder(project);

            if (builder == null)
            {
                return;
            }

            if (builder.MoveToChild(DependenciesNode.NodeName, typeof(DependenciesNode)))
            {
                if (builder.MoveToChild(SdkDependenciesNode.NodeName, typeof(SdkDependenciesNode)))
                {
                    builder.UpdateAll();
                }
            }
        }
        void UpdateNuGetFolderNode(ITreeBuilder builder, DependenciesNode dependenciesNode)
        {
            bool hasPackages = dependenciesNode.Project.Items.OfType <ProjectPackageReference> ().Any();

            if (hasPackages && !builder.MoveToChild(PackageDependenciesNode.NodeName, typeof(PackageDependenciesNode)))
            {
                var packagesNode = new PackageDependenciesNode(dependenciesNode);
                builder.AddChild(packagesNode);
            }
        }
        void RefreshChildNodes(DotNetProject project)
        {
            ITreeBuilder builder = Context.GetTreeBuilder(project);

            if (builder != null)
            {
                if (builder.MoveToChild("References", typeof(ProjectReferenceCollection)))
                {
                    builder.UpdateAll();
                    builder.MoveToParent();
                }

                if (builder.MoveToChild("Packages", typeof(ProjectPackagesFolderNode)))
                {
                    var packagesFolder = (ProjectPackagesFolderNode)builder.DataItem;
                    packagesFolder.ClearPackageReferences();
                    builder.UpdateAll();
                    builder.MoveToParent();
                }
            }
        }
        ITreeBuilder GetBuilder(object sender)
        {
            var          project = (DnxProject)sender;
            ITreeBuilder builder = Context.GetTreeBuilder(project.Project);

            if (builder != null && builder.MoveToChild("Dependencies", typeof(DependenciesFolderNode)))
            {
                return(builder);
            }

            return(null);
        }
Esempio n. 8
0
        void OnFileRemoved(object s, SolutionItemFileEventArgs args)
        {
            SolutionFolder folder = (SolutionFolder)s;
            ITreeBuilder   tb     = Context.GetTreeBuilder(folder.ParentSolution);

            if (tb != null)
            {
                if (tb.MoveToChild(args.File, typeof(SolutionFolderFileNode)))
                {
                    tb.Remove();
                }
            }
        }
        void RefreshChildNodes(DotNetProject project)
        {
            ITreeBuilder builder = Context.GetTreeBuilder(project);

            if (builder != null)
            {
                if (builder.MoveToChild(ProjectPackagesFolderNode.NodeName, typeof(ProjectPackagesFolderNode)))
                {
                    var packagesFolder = (ProjectPackagesFolderNode)builder.DataItem;
                    packagesFolder.RefreshPackages();
                    builder.MoveToParent();
                }
            }
        }
Esempio n. 10
0
        void OnPackageReferencesChanged(object sender, EventArgs e)
        {
            var          projectPackagesNode = (ProjectPackagesFolderNode)sender;
            ITreeBuilder builder             = Context.GetTreeBuilder(projectPackagesNode);

            if (builder != null)
            {
                builder.UpdateAll();
                builder.MoveToParent();
            }

            if (builder.MoveToChild("References", typeof(ProjectReferenceCollection)))
            {
                builder.UpdateAll();
            }
        }
		ProjectPackagesFolderNode GetPackagesFolderNode (ITreeBuilder treeBuilder)
		{
			NodePosition originalPosition = treeBuilder.CurrentPosition;

			if (!treeBuilder.MoveToParent ()) {
				return null;
			}

			ProjectPackagesFolderNode packagesFolder = null;
			if (treeBuilder.MoveToChild (ProjectPackagesFolderNode.NodeName, typeof(ProjectPackagesFolderNode))) {
				packagesFolder = treeBuilder.DataItem as ProjectPackagesFolderNode;
			}

			treeBuilder.MoveToPosition (originalPosition);

			return packagesFolder;
		}
        ProjectPackagesFolderNode GetPackagesFolderNode(ITreeBuilder treeBuilder)
        {
            NodePosition originalPosition = treeBuilder.CurrentPosition;

            if (!treeBuilder.MoveToParent())
            {
                return(null);
            }

            ProjectPackagesFolderNode packagesFolder = null;

            if (treeBuilder.MoveToChild(ProjectPackagesFolderNode.NodeName, typeof(ProjectPackagesFolderNode)))
            {
                packagesFolder = treeBuilder.DataItem as ProjectPackagesFolderNode;
            }

            treeBuilder.MoveToPosition(originalPosition);

            return(packagesFolder);
        }
Esempio n. 13
0
        void RefreshChildNodes(DotNetProject project, bool packages)
        {
            ITreeBuilder builder = Context.GetTreeBuilder(project);

            if (builder != null)
            {
                if (builder.MoveToChild(DependenciesNode.NodeName, typeof(DependenciesNode)))
                {
                    if (packages)
                    {
                        var dependenciesNode = (DependenciesNode)builder.DataItem;
                        dependenciesNode.PackageDependencyCache.Refresh();
                        dependenciesNode.FrameworkReferencesCache.Refresh();
                    }
                    else
                    {
                        builder.UpdateAll();
                    }
                }
            }
        }
        void RefreshChildNodes(DotNetProject project, bool packagesOnly)
        {
            ITreeBuilder builder = Context.GetTreeBuilder(project);

            if (builder != null)
            {
                if (builder.MoveToChild(DependenciesNode.NodeName, typeof(DependenciesNode)))
                {
                    if (packagesOnly && !AnyPackageUpdates(project))
                    {
                        var dependenciesNode = (DependenciesNode)builder.DataItem;
                        dependenciesNode.PackageDependencyCache.Refresh();
                        UpdateNuGetFolderNode(builder, dependenciesNode);
                    }
                    else
                    {
                        builder.UpdateAll();
                    }
                }
            }
        }