예제 #1
0
		void Project_ItemRemoved(Project sender, ProjectItem removedItem, ProjectItem itemParent)
		{
			TreeNode node = FindItem(delegate(ProjectItem item) { return item == removedItem; });
			if (node != null)
				node.Parent.Nodes.Remove(node);
		}
예제 #2
0
		void Project_ItemRenamed(Project sender, ProjectItem changedItem)
		{
			TreeNode node = FindItem(
				delegate(ProjectItem item)
				{
					return item == changedItem;
				}
			);

			if (node != null)
				UpdateNode(node);
		}
예제 #3
0
		public ProjectItem()
		{
			mProjectTag = null;
			mParent = null;
			mItems = new ProjectItemCollection(this);
		}
예제 #4
0
		void Project_ItemAdded(Project sender, ProjectItem addedItem)
		{
			TreeNode parent = FindItem(delegate(ProjectItem item) { return item == addedItem.Parent; });
			if (parent != null)
			{
				TreeNode newNode = CreateNode(addedItem);
				UpdateNodeImage(newNode);
				int index = addedItem.Parent.Items.IndexOf(addedItem);
				parent.Nodes.Insert(index, newNode);
				UpdateTree(newNode, addedItem);
				projectView.SelectedNode = newNode;
				newNode.EnsureVisible();
			}
		}
예제 #5
0
		void Project_ItemRemoved(Project sender, ProjectItem removedItem, ProjectItem itemParent)
		{
			UpdateFileList(sender);
		}
예제 #6
0
파일: Project.cs 프로젝트: zcnet4/lua-tilde
		internal void OnItemRenamed(ProjectItem item)
		{
			if (ItemRenamed != null)
				ItemRenamed(this, item);
		}
예제 #7
0
파일: Project.cs 프로젝트: zcnet4/lua-tilde
		private void AddProjectDocument(ProjectDocument doc, ProjectDocument parentDoc, ProjectItem parentItem)
		{
			doc.PropertyChange += new PropertyChangeEventHandler(ProjectDocument_PropertyChange);
			doc.Loading += new DocumentLoadingEventHandler(ProjectDocument_Loading);
			doc.Loaded += new DocumentLoadedEventHandler(ProjectDocument_Loaded);
			if (parentDoc == null)
				mRootDocument = doc;
			else
				parentDoc.Imports.Add(doc);
			parentItem.Items.Add(doc.Root);
		}
예제 #8
0
		public override void AddDocument(ProjectItem folder, DocumentItem fileItem)
		{
			XmlElement folderElement = (XmlElement)folder.ProjectTag;
			XmlElement fileElement = folderElement.OwnerDocument.CreateElement("File");
			fileElement.SetAttribute("RelativePath", ".\\" + fileItem.RelativeFileName.Replace('/', '\\'));
			fileItem.ProjectTag = fileElement;

			folderElement.AppendChild(fileElement);
		}
예제 #9
0
파일: Project.cs 프로젝트: zcnet4/lua-tilde
		/// <summary>
		/// Creates a DocumentItem node in the project tree.
		/// </summary>
		/// <param name="folder">ProjectItem to insert the document under.</param>
		/// <param name="fileName">Path to file; either absolute or relative to the folder's ProjectDocument.</param>
		/// <param name="fileType"></param>
		/// <returns></returns>
		public DocumentItem AddDocument(ProjectItem folder, string fileName, Type fileType)
		{
			ProjectDocument projDoc = folder.ProjectDocument;

			string normName = PathUtils.NormaliseFileName(fileName, projDoc.BaseDirectory);
			DocumentItem fileItem = new DocumentItem(normName, fileType);

			AddDocument(folder, fileItem);

			return fileItem;
		}
예제 #10
0
파일: Project.cs 프로젝트: zcnet4/lua-tilde
		public void AddDocument(ProjectItem folder, DocumentItem fileItem)
		{
			ProjectDocument projDoc = folder.ProjectDocument;
			if (projDoc.ReadOnly)
				throw new ReadOnlyDocumentException(projDoc);

			// Insert it into the tree
			folder.Items.InsertSorted(fileItem,
				delegate(ProjectItem lhs, ProjectItem rhs)
				{
					string lhsName = lhs is DocumentItem ? (lhs as DocumentItem).RelativeFileName : lhs.Label;
					string rhsName = rhs is DocumentItem ? (rhs as DocumentItem).RelativeFileName : rhs.Label;
					return String.Compare(lhsName, rhsName, true);
				});

			// Add to project file
			projDoc.AddDocument(folder, fileItem);

			projDoc.Modified = true;
		}
예제 #11
0
파일: Project.cs 프로젝트: zcnet4/lua-tilde
		private Folder FindFolderRecursive(ProjectItem root, string label)
		{
			if (root is Folder && ((Folder)root).Label == label)
				return (Folder) root;
			else
			{
				foreach(ProjectItem item in root.Items)
				{
					Folder result = FindFolderRecursive(item, label);
					if (result != null)
						return result;
				}
			}
			return null;
		}
예제 #12
0
		private void UpdateFileList(Project project, ProjectItem root)
		{
			foreach(ProjectItem item in root.Items)
			{
				if(item is DocumentItem)
				{
					AddFile(project, item as DocumentItem);
				}
				UpdateFileList(project, item);
			}
		}
예제 #13
0
		void Project_ItemAdded(Project sender, ProjectItem addedItem)
		{
			UpdateFileList(sender);
		}
예제 #14
0
		private TreeNode CreateNode(ProjectItem item)
		{
			TreeNode node = new TreeNode(item.Label);
			node.Tag = item;
			node.ImageIndex = -1;

			UpdateNode(node);
			return node;
		}
예제 #15
0
파일: Project.cs 프로젝트: zcnet4/lua-tilde
		private void SaveProjectTree(XmlElement rootElement, ProjectItem rootItem)
		{
			foreach (ProjectItem item in rootItem.Items)
			{
				XmlElement element = rootElement.OwnerDocument.CreateElement("Item");
				element.SetAttribute("type", item.GetType().Name);
				rootElement.AppendChild(element);
				SaveProjectTree(element, item);
			}
		}
예제 #16
0
		private void UpdateTree(TreeNode rootnode, ProjectItem rootitem)
		{
			foreach (ProjectItem item in rootitem.Items)
			{
				TreeNode node = CreateNode(item);
				if (rootnode == null)
					projectView.Nodes.Add(node);
				else
					rootnode.Nodes.Add(node);
				UpdateTree(node, item);
			}
		}
예제 #17
0
파일: Project.cs 프로젝트: zcnet4/lua-tilde
		internal void OnItemRemoved(ProjectItem item, ProjectItem parent)
		{
			if (Loading)
				return;

			ProjectDocument projDoc = parent.ProjectDocument;

			if (projDoc != null && projDoc.ReadOnly)
				throw new ReadOnlyDocumentException(projDoc);

			if (ItemRemoved != null)
				ItemRemoved(this, item, parent);

			if (projDoc != null)
				projDoc.Modified = true;
		}
예제 #18
0
		private void LoadFilesFromVCProj(XmlElement rootNode, ProjectItem rootItem)
		{
			foreach (XmlElement element in rootNode.SelectNodes("Filter|File"))
			{
				if (element.Name == "Filter")
				{
					Folder folder = new Folder(element.GetAttribute("Name"));
					folder.ProjectTag = element;
					rootItem.Items.Add(folder);
					LoadFilesFromVCProj(element, folder);
				}
				else if (element.Name == "File")
				{
					string fileName = element.GetAttribute("RelativePath");
					DocumentItem doc = new DocumentItem(PathUtils.NormaliseFileName(fileName, BaseDirectory), Manager.FindFileDocumentType(fileName));
					doc.ProjectTag = element;
					rootItem.Items.Add(doc);
				}
			}
		}
예제 #19
0
		public abstract void AddDocument(ProjectItem folder, DocumentItem doc);