コード例 #1
0
        ITreeBuilder GetFolder(Project project, FilePath filePath)
        {
            ITreeBuilder tb = Context.GetTreeBuilder();

            if (filePath != project.BaseDirectory)
            {
                if (tb.MoveToObject(new ProjectFolder(filePath, project)))
                {
                    return(tb);
                }
                else
                {
                    // Make sure there is a path to that folder
                    tb = FindParentFolderNode(filePath, project);
                    if (tb != null)
                    {
                        tb.UpdateChildren();
                        return(null);
                    }
                }
            }
            else
            {
                if (tb.MoveToObject(project))
                {
                    return(tb);
                }
            }
            return(null);
        }
コード例 #2
0
 private void OnRefreshEvent(object sender, EventArgs args)
 {
     DispatchService.GuiDispatch(delegate {
         ITreeBuilder builder = Context.GetTreeBuilder(sender);
         builder.UpdateChildren();
     });
 }
コード例 #3
0
        private void OnRefreshEvent(object sender, EventArgs args)
        {
            ITreeBuilder builder = Context.GetTreeBuilder();

            builder.UpdateChildren();
            builder.ExpandToNode();
        }
        public static void UpdateChildrenFor <T> (this ITreeBuilderContext context, T item)
        {
            ITreeBuilder builder = context.GetTreeBuilder(item);

            if (builder != null)
            {
                builder.UpdateChildren();
            }
        }
コード例 #5
0
        void HandleWebReferencesServiceWebReferencesChanged(object sender, WebReferencesChangedEventArgs e)
        {
            ITreeBuilder builder = Context.GetTreeBuilder(e.Project);

            if (builder != null)
            {
                builder.UpdateChildren();
            }
        }
コード例 #6
0
        void RefreshChildNodes(DotNetProject project)
        {
            ITreeBuilder builder = Context.GetTreeBuilder(project);

            if (builder != null)
            {
                builder.UpdateChildren();
            }
        }
        void RefreshChildNodes()
        {
            ITreeBuilder builder = Context.GetTreeBuilder(currentFolderNode);

            if (builder != null)
            {
                builder.UpdateChildren();
            }
        }
コード例 #8
0
        private void OnFinishedBuildingTree(ClassPadEventArgs e)
        {
            ITreeBuilder builder = Context.GetTreeBuilder(e.Project);

            if (null != builder)
            {
                builder.UpdateChildren();
            }
        }
コード例 #9
0
 void OnReferencesChanged(object sender, AddinReferenceEventArgs e)
 {
     foreach (var project in e.Select(x => x.Project).Distinct())
     {
         ITreeBuilder builder = Context.GetTreeBuilder(project);
         if (builder != null)
         {
             builder.UpdateChildren();
         }
     }
 }
コード例 #10
0
		void OnAddFile (object sender, ProjectFileEventArgs args)
		{
			if (args.CommonProject != null && args.Count > 2 && args.SingleVirtualDirectory) {
				ITreeBuilder tb = GetFolder (args.CommonProject, args.CommonVirtualRootDirectory);
				if (tb != null)
					tb.UpdateChildren ();
			}
			else {
				foreach (ProjectFileEventInfo e in args)
					AddFile (e.ProjectFile, e.Project);
			}
		}
コード例 #11
0
        void OnSystemFileDeleted(object sender, FileEventArgs args)
        {
            if (Context.Tree.IsDestroyed)
            {
                return;
            }
            foreach (FileEventInfo e in args)
            {
                try {
                    Project project = GetProjectForFile(e.FileName);

                    ITreeBuilder tb = Context.GetTreeBuilder();

                    if (e.IsDirectory)
                    {
                        if (tb.MoveToObject(new ProjectFolder(e.FileName, project)))
                        {
                            if (tb.Options ["ShowAllFiles"] && (project == null || !ProjectFolderCommandHandler.PathExistsInProject(project, e.FileName)))
                            {
                                tb.Remove();
                                return;
                            }
                        }
                    }
                    else
                    {
                        if (tb.MoveToObject(new SystemFile(e.FileName, project)))
                        {
                            tb.Remove();
                            return;
                        }
                    }

                    // Find the parent folder, and update it's children count

                    string parentPath = Path.GetDirectoryName(e.FileName);
                    if (tb.MoveToObject(new ProjectFolder(parentPath, project)))
                    {
                        if (tb.Options ["ShowAllFiles"] && Directory.Exists(parentPath))
                        {
                            tb.UpdateChildren();
                        }
                    }
                } catch (Exception ex) {
                    LoggingService.LogInternalError($"Error while updating project tree in OnSystemFileDeleted : {string.Join (", ", args.Select (x => x.FileName))}.", ex);
                }
            }
        }
コード例 #12
0
        void OnSystemFileDeleted(object sender, FileEventArgs args)
        {
            foreach (FileEventInfo e in args)
            {
                Project project = GetProjectForFile(e.FileName);
                if (project == null)
                {
                    return;
                }

                ITreeBuilder tb = Context.GetTreeBuilder();

                if (e.IsDirectory)
                {
                    if (tb.MoveToObject(new ProjectFolder(e.FileName, project)))
                    {
                        if (tb.Options ["ShowAllFiles"] && !ProjectFolderCommandHandler.PathExistsInProject(project, e.FileName))
                        {
                            tb.Remove();
                            return;
                        }
                    }
                }
                else
                {
                    if (tb.MoveToObject(new SystemFile(e.FileName, project)))
                    {
                        tb.Remove();
                        return;
                    }
                }

                // Find the parent folder, and update it's children count

                string parentPath = Path.GetDirectoryName(e.FileName);
                if (tb.MoveToObject(new ProjectFolder(parentPath, project)))
                {
                    if (tb.Options ["ShowAllFiles"] && Directory.Exists(parentPath))
                    {
                        tb.UpdateChildren();
                    }
                }
            }
        }
コード例 #13
0
        void OnItemsChanged(object sender, ProjectItemEventArgs e)
        {
            var projects = new HashSet <DotNetProject> ();

            foreach (ProjectItemEventInfo evt in e)
            {
                if (evt.Item is NativeReference)
                {
                    projects.Add((DotNetProject)evt.SolutionItem);
                }
            }
            foreach (var project in projects)
            {
                ITreeBuilder builder = Context.GetTreeBuilder(project);
                if (builder != null)
                {
                    builder.UpdateChildren();
                }
            }
        }
コード例 #14
0
        void OnReferencesChanged(object sender, ProjectItemEventArgs e)
        {
            foreach (var project in e.Select(x => x.SolutionItem).Distinct())
            {
                var dnp = project as DotNetProject;
                if (dnp == null)
                {
                    continue;
                }

                var addinFlavor = dnp.AsFlavor <AddinProjectFlavor> ();
                if (addinFlavor == null)
                {
                    continue;
                }

                ITreeBuilder builder = Context.GetTreeBuilder(addinFlavor.AddinReferences);
                if (builder != null)
                {
                    builder.UpdateChildren();
                }
            }
        }
コード例 #15
0
        void AddFile(ProjectFile file, Project project)
        {
            ITreeBuilder tb = Context.GetTreeBuilder();

            if (file.DependsOnFile != null)
            {
                if (!tb.MoveToObject(file.DependsOnFile))
                {
                    // The parent is not in the tree. Add it now, and it will add this file as a child.
                    AddFile(file.DependsOnFile, project);
                }
                else
                {
                    tb.AddChild(file);
                }
                return;
            }

            string filePath = file.IsLink
                                ? project.BaseDirectory.Combine(file.ProjectVirtualPath).ParentDirectory
                                : file.FilePath.ParentDirectory;

            object data;

            if (file.Subtype == Subtype.Directory)
            {
                data = new ProjectFolder(file.Name, project);
            }
            else
            {
                data = file;
            }

            // Already there?
            if (tb.MoveToObject(data))
            {
                return;
            }

            if (filePath != project.BaseDirectory)
            {
                if (tb.MoveToObject(new ProjectFolder(filePath, project)))
                {
                    tb.AddChild(data);
                }
                else
                {
                    // Make sure there is a path to that folder
                    tb = FindParentFolderNode(filePath, project);
                    if (tb != null)
                    {
                        tb.UpdateChildren();
                    }
                }
            }
            else
            {
                if (tb.MoveToObject(project))
                {
                    tb.AddChild(data);
                }
                tb.UpdateChildren();
            }
        }
コード例 #16
0
 private void OnSnapshotRemoved(object sender, ProfilingSnapshotEventArgs args)
 {
     builder.UpdateChildren();
     builder.Expanded = true;
 }