예제 #1
0
        protected override void Initialize()
        {
            Nodes.Clear();

            foreach (object treeObject in folder.Folders)
            {
                if (treeObject is IProject)
                {
                    NodeBuilders.AddProjectNode(this, (IProject)treeObject);
                }
                else if (treeObject is SolutionFolder)
                {
                    SolutionFolderNode folderNode = new SolutionFolderNode(solution, (SolutionFolder)treeObject);
                    folderNode.InsertSorted(this);
                }
                else
                {
                    MessageService.ShowWarning("SolutionFolderNode.Initialize(): unknown tree object : " + treeObject);
                }
            }

            // add solution items (=files) from project sections.
            foreach (SolutionItem item in folder.SolutionItems.Items)
            {
                new SolutionItemNode(Solution, item).InsertSorted(this);
            }
            base.Initialize();
        }
예제 #2
0
        public override void DoDragDrop(IDataObject dataObject, DragDropEffects effect)
        {
            AbstractProjectBrowserTreeNode parentNode = null;

            if (dataObject.GetDataPresent(typeof(SolutionFolderNode)))
            {
                SolutionFolderNode folderNode = (SolutionFolderNode)dataObject.GetData(typeof(SolutionFolderNode));
                parentNode = folderNode.Parent as AbstractProjectBrowserTreeNode;

                folderNode.Remove();
                folderNode.InsertSorted(this);

                SolutionFolderNode.MoveItem(folderNode.Folder, this.solution);
            }
            if (dataObject.GetDataPresent(typeof(ProjectNode)))
            {
                ProjectNode projectNode = (ProjectNode)dataObject.GetData(typeof(ProjectNode));
                parentNode = projectNode.Parent as AbstractProjectBrowserTreeNode;

                projectNode.Remove();
                projectNode.InsertSorted(this);
                projectNode.EnsureVisible();
                SolutionFolderNode.MoveItem(projectNode.Project, this.solution);
            }

            if (parentNode != null)
            {
                parentNode.Refresh();
            }


            solution.Save();
        }
예제 #3
0
파일: SolutionNode.cs 프로젝트: soshan10/AI
        public void AddItem(string fileName)
        {
            string             folderName = ResourceService.GetString("ICSharpCode.SharpDevelop.Commands.ProjectBrowser.SolutionItemsNodeText");
            SolutionFolderNode node       = null;

            foreach (TreeNode n in Nodes)
            {
                node = n as SolutionFolderNode;
                if (node != null && node.Folder.Name == folderName)
                {
                    break;
                }
                node = null;
            }
            if (node == null)
            {
                SolutionFolder newSolutionFolder = solution.CreateFolder(folderName);
                solution.AddFolder(newSolutionFolder);
                solution.Save();

                node = new SolutionFolderNode(solution, newSolutionFolder);
                node.InsertSorted(this);
            }
            node.AddItem(fileName);
        }
예제 #4
0
        protected override void Initialize()
        {
            //Nodes.Clear();
            Items.Clear();

            foreach (var treeObject in folder.Items)
            {
                if (treeObject is IProject)
                {
                    NodeBuilders.AddProjectNode(this, (IProject)treeObject);
                }
                else if (treeObject is ISolutionFolder)
                {
                    SolutionFolderNode folderNode = new SolutionFolderNode((ISolutionFolder)treeObject);
                    folderNode.InsertSorted(this);
                }
                else if (treeObject is ISolutionFileItem)
                {
                    new SolutionItemNode((ISolutionFileItem)treeObject).InsertSorted(this);
                }
                else
                {
                    MessageService.ShowWarning("SolutionFolderNode.Initialize(): unknown tree object : " + treeObject);
                }
            }

            base.Initialize();
        }
예제 #5
0
        public override void DoDragDrop(IDataObject dataObject, DragDropEffects effect)
        {
            if (!isInitialized)
            {
                Initialize();
                isInitialized = true;
            }

            if (dataObject.GetDataPresent(typeof(SolutionFolderNode)))
            {
                SolutionFolderNode             folderNode = (SolutionFolderNode)dataObject.GetData(typeof(SolutionFolderNode));
                AbstractProjectBrowserTreeNode parentNode = folderNode.Parent as AbstractProjectBrowserTreeNode;

                folderNode.Remove();
                folderNode.InsertSorted(this);
                folderNode.EnsureVisible();
                this.folder.AddFolder(folderNode.Folder);
                if (parentNode != null)
                {
                    parentNode.Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(SolutionItemNode)))
            {
                SolutionItemNode solutionItemNode = (SolutionItemNode)dataObject.GetData(typeof(SolutionItemNode));

                ISolutionFolderNode folderNode = (ISolutionFolderNode)solutionItemNode.Parent;
                folderNode.Container.SolutionItems.Items.Remove(solutionItemNode.SolutionItem);
                Container.SolutionItems.Items.Add(solutionItemNode.SolutionItem);

                solutionItemNode.Remove();
                solutionItemNode.InsertSorted(this);
                solutionItemNode.EnsureVisible();
                if (solutionItemNode.Parent != null)
                {
                    ((ExtTreeNode)solutionItemNode.Parent).Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(ProjectNode)))
            {
                ProjectNode projectNode = (ProjectNode)dataObject.GetData(typeof(ProjectNode));

                projectNode.Remove();
                projectNode.InsertSorted(this);
                projectNode.EnsureVisible();
                this.folder.AddFolder(projectNode.Project);

                if (projectNode.Parent != null)
                {
                    ((ExtTreeNode)projectNode.Parent).Refresh();
                }
            }

            solution.Save();
        }
예제 #6
0
        //public override void DoDragDrop(IDataObject dataObject, DragDropEffects effect)
        public virtual void DoDragDrop(IDataObject dataObject, DragDropEffects effect)
        {
            if (!IsInitialized)
            {
                Initialize();
                //isInitialized = true;
            }

            if (dataObject.GetDataPresent(typeof(SolutionFolderNode)))
            {
                SolutionFolderNode             folderNode = (SolutionFolderNode)dataObject.GetData(typeof(SolutionFolderNode));
                AbstractProjectBrowserTreeNode parentNode = folderNode.Parent as AbstractProjectBrowserTreeNode;

                folderNode.Remove();
                folderNode.InsertSorted(this);
                folderNode.EnsureVisible();
                MoveItem(folderNode.Folder, this.folder);

                if (parentNode != null)
                {
                    parentNode.Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(SolutionItemNode)))
            {
                SolutionItemNode solutionItemNode = (SolutionItemNode)dataObject.GetData(typeof(SolutionItemNode));

                MoveItem(solutionItemNode.SolutionItem, this.folder);

                solutionItemNode.Remove();
                solutionItemNode.InsertSorted(this);
                solutionItemNode.EnsureVisible();
                if (solutionItemNode.Parent != null)
                {
                    ((ExtTreeNode)solutionItemNode.Parent).Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(ProjectNode)))
            {
                ProjectNode projectNode = (ProjectNode)dataObject.GetData(typeof(ProjectNode));

                projectNode.Remove();
                projectNode.InsertSorted(this);
                projectNode.EnsureVisible();
                MoveItem(projectNode.Project, this.folder);

                if (projectNode.Parent != null)
                {
                    ((ExtTreeNode)projectNode.Parent).Refresh();
                }
            }

            solution.Save();
        }
예제 #7
0
		protected override void Initialize()
		{
			Nodes.Clear();
			
			foreach (var treeObject in folder.Items) {
				if (treeObject is IProject) {
					NodeBuilders.AddProjectNode(this, (IProject)treeObject);
				} else if (treeObject is ISolutionFolder) {
					SolutionFolderNode folderNode = new SolutionFolderNode((ISolutionFolder)treeObject);
					folderNode.InsertSorted(this);
				} else if (treeObject is ISolutionFileItem) {
					new SolutionItemNode((ISolutionFileItem)treeObject).InsertSorted(this);
				} else {
					MessageService.ShowWarning("SolutionFolderNode.Initialize(): unknown tree object : " + treeObject);
				}
			}
			
			base.Initialize();
		}
예제 #8
0
		public void AddItem(string fileName)
		{
			string folderName = ResourceService.GetString("ICSharpCode.SharpDevelop.Commands.ProjectBrowser.SolutionItemsNodeText");
			SolutionFolderNode node = null;
			foreach (TreeNode n in Nodes) {
				node = n as SolutionFolderNode;
				if (node != null && node.Folder.Name == folderName) {
					break;
				}
				node = null;
			}
			if (node == null) {
				ISolutionFolder newSolutionFolder = solution.CreateFolder(folderName);
				solution.Save();
				
				node = new SolutionFolderNode(newSolutionFolder);
				node.InsertSorted(this);
			}
			node.AddItem(fileName);
		}
예제 #9
0
        public void ViewSolution(ISolution solution)
        {
            AbstractProjectBrowserTreeNode solutionNode = new SolutionNode(solution);

            treeView.Clear();
            solutionNode.AddTo(treeView);

            foreach (var treeObject in solution.Items)
            {
                if (treeObject is IProject)
                {
                    NodeBuilders.AddProjectNode(solutionNode, (IProject)treeObject);
                }
                else
                {
                    SolutionFolderNode folderNode = new SolutionFolderNode((ISolutionFolder)treeObject);
                    folderNode.InsertSorted(solutionNode);
                }
            }

            solutionNode.Expand();
        }
		public void ViewSolution(Solution solution)
		{
			AbstractProjectBrowserTreeNode solutionNode = new SolutionNode(solution);
			treeView.Clear();
			solutionNode.AddTo(treeView);
			
			foreach (object treeObject in solution.Folders) {
				if (treeObject is IProject) {
					NodeBuilders.AddProjectNode(solutionNode, (IProject)treeObject);
				} else {
					SolutionFolderNode folderNode = new SolutionFolderNode(solution, (SolutionFolder)treeObject);
					folderNode.InsertSorted(solutionNode);
				}
			}
			
			solutionNode.Expand();
		}
예제 #11
0
		protected override void Initialize()
		{
			Nodes.Clear();
			
			foreach (object treeObject in folder.Folders) {
				if (treeObject is IProject) {
					NodeBuilders.AddProjectNode(this, (IProject)treeObject);
				} else if (treeObject is SolutionFolder) {
					SolutionFolderNode folderNode = new SolutionFolderNode(solution, (SolutionFolder)treeObject);
					folderNode.InsertSorted(this);
				} else {
					MessageService.ShowWarning("SolutionFolderNode.Initialize(): unknown tree object : " + treeObject);
				}
			}
			
			// add solution items (=files) from project sections.
			foreach (SolutionItem item in folder.SolutionItems.Items) {
				new SolutionItemNode(Solution, item).InsertSorted(this);
			}
			base.Initialize();
		}