Ejemplo n.º 1
0
        private void BuildFolderProperties(DirectoryNode node)
        {
            _type = ResourceHelper.GetString("PropertiesPanel.Label.FolderProperties");

            Property.Property property;
            property = new Property.Property(ResourceHelper.GetString("PropertiesPanel.Label.Name"), Name, typeof(string), true);
            _properties.Add(property);
        }
Ejemplo n.º 2
0
		public override void Refresh(bool recursive)
		{
			if (IsInvalid) return;

			base.Refresh(recursive);

            // item icon
            if (Parent is DirectoryNode) 
                insideClasspath = (Parent as DirectoryNode).insideClasspath;

            if (project != null)
            {
                if (project.IsPathHidden(BackingPath))
                    ImageIndex = Icons.HiddenFolder.Index;
                else if (insideClasspath == null && project.IsClassPath(BackingPath))
                {
                    insideClasspath = this;
                    ImageIndex = Icons.ClasspathFolder.Index;
                }
                else if (insideClasspath != null && project.IsCompileTarget(BackingPath))
                    ImageIndex = Icons.FolderCompile.Index;
                else
                    ImageIndex = Icons.Folder.Index;
            }
            else ImageIndex = Icons.Folder.Index;

            SelectedImageIndex = ImageIndex;

            Color color = PluginCore.PluginBase.MainForm.GetThemeColor("ProjectTreeView.ForeColor");
            if (color != Color.Empty) ForeColorRequest = color;
            else ForeColorRequest = SystemColors.ControlText;

			// make the plus/minus sign correct
            bool empty = !Directory.Exists(BackingPath) || PathIsDirectoryEmpty(BackingPath);

			if (!empty)
			{
				// we want the plus sign because we have *something* in here
				if (Nodes.Count == 0)
					Nodes.Add(new PlaceholderNode(Path.Combine(BackingPath, "placeholder")));

				// we're already expanded, so refresh our children
				if (IsExpanded || Path.GetDirectoryName(Tree.PathToSelect) == BackingPath)
					PopulateChildNodes(recursive);
				else
					dirty = true; // refresh on demand
			}
			else
			{
				// we just became empty!
				if (Nodes.Count > 0)
					PopulateChildNodes(recursive);
			}

            NotifyRefresh();
		}
        public override void Refresh(bool recursive)
        {
            if (IsInvalid) return;

            base.Refresh(recursive);

            // item icon
            if (Parent is DirectoryNode)
            {
                insideClasspath = (Parent as DirectoryNode).insideClasspath;
                insideLibrarypath = (Parent as DirectoryNode).insideLibrarypath;
            }

            string colorId = "ProjectTreeView.ForeColor";
            if (project != null)
            {
                if (project.IsPathHidden(BackingPath))
                    ImageIndex = Icons.HiddenFolder.Index;
                else if (insideClasspath == null && project.IsClassPath(BackingPath))
                {
                    insideClasspath = this;
                    ImageIndex = Icons.ClasspathFolder.Index;
                }
                else if (insideClasspath != null && project.IsCompileTarget(BackingPath))
                    ImageIndex = Icons.FolderCompile.Index;
                else if (insideLibrarypath == null && project.IsLibraryAsset(BackingPath))
                {
                    LibraryAsset asset = project.GetAsset(BackingPath);
                    if (asset.SwfMode == SwfAssetMode.ExternalLibrary)
                        colorId = "ProjectTreeView.ExternalLibraryTextColor";
                    else if (asset.SwfMode == SwfAssetMode.Library)
                        colorId = "ProjectTreeView.LibraryTextColor";
                    else if (asset.SwfMode == SwfAssetMode.IncludedLibrary)
                        colorId = "ProjectTreeView.IncludedLibraryTextColor";

                    insideLibrarypath = this;
                    ImageIndex = Icons.LibrarypathFolder.Index;
                }
                else
                    ImageIndex = Icons.Folder.Index;
            }
            else ImageIndex = Icons.Folder.Index;

            SelectedImageIndex = ImageIndex;

            Color textColor = PluginBase.MainForm.GetThemeColor(colorId);
            if (colorId != "ProjectTreeView.ForeColor" && textColor == Color.Empty) textColor = Color.Blue;
            if (textColor != Color.Empty) ForeColorRequest = textColor;
            else ForeColorRequest = SystemColors.ControlText;

            // make the plus/minus sign correct
            // TODO: Check if this works ok!
            bool empty = !Directory.Exists(BackingPath) || FolderHelper.IsDirectoryEmpty(BackingPath);

            if (!empty)
            {
                // we want the plus sign because we have *something* in here
                if (Nodes.Count == 0)
                    Nodes.Add(new PlaceholderNode(Path.Combine(BackingPath, "placeholder")));

                // we're already expanded, so refresh our children
                if (IsExpanded || Path.GetDirectoryName(Tree.PathToSelect) == BackingPath)
                    PopulateChildNodes(recursive);
                else
                    dirty = true; // refresh on demand
            }
            else
            {
                // we just became empty!
                if (Nodes.Count > 0)
                    PopulateChildNodes(recursive);
            }

            NotifyRefresh();
        }
        private void PopulateDirectories(GenericNodeList nodesToDie, bool recursive)
        {
            foreach (string directory in Directory.GetDirectories(BackingPath))
            {
                if (IsDirectoryExcluded(directory))
                    continue;

                DirectoryNode node;
                if (Tree.NodeMap.ContainsKey(directory))
                {
                    node = Tree.NodeMap[directory] as DirectoryNode;
                    if (node != null) // ASClassWizard injects SimpleDirectoryNode != DirectoryNode
                    {
                        if (recursive) node.Refresh(recursive);
                        nodesToDie.Remove(node);
                        continue;
                    }
                    else 
                    {
                        TreeNode fake = Tree.NodeMap[directory];
                        if (fake.Parent != null) fake.Parent.Nodes.Remove(fake);
                    }
                }

                node = new DirectoryNode(directory);
                InsertNode(Nodes, node);
                node.Refresh(recursive);
                nodesToDie.Remove(node);
            }
        }
Ejemplo n.º 5
0
 void OnDirectoryNodeRefresh(DirectoryNode node)
 {
     projectTreeView = node.TreeView;
 }
Ejemplo n.º 6
0
        public override void Refresh(bool recursive)
        {
            if (IsInvalid)
            {
                return;
            }

            base.Refresh(recursive);

            // item icon
            if (Parent is DirectoryNode)
            {
                insideClasspath   = (Parent as DirectoryNode).insideClasspath;
                insideLibrarypath = (Parent as DirectoryNode).insideLibrarypath;
            }

            string colorId = "ProjectTreeView.ForeColor";

            if (project != null)
            {
                if (project.IsPathHidden(BackingPath))
                {
                    ImageIndex = Icons.HiddenFolder.Index;
                }
                else if (insideClasspath == null && project.IsClassPath(BackingPath))
                {
                    insideClasspath = this;
                    ImageIndex      = Icons.ClasspathFolder.Index;
                }
                else if (insideClasspath != null && project.IsCompileTarget(BackingPath))
                {
                    ImageIndex = Icons.FolderCompile.Index;
                }
                else if (insideLibrarypath == null && project.IsLibraryAsset(BackingPath))
                {
                    LibraryAsset asset = project.GetAsset(BackingPath);
                    if (asset.SwfMode == SwfAssetMode.ExternalLibrary)
                    {
                        colorId = "ProjectTreeView.ExternalLibraryTextColor";
                    }
                    else if (asset.SwfMode == SwfAssetMode.Library)
                    {
                        colorId = "ProjectTreeView.LibraryTextColor";
                    }
                    else if (asset.SwfMode == SwfAssetMode.IncludedLibrary)
                    {
                        colorId = "ProjectTreeView.IncludedLibraryTextColor";
                    }

                    insideLibrarypath = this;
                    ImageIndex        = Icons.LibrarypathFolder.Index;
                }
                else
                {
                    ImageIndex = Icons.Folder.Index;
                }
            }
            else
            {
                ImageIndex = Icons.Folder.Index;
            }

            SelectedImageIndex = ImageIndex;

            Color textColor = PluginBase.MainForm.GetThemeColor(colorId);

            if (colorId != "ProjectTreeView.ForeColor" && textColor == Color.Empty)
            {
                textColor = SystemColors.Highlight;
            }
            if (textColor != Color.Empty)
            {
                ForeColorRequest = textColor;
            }
            else
            {
                ForeColorRequest = SystemColors.ControlText;
            }

            // make the plus/minus sign correct
            // TODO: Check if this works ok!
            bool empty = !Directory.Exists(BackingPath) || FolderHelper.IsDirectoryEmpty(BackingPath);

            if (!empty)
            {
                // we want the plus sign because we have *something* in here
                if (Nodes.Count == 0)
                {
                    Nodes.Add(new PlaceholderNode(Path.Combine(BackingPath, "placeholder")));
                }

                // we're already expanded, so refresh our children
                if (IsExpanded || Path.GetDirectoryName(Tree.PathToSelect) == BackingPath)
                {
                    PopulateChildNodes(recursive);
                }
                else
                {
                    dirty = true; // refresh on demand
                }
            }
            else
            {
                // we just became empty!
                if (Nodes.Count > 0)
                {
                    PopulateChildNodes(recursive);
                }
            }

            NotifyRefresh();
        }