コード例 #1
0
		private void AddItems(MergableMenu menu, GenericNode node)
		{
			if (node.IsInvalid) return;

			string path = node.BackingPath;

			if (node is ProjectNode)
				AddProjectItems(menu);
			
			else if (node is ClasspathNode)
				AddClasspathItems(menu);

			else if (node is DirectoryNode)
				AddFolderItems(menu,path);
			
			else if (node is ProjectOutputNode)
				AddProjectOutputItems(menu,node as ProjectOutputNode);

			else if (node is ExportNode)
				AddExportItems(menu,node as ExportNode);

			else if (node is FileNode)
			{
				if (FileHelper.IsActionScript(path)) AddActionScriptItems(menu,path);
				else if (FileHelper.IsSwf(path)) AddSwfItems(menu,path);
				else if (FileHelper.IsResource(path)) AddOtherResourceItems(menu,path);
				else AddGenericFileItems(menu,path);
			}
		}
コード例 #2
0
		/// <summary>
		/// Inserts a node in the correct location (sorting alphabetically by
		/// directories first, then files).
		/// </summary>
		/// <param name="node"></param>
		private void InsertNode(GenericNode node)
		{
			bool inserted = false;

			for (int i=0; i<Nodes.Count; i++)
			{
				GenericNode existingNode = Nodes[i] as GenericNode;

				if (node is FileNode && existingNode is DirectoryNode)
					continue;

				if (string.Compare(existingNode.Text,node.Text,true) > 0 ||
					node is DirectoryNode && existingNode is FileNode)
				{
					Nodes.Insert(i,node);
					inserted = true;
					break;
				}
			}

			if (!inserted)
				Nodes.Add(node); // append to the end of the list

			// is the tree looking to have this node selected?
			if (Tree.PathToSelect == node.BackingPath)
			{
				// use SelectedNode so multiselect treeview can handle painting
				Tree.SelectedNodes = new ArrayList(new object[]{node});
				Tree.PathToSelect = null;
				node.EnsureVisible();

				// if you created a new folder, then label edit it!
				if (node.Text.StartsWith("New Folder"))
				{
					Tree.EndUpdate();
					node.BeginEdit();
				}
			}
		}