private void PopulateChildNodes(bool recursive, Project project) { dirty = false; // nuke the placeholder if (Nodes.Count == 1 && Nodes[0] is PlaceholderNode) { Nodes.RemoveAt(0); } // do a nice stateful update against the filesystem GenericNodeList nodesToDie = new GenericNodeList(); // don't remove project output node if it exists - it's annoying when it // disappears during a build foreach (GenericNode node in Nodes) { if (node is ProjectOutputNode) { var output = node as ProjectOutputNode; if (!project.IsPathHidden(output.BackingPath)) { output.Refresh(recursive); } else { nodesToDie.Add(output); } } else if (node is ReferencesNode) { node.Refresh(recursive); } else { nodesToDie.Add(node); } // add any mapped nodes if (node is FileNode && !(node is SwfFileNode)) { nodesToDie.AddRange(node.Nodes); } } if (Directory.Exists(BackingPath)) { PopulateDirectories(nodesToDie, recursive, project); PopulateFiles(nodesToDie, recursive, project); } foreach (GenericNode node in nodesToDie) { node.Dispose(); Nodes.Remove(node); } }
private void PopulateChildNodes(bool recursive) { dirty = false; // nuke the placeholder if (Nodes.Count == 1 && Nodes[0] is PlaceholderNode) { Nodes.RemoveAt(0); } // do a nice stateful update against the filesystem GenericNodeList nodesToDie = new GenericNodeList(); // don't remove project output node if it exists - it's annoying when it // disappears during a build foreach (GenericNode node in Nodes) { nodesToDie.Add(node); // add any mapped nodes if (node is FileNode) { nodesToDie.AddRange(node.Nodes); } } if (Directory.Exists(BackingPath)) { PopulateDirectories(nodesToDie, recursive); PopulateFiles(nodesToDie, recursive); } foreach (GenericNode node in nodesToDie) { node.Dispose(); Nodes.Remove(node); } }
public override void Refresh(bool recursive) { base.Refresh(recursive); ArrayList projectClasspaths = new ArrayList(); ArrayList globalClasspaths = new ArrayList(); GenericNodeList nodesToDie = new GenericNodeList(); foreach (GenericNode oldRef in Nodes) { nodesToDie.Add(oldRef); } //if (Nodes.Count == 0) recursive = true; // explore classpaths if (PluginMain.Settings.ShowProjectClasspaths) { projectClasspaths.AddRange(project.Classpaths); if (project.AdditionalPaths != null) { projectClasspaths.AddRange(project.AdditionalPaths); } } projectClasspaths.Sort(); if (PluginMain.Settings.ShowGlobalClasspaths) { globalClasspaths.AddRange(PluginMain.Settings.GlobalClasspaths); } globalClasspaths.Sort(); // create references nodes ClasspathNode cpNode; foreach (string projectClasspath in projectClasspaths) { string absolute = projectClasspath; if (!Path.IsPathRooted(absolute)) { absolute = project.GetAbsolutePath(projectClasspath); } if ((absolute + "\\").StartsWith(project.Directory + "\\")) { continue; } if (!project.ShowHiddenPaths && project.IsPathHidden(absolute)) { continue; } cpNode = ReuseNode(absolute, nodesToDie) as ProjectClasspathNode ?? new ProjectClasspathNode(project, absolute, projectClasspath); Nodes.Add(cpNode); cpNode.Refresh(recursive); } foreach (string globalClasspath in globalClasspaths) { string absolute = globalClasspath; if (!Path.IsPathRooted(absolute)) { absolute = project.GetAbsolutePath(globalClasspath); } if (absolute.StartsWith(project.Directory + Path.DirectorySeparatorChar.ToString())) { continue; } cpNode = ReuseNode(absolute, nodesToDie) as ProjectClasspathNode ?? new ClasspathNode(project, absolute, globalClasspath); Nodes.Add(cpNode); cpNode.Refresh(recursive); } // add external libraries at the top level also if (project is AS3Project) { foreach (LibraryAsset asset in (project as AS3Project).SwcLibraries) { if (!asset.IsSwc) { continue; } // check if SWC is inside the project or inside a classpath string absolute = asset.Path; if (!Path.IsPathRooted(absolute)) { absolute = project.GetAbsolutePath(asset.Path); } bool showNode = true; if (absolute.StartsWith(project.Directory)) { showNode = false; } foreach (string path in project.AbsoluteClasspaths) { if (absolute.StartsWith(path)) { showNode = false; break; } } foreach (string path in PluginMain.Settings.GlobalClasspaths) { if (absolute.StartsWith(path)) { showNode = false; break; } } if (showNode && !project.ShowHiddenPaths && project.IsPathHidden(absolute)) { continue; } if (showNode && File.Exists(absolute)) { SwfFileNode swcNode = ReuseNode(absolute, nodesToDie) as SwfFileNode ?? new SwfFileNode(absolute); Nodes.Add(swcNode); swcNode.Refresh(recursive); } } } foreach (GenericNode node in nodesToDie) { node.Dispose(); Nodes.Remove(node); } }