private void RebuildProjectNode(Project project)
        {
            activeProject = project;

            // create the top-level project node
            ProjectNode projectNode = new ProjectNode(project);

            Nodes.Add(projectNode);
            projectNode.Refresh(true);
            projectNode.Expand();

            ArrayList projectClasspaths = new ArrayList();
            ArrayList globalClasspaths  = new ArrayList();

            if (PluginMain.Settings.ShowProjectClasspaths)
            {
                projectClasspaths.AddRange(project.Classpaths);
                if (project.AdditionalPaths != null)
                {
                    projectClasspaths.AddRange(project.AdditionalPaths);
                }
            }

            if (PluginMain.Settings.ShowGlobalClasspaths)
            {
                globalClasspaths.AddRange(PluginMain.Settings.GlobalClasspaths);
            }

            ReferencesNode refs = new ReferencesNode(project.Directory, "References");

            projectNode.References = refs;
            ClasspathNode cpNode;

            foreach (string projectClasspath in projectClasspaths)
            {
                string absolute = projectClasspath;
                if (!Path.IsPathRooted(absolute))
                {
                    absolute = project.GetAbsolutePath(projectClasspath);
                }
                if ((absolute + "\\").StartsWith(project.Directory + "\\"))
                {
                    continue;
                }

                cpNode = new ProjectClasspathNode(project, absolute, projectClasspath);
                refs.Nodes.Add(cpNode);
                cpNode.Refresh(true);
            }

            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 = new ClasspathNode(project, absolute, globalClasspath);
                refs.Nodes.Add(cpNode);
                cpNode.Refresh(true);
            }

            // 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 && File.Exists(absolute))
                    {
                        SwfFileNode swcNode = new SwfFileNode(absolute);
                        refs.Nodes.Add(swcNode);
                        swcNode.Refresh(true);
                    }
                }
            }
        }
示例#2
0
		/// <summary>
		/// Rebuilds the tree from scratch.
		/// </summary>
		public void RebuildTree(bool saveState, bool restoreExpanded)
		{
			// store old tree state
            List<string> previouslyExpanded = restoreExpanded ? ExpandedPaths : new List<string>();
			
			foreach (GenericNode node in Nodes)
				node.Dispose();

			BeginUpdate();

			SelectedNodes = null;
			Nodes.Clear();
			nodeMap.Clear();
			ShowRootLines = false;
			
			if (project == null)
			{
				EndUpdate();
				return;
			}

			// create the top-level project node
			ProjectNode projectNode = new ProjectNode(project);
			Nodes.Add(projectNode);
			projectNode.Refresh(true);
			projectNode.Expand();

            ArrayList projectClasspaths = new ArrayList();
            ArrayList globalClasspaths = new ArrayList();

            if (PluginMain.Settings.ShowProjectClasspaths)
                projectClasspaths.AddRange(project.Classpaths);

			if (PluginMain.Settings.ShowGlobalClasspaths)
                globalClasspaths.AddRange(PluginMain.Settings.GlobalClasspaths);

            ClasspathNode cpNode;

            foreach (string projectClasspath in projectClasspaths)
            {
                string absolute = projectClasspath;
                if (!Path.IsPathRooted(absolute))
                    absolute = project.GetAbsolutePath(projectClasspath);
                if ((absolute + "\\").StartsWith(project.Directory + "\\"))
                    continue;

                cpNode = new ProjectClasspathNode(project, absolute, projectClasspath);
                Nodes.Add(cpNode);
                cpNode.Refresh(true);
                ShowRootLines = true;
            }

            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 = new ClasspathNode(project, absolute, globalClasspath);
                Nodes.Add(cpNode);
                cpNode.Refresh(true);
                ShowRootLines = true;
            }


            // 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 && File.Exists(absolute))
                {
                    SwfFileNode swcNode = new SwfFileNode(absolute);
                    Nodes.Add(swcNode);
                    swcNode.Refresh(true);
                    ShowRootLines = true;
                }
            }

			// restore tree state
			ExpandedPaths = previouslyExpanded;

			// scroll to the top
			projectNode.EnsureVisible();
			SelectedNode = projectNode;
			Win32.Scrolling.scrollToLeft(this);

			EndUpdate();
		}
示例#3
0
        private void RebuildProjectNode(Project project)
        {
            activeProject = project;

            // create the top-level project node
            ProjectNode projectNode = new ProjectNode(project);
            Nodes.Add(projectNode);
            projectNode.Refresh(true);
            projectNode.Expand();

            ArrayList projectClasspaths = new ArrayList();
            ArrayList globalClasspaths = new ArrayList();

            if (PluginMain.Settings.ShowProjectClasspaths)
            {
                projectClasspaths.AddRange(project.Classpaths);
                if (project.AdditionalPaths != null) projectClasspaths.AddRange(project.AdditionalPaths);
            }

            if (PluginMain.Settings.ShowGlobalClasspaths)
                globalClasspaths.AddRange(PluginMain.Settings.GlobalClasspaths);

            ReferencesNode refs = new ReferencesNode(project.Directory, "References");
            projectNode.References = refs;
            ClasspathNode cpNode;

            foreach (string projectClasspath in projectClasspaths)
            {
                string absolute = projectClasspath;
                if (!Path.IsPathRooted(absolute))
                    absolute = project.GetAbsolutePath(projectClasspath);
                if ((absolute + "\\").StartsWith(project.Directory + "\\"))
                    continue;

                cpNode = new ProjectClasspathNode(project, absolute, projectClasspath);
                refs.Nodes.Add(cpNode);
                cpNode.Refresh(true);
            }

            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 = new ClasspathNode(project, absolute, globalClasspath);
                refs.Nodes.Add(cpNode);
                cpNode.Refresh(true);
            }

            // 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 && File.Exists(absolute))
                    {
                        SwfFileNode swcNode = new SwfFileNode(absolute);
                        refs.Nodes.Add(swcNode);
                        swcNode.Refresh(true);
                    }
                }
        }
示例#4
0
        /// <summary>
        /// Rebuilds the tree from scratch.
        /// </summary>
        public void RebuildTree(bool saveState, bool restoreExpanded)
        {
            // store old tree state
            List <string> previouslyExpanded = restoreExpanded ? ExpandedPaths : new List <string>();

            foreach (GenericNode node in Nodes)
            {
                node.Dispose();
            }

            BeginUpdate();

            SelectedNodes = null;
            Nodes.Clear();
            nodeMap.Clear();
            ShowRootLines = false;

            if (project == null)
            {
                EndUpdate();
                return;
            }

            // create the top-level project node
            ProjectNode projectNode = new ProjectNode(project);

            Nodes.Add(projectNode);
            projectNode.Refresh(true);
            projectNode.Expand();

            ArrayList projectClasspaths = new ArrayList();
            ArrayList globalClasspaths  = new ArrayList();

            if (PluginMain.Settings.ShowProjectClasspaths)
            {
                projectClasspaths.AddRange(project.Classpaths);
            }

            if (PluginMain.Settings.ShowGlobalClasspaths)
            {
                globalClasspaths.AddRange(PluginMain.Settings.GlobalClasspaths);
            }

            ClasspathNode cpNode;

            foreach (string projectClasspath in projectClasspaths)
            {
                string absolute = projectClasspath;
                if (!Path.IsPathRooted(absolute))
                {
                    absolute = project.GetAbsolutePath(projectClasspath);
                }
                if ((absolute + "\\").StartsWith(project.Directory + "\\"))
                {
                    continue;
                }

                cpNode = new ProjectClasspathNode(project, absolute, projectClasspath);
                Nodes.Add(cpNode);
                cpNode.Refresh(true);
                ShowRootLines = true;
            }

            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 = new ClasspathNode(project, absolute, globalClasspath);
                Nodes.Add(cpNode);
                cpNode.Refresh(true);
                ShowRootLines = true;
            }


            // 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 && File.Exists(absolute))
                    {
                        SwfFileNode swcNode = new SwfFileNode(absolute);
                        Nodes.Add(swcNode);
                        swcNode.Refresh(true);
                        ShowRootLines = true;
                    }
                }
            }

            // restore tree state
            ExpandedPaths = previouslyExpanded;

            // scroll to the top
            projectNode.EnsureVisible();
            SelectedNode = projectNode;
            Win32.Scrolling.scrollToLeft(this);

            EndUpdate();
        }