public TreeNode AddProjectNode(TreeNode motherNode, IProject project)
		{
			ProjectNode projectNode = new ProjectNode(project);
			projectNode.AddTo(motherNode);
			
			if (project is MissingProject) {
				CustomNode missingNode = new CustomNode();
				missingNode.SetIcon("Icons.16x16.Warning");
				missingNode.Text = ResourceService.GetString("ICSharpCode.SharpDevelop.Commands.ProjectBrowser.ProjectFileNotFound");
				missingNode.AddTo(projectNode);
			} else if (project is UnknownProject) {
				string ext = Path.GetExtension(project.FileName);
				if (".proj".Equals(ext, StringComparison.OrdinalIgnoreCase)
				    || ".build".Equals(ext, StringComparison.OrdinalIgnoreCase))
				{
					projectNode.OpenedImage = projectNode.ClosedImage = "Icons.16x16.XMLFileIcon";
					projectNode.Nodes.Clear();
				} else {
					CustomNode unknownNode = new CustomNode();
					unknownNode.SetIcon("Icons.16x16.Warning");
					unknownNode.Text = StringParser.Parse(((UnknownProject)project).WarningText);
					unknownNode.AddTo(projectNode);
				}
			} else {
				new ReferenceFolder(project).AddTo(projectNode);
			}
			return projectNode;
		}
Ejemplo n.º 2
0
        public TreeNode AddProjectNode(TreeNode motherNode, IProject project)
        {
            ProjectNode projectNode = new ProjectNode(project);

            projectNode.InsertSorted(motherNode);

            if (project is MissingProject)
            {
                CustomNode missingNode = new CustomNode();
                missingNode.SetIcon("Icons.16x16.Warning");
                missingNode.Text = ResourceService.GetString("ICSharpCode.SharpDevelop.Commands.ProjectBrowser.ProjectFileNotFound");
                missingNode.AddTo(projectNode);
            }
            else if (project is ErrorProject)
            {
                CustomNode unknownNode = new CustomNode();
                unknownNode.SetIcon("Icons.16x16.Warning");
                unknownNode.Text = ((ErrorProject)project).Exception.Message;
                unknownNode.AddTo(projectNode);
            }
            else if (project is MSBuildFileProject)
            {
                projectNode.OpenedImage = projectNode.ClosedImage = "Icons.16x16.XMLFileIcon";
                projectNode.Nodes.Clear();
            }
            else
            {
                new ReferenceFolder(project).AddTo(projectNode);
            }
            return(projectNode);
        }
Ejemplo n.º 3
0
        public DirectoryNode(string directory, FileNodeStatus fileNodeStatus)
        {
            sortOrder = 1;
            ContextmenuAddinTreePath = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FolderNode";
            this.Directory           = directory;
            this.fileNodeStatus      = fileNodeStatus;

            removeMe = new CustomNode();
            removeMe.AddTo(this);

            SetIcon();
            canLabelEdit = true;
        }
Ejemplo n.º 4
0
        public DirectoryNode(string directory, FileNodeStatus fileNodeStatus, ProjectItem projectItem)
        {
            sortOrder = 1;
            ContextmenuAddinTreePath = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FolderNode";
            this.Directory = DirectoryName.Create(directory);
            this.fileNodeStatus = fileNodeStatus;
            this.ProjectItem = projectItem;

            removeMe = new CustomNode();
            removeMe.AddTo(this);

            SetIcon();
            canLabelEdit = true;
        }
		public WixLibraryFolderNode(IProject project)
		{
			this.project = project;
			Text = StringParser.Parse("${res:ICSharpCode.WixBinding.WixLibraryFolderNode.Text}");
			OpenedImage = "ProjectBrowser.ReferenceFolder.Open";
			ClosedImage = "ProjectBrowser.ReferenceFolder.Closed";
			ContextmenuAddinTreePath = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/WixLibraryFolderNode";
			
			foreach (ProjectItem item in project.Items) {
				if (item is WixLibraryProjectItem) {
					CustomNode node = new CustomNode();
					node.AddTo(this);
					break;
				}
			}
		}
Ejemplo n.º 6
0
        public TreeNode AddProjectNode(TreeNode motherNode, IProject project)
        {
            ProjectNode projectNode = new ProjectNode(project);
            projectNode.InsertSorted(motherNode);

            if (project is MissingProject) {
                CustomNode missingNode = new CustomNode();
                missingNode.SetIcon("Icons.16x16.Warning");
                missingNode.Text = ResourceService.GetString("ICSharpCode.SharpDevelop.Commands.ProjectBrowser.ProjectFileNotFound");
                missingNode.AddTo(projectNode);
            } else if (project is ErrorProject) {
                CustomNode unknownNode = new CustomNode();
                unknownNode.SetIcon("Icons.16x16.Warning");
                unknownNode.Text = ((ErrorProject)project).Exception.Message;
                unknownNode.AddTo(projectNode);
            } else if (project is MSBuildFileProject) {
                projectNode.OpenedImage = projectNode.ClosedImage = "Icons.16x16.XMLFileIcon";
                projectNode.Nodes.Clear();
            } else {
                new ReferenceFolder(project).AddTo(projectNode);
            }
            return projectNode;
        }
Ejemplo n.º 7
0
        public TreeNode AddProjectNode(TreeNode motherNode, IProject project)
        {
            ProjectNode projectNode = new ProjectNode(project);

            projectNode.AddTo(motherNode);

            if (project is MissingProject)
            {
                CustomNode missingNode = new CustomNode();
                missingNode.SetIcon("Icons.16x16.Warning");
                missingNode.Text = ResourceService.GetString("ICSharpCode.SharpDevelop.Commands.ProjectBrowser.ProjectFileNotFound");
                missingNode.AddTo(projectNode);
            }
            else if (project is UnknownProject)
            {
                string ext = Path.GetExtension(project.FileName);
                if (".proj".Equals(ext, StringComparison.OrdinalIgnoreCase) ||
                    ".build".Equals(ext, StringComparison.OrdinalIgnoreCase))
                {
                    projectNode.OpenedImage = projectNode.ClosedImage = "Icons.16x16.XMLFileIcon";
                    projectNode.Nodes.Clear();
                }
                else
                {
                    CustomNode unknownNode = new CustomNode();
                    unknownNode.SetIcon("Icons.16x16.Warning");
                    unknownNode.Text = StringParser.Parse(((UnknownProject)project).WarningText);
                    unknownNode.AddTo(projectNode);
                }
            }
            else
            {
                new ReferenceFolder(project).AddTo(projectNode);
            }
            return(projectNode);
        }
Ejemplo n.º 8
0
        protected override void Initialize()
        {
            if (removeMe != null)
            {
                Nodes.Remove(removeMe);
                removeMe = null;
            }

            LoggingService.Info("Initialize DirectoryNode " + Directory);

            Dictionary <string, FileNode> fileNodeDictionary
                = new Dictionary <string, FileNode>(StringComparer.OrdinalIgnoreCase);
            Dictionary <FileNode, string>      dependendFileDictionary = new Dictionary <FileNode, string>();
            Dictionary <string, DirectoryNode> directoryNodeList       = new Dictionary <string, DirectoryNode>(StringComparer.OrdinalIgnoreCase);

            // Add files found in file system

            if (System.IO.Directory.Exists(Directory))
            {
                foreach (string subDirectory in System.IO.Directory.GetDirectories(Directory))
                {
                    if (Path.GetFileName(subDirectory) != ".svn")
                    {
                        DirectoryNode newDirectoryNode = DirectoryNodeFactory.CreateDirectoryNode(this, Project, subDirectory);
                        newDirectoryNode.InsertSorted(this);
                        directoryNodeList[Path.GetFileName(subDirectory)] = newDirectoryNode;
                    }
                }

                foreach (string file in System.IO.Directory.GetFiles(Directory))
                {
                    FileNode fileNode = new FileNode(file);
                    fileNodeDictionary[Path.GetFileName(file)] = fileNode;
                    fileNode.InsertSorted(this);
                }
            }
            if (Nodes.Count == 0)
            {
                SetClosedImage();
            }

            string relativeDirectoryPath = this.RelativePath;

            if (relativeDirectoryPath.Length > 0)
            {
                relativeDirectoryPath = relativeDirectoryPath.Replace('\\', '/') + '/';
            }

            // Add project items

            foreach (ProjectItem item in Project.Items)
            {
                if (item.ItemType == ItemType.WebReferenceUrl)
                {
                    DirectoryNode node;
                    if (directoryNodeList.TryGetValue(Path.GetFileName(item.FileName), out node))
                    {
                        if (node.FileNodeStatus == FileNodeStatus.None)
                        {
                            node.FileNodeStatus = FileNodeStatus.InProject;
                        }
                        node.ProjectItem = item;
                    }
                    continue;
                }
                FileProjectItem fileItem = item as FileProjectItem;
                if (fileItem == null)
                {
                    continue;
                }
                string virtualName = fileItem.VirtualName.Replace('\\', '/');
                if (virtualName.EndsWith("/"))
                {
                    virtualName = virtualName.Substring(0, virtualName.Length - 1);
                }
                string fileName = Path.GetFileName(virtualName);
                if (!string.Equals(virtualName, relativeDirectoryPath + fileName, StringComparison.OrdinalIgnoreCase))
                {
                    AddParentFolder(virtualName, relativeDirectoryPath, directoryNodeList);
                    continue;
                }

                if (item.ItemType.IsFolder())
                {
                    DirectoryNode node;
                    if (directoryNodeList.TryGetValue(fileName, out node))
                    {
                        if (node.FileNodeStatus == FileNodeStatus.None)
                        {
                            node.FileNodeStatus = FileNodeStatus.InProject;
                        }
                        node.ProjectItem = item;
                    }
                    else
                    {
                        node = DirectoryNodeFactory.CreateDirectoryNode(item, FileNodeStatus.Missing);
                        node.InsertSorted(this);
                        directoryNodeList[fileName] = node;
                    }
                }
                else
                {
                    FileNode node;
                    if (fileItem.IsLink)
                    {
                        node = new FileNode(fileItem.FileName, FileNodeStatus.InProject);
                        node.InsertSorted(this);
                        fileNodeDictionary[fileName] = node;
                    }
                    else
                    {
                        if (fileNodeDictionary.TryGetValue(fileName, out node))
                        {
                            if (node.FileNodeStatus == FileNodeStatus.None)
                            {
                                node.FileNodeStatus = FileNodeStatus.InProject;
                            }
                        }
                        else
                        {
                            node = new FileNode(fileItem.FileName, FileNodeStatus.Missing);
                            node.InsertSorted(this);
                            fileNodeDictionary[fileName] = node;
                        }
                    }

                    node.ProjectItem = fileItem;
                    if (fileItem != null && fileItem.DependentUpon != null && fileItem.DependentUpon.Length > 0)
                    {
                        dependendFileDictionary[node] = fileItem.DependentUpon;
                    }
                }
            }

            // Insert 'code behind files'
            foreach (KeyValuePair <FileNode, string> pair in dependendFileDictionary)
            {
                string fileName = Path.GetFileName(pair.Value);
                if (!fileNodeDictionary.ContainsKey(fileName))
                {
                    continue;
                }
                AbstractProjectBrowserTreeNode parentNode = fileNodeDictionary[fileName];
                pair.Key.Parent.Nodes.Remove(pair.Key);
                if (NodeIsParent(parentNode, pair.Key))
                {
                    // is pair.Key a parent of parentNode?
                    // if yes, we have a parent cycle - break it by adding one node to the directory
                    pair.Key.InsertSorted(this);
                }
                else
                {
                    pair.Key.InsertSorted(parentNode);
                    if (pair.Key.FileNodeStatus != FileNodeStatus.Missing)
                    {
                        pair.Key.FileNodeStatus = FileNodeStatus.BehindFile;
                    }
                }
            }
            base.Initialize();
        }
Ejemplo n.º 9
0
		protected override void Initialize()
		{
			if (removeMe != null) {
				Nodes.Remove(removeMe);
				removeMe = null;
			}
			
			LoggingService.Info("Initialize DirectoryNode " + Directory);
			
			Dictionary<string, FileNode> fileNodeDictionary
				= new Dictionary<string, FileNode>(StringComparer.OrdinalIgnoreCase);
			Dictionary<FileNode, string> dependendFileDictionary = new Dictionary<FileNode, string>();
			Dictionary<string, DirectoryNode> directoryNodeList = new Dictionary<string, DirectoryNode>(StringComparer.OrdinalIgnoreCase);
			
			// Add files found in file system
			
			if (System.IO.Directory.Exists(Directory)) {
				foreach (string subDirectory in System.IO.Directory.GetDirectories(Directory)) {
					if (Path.GetFileName(subDirectory) != ".svn") {
						DirectoryNode newDirectoryNode = DirectoryNodeFactory.CreateDirectoryNode(this, Project, subDirectory);
						newDirectoryNode.InsertSorted(this);
						directoryNodeList[Path.GetFileName(subDirectory)] = newDirectoryNode;
					}
				}
				
				foreach (string file in System.IO.Directory.GetFiles(Directory)) {
					FileNode fileNode = new FileNode(file);
					fileNodeDictionary[Path.GetFileName(file)] = fileNode;
					fileNode.InsertSorted(this);
				}
			}
			if (Nodes.Count == 0) {
				SetClosedImage();
			}
			
			string relativeDirectoryPath = this.RelativePath;
			if (relativeDirectoryPath.Length > 0)
				relativeDirectoryPath = relativeDirectoryPath.Replace('\\', '/') + '/';
			
			// Add project items
			
			foreach (ProjectItem item in Project.Items) {
				if (item.ItemType == ItemType.WebReferenceUrl) {
					DirectoryNode node;
					if (directoryNodeList.TryGetValue(Path.GetFileName(item.FileName), out node)) {
						if (node.FileNodeStatus == FileNodeStatus.None) {
							node.FileNodeStatus = FileNodeStatus.InProject;
						}
						node.ProjectItem = item;
					}
					continue;
				}
				FileProjectItem fileItem = item as FileProjectItem;
				if (fileItem == null)
					continue;
				string virtualName = fileItem.VirtualName.Replace('\\', '/');
				if (virtualName.EndsWith("/"))
					virtualName = virtualName.Substring(0, virtualName.Length - 1);
				string fileName = Path.GetFileName(virtualName);
				if (!string.Equals(virtualName, relativeDirectoryPath + fileName, StringComparison.OrdinalIgnoreCase)) {
					AddParentFolder(virtualName, relativeDirectoryPath, directoryNodeList);
					continue;
				}
				
				if (item.ItemType == ItemType.Folder || item.ItemType == ItemType.WebReferences) {
					DirectoryNode node;
					if (directoryNodeList.TryGetValue(fileName, out node)) {
						if (node.FileNodeStatus == FileNodeStatus.None) {
							node.FileNodeStatus = FileNodeStatus.InProject;
						}
						node.ProjectItem = item;
					} else {
						node = DirectoryNodeFactory.CreateDirectoryNode(item, FileNodeStatus.Missing);
						node.InsertSorted(this);
						directoryNodeList[fileName] = node;
					}
				} else {
					FileNode node;
					if (fileItem.IsLink) {
						node = new FileNode(fileItem.FileName, FileNodeStatus.InProject);
						node.InsertSorted(this);
						fileNodeDictionary[fileName] = node;
					} else {
						if (fileNodeDictionary.TryGetValue(fileName, out node)) {
							if (node.FileNodeStatus == FileNodeStatus.None) {
								node.FileNodeStatus = FileNodeStatus.InProject;
							}
						} else {
							node = new FileNode(fileItem.FileName, FileNodeStatus.Missing);
							node.InsertSorted(this);
							fileNodeDictionary[fileName] = node;
						}
					}
					
					node.ProjectItem = fileItem;
					if (fileItem != null && fileItem.DependentUpon != null && fileItem.DependentUpon.Length > 0) {
						dependendFileDictionary[node] = fileItem.DependentUpon;
					}
				}
			}
			
			// Insert 'code behind files'
			foreach (KeyValuePair<FileNode, string> pair in dependendFileDictionary) {
				string fileName = Path.GetFileName(pair.Value);
				if (!fileNodeDictionary.ContainsKey(fileName)) {
					continue;
				}
				AbstractProjectBrowserTreeNode parentNode = fileNodeDictionary[fileName];
				pair.Key.Parent.Nodes.Remove(pair.Key);
				if (NodeIsParent(parentNode, pair.Key)) {
					// is pair.Key a parent of parentNode?
					// if yes, we have a parent cycle - break it by adding one node to the directory
					pair.Key.InsertSorted(this);
				} else {
					pair.Key.InsertSorted(parentNode);
					if (pair.Key.FileNodeStatus != FileNodeStatus.Missing) {
						pair.Key.FileNodeStatus = FileNodeStatus.BehindFile;
					}
				}
			}
			base.Initialize();
		}
Ejemplo n.º 10
0
 public virtual object Visit(CustomNode customNode, object data)
 {
     customNode.AcceptChildren(this, data);
     return(data);
 }
		public virtual object Visit(CustomNode customNode, object data)
		{
			customNode.AcceptChildren(this, data);
			return data;
		}