Пример #1
0
		public ProjectDocument(IManager manager, string fileName, Project project)
			: base(manager, fileName)
		{
			mBaseDirectory = Path.GetDirectoryName(fileName); //System.Windows.Forms.Application.StartupPath;
			mRootItem = new ProjectDocumentItem(this);
			mProject = project;
			mImports = new ListCollection<ProjectDocument>();
		}
Пример #2
0
		void Manager_ProjectOpened(object sender, Project project)
		{
			project.ItemAdded += new ProjectItemAddedHandler(Project_ItemAdded);
			project.ItemRemoved += new ProjectItemRemovedHandler(Project_ItemRemoved);
			project.ItemRenamed += new ProjectItemRenamedHandler(Project_ItemRenamed);
			project.ProjectReloaded += new ProjectReloadedHandler(Project_ProjectReloaded);
		}
Пример #3
0
		void Project_ProjectReloaded(Project sender, ProjectDocumentItem reloadedItem)
		{
			TreeNode node = FindItem(delegate(ProjectItem item) { return item == reloadedItem; });
			if (node != null)
			{
				node.Collapse();
				node.Nodes.Clear();
				UpdateTree(node, reloadedItem);
			}
		}
Пример #4
0
		void Project_ItemRenamed(Project sender, ProjectItem changedItem)
		{
			TreeNode node = FindItem(
				delegate(ProjectItem item)
				{
					return item == changedItem;
				}
			);

			if (node != null)
				UpdateNode(node);
		}
Пример #5
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);
		}
Пример #6
0
		void Manager_ProjectOpened(object sender, Project project)
		{
			UpdateFileList(project);
			project.ItemAdded += new ProjectItemAddedHandler(Project_ItemAdded);
			project.ItemRemoved += new ProjectItemRemovedHandler(Project_ItemRemoved);
			project.ProjectReloaded += new ProjectReloadedHandler(Project_ProjectReloaded);
		}
Пример #7
0
		public bool NewProject(Type projType)
		{
			if (mProject != null && !CloseProject(false))
				return false;

			mProject = (Project)Activator.CreateInstance(projType, new object[] { this });

			try
			{
				// Plugins might fail here
				OnProjectOpened();
				OnPropertyChange(this, "Project", null, mProject);
			}
			catch (System.Exception e)
			{
				DestroyProject();
				throw e;
			}
			return true;
		}
Пример #8
0
		public VCProjectDocument(IManager manager, string fileName, Project project)
			: base(manager, fileName, project)
		{

		}
Пример #9
0
		private void AddFile(Project project, DocumentItem documentItem)
		{
			ListViewItem listItem = new ListViewItem(Path.GetFileName(documentItem.RelativeFileName));
			listItem.Tag = documentItem;
			listItem.SubItems.Add(documentItem.AbsoluteFileName);

			mFileItems.Add(listItem);
		}
Пример #10
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);
			}
		}
Пример #11
0
		private void UpdateFileList(Project project)
		{
			mFileItems.Clear();
			UpdateFileList(project, project.RootItem);

			FilterFileList();
		}
Пример #12
0
		void Project_ProjectReloaded(Project sender, ProjectDocumentItem reloadedItem)
		{
			UpdateFileList(sender);
		}
Пример #13
0
		void Project_ItemAdded(Project sender, ProjectItem addedItem)
		{
			UpdateFileList(sender);
		}
Пример #14
0
		void Project_ItemRemoved(Project sender, ProjectItem removedItem, ProjectItem itemParent)
		{
			UpdateFileList(sender);
		}
Пример #15
0
		void Manager_ProjectOpened(IManager sender, Project project)
		{
			if(Options.LuaSourceSearchPath.Length == 0)
			{
				Options.LuaSourceSearchPath = new string[] { project.RootDocument.BaseDirectory };
			}
		}
Пример #16
0
		void Manager_ProjectOpened(object sender, Project project)
		{
			this.Text = project.ProjectName + " - Tilde";
			tsiFileSaveProject.Enabled = project.Modified;
			sourceControlToolStripMenuItem.Enabled = true;
		}
Пример #17
0
		void Manager_ProjectOpened(object sender, Project project)
		{
			mBookmarkedHosts.Clear();
			string hostString = project.GetUserConfiguration("TCPHosts");
			string[] currHosts = hostString.Split(new char[] { ',' });
			foreach (string hostinfo in currHosts)
			{
				string[] pair = hostinfo.Split(new char[] { ':' });
				if(pair.Length == 2)
					mBookmarkedHosts.Add(new SocketHostInfo(this, pair[0], Int32.Parse(pair[1])));
			}
			mAutoConnectTCPHost = project.GetUserConfiguration("AutoConnectTCPHost");
			if (mAutoConnectTCPHost != "")
			{
				string[] pair = mAutoConnectTCPHost.Split(new char[] { ':' });
				if (pair.Length == 2)
					mDebugger.Connect(new SocketHostInfo(this, pair[0], Int32.Parse(pair[1])));
			}
		}
Пример #18
0
		public bool LoadProject(string fileName)
		{
			if (mProject != null && !CloseProject(false))
				return false;

			Type projType = FindProjectLoader(fileName);

			if (projType == null)
				throw new ApplicationException("Couldn't find loader for project: " + fileName);

			mProject = (Project)Activator.CreateInstance(projType, new object[] { this, fileName });

			if(mProject.VCSType == "")
			{
				if(MessageBoxEx.Show(MainWindow, "Source control has not been configured for this project. Would you like to configure it now?", "Source control configuration", new string [] {"Yes", "No"}, MessageBoxIcon.Question, "Yes" ) == "Yes")
				{
					SourceControlWindow window = new SourceControlWindow(this);
					window.ShowDialog(MainWindow);
				}
			}

			try
			{
				// Plugins might fail here
				OnProjectOpened();
				OnPropertyChange(this, "Project", null, mProject);
			}
			catch (System.Exception e)
			{
				DestroyProject();
				throw e;
			}
			return true;
		}
Пример #19
0
		public ProjectClosingEventArgs(Project project, bool cancelled)
		{
			m_project = project;
			m_cancelled = cancelled;
			m_cancel = false;
		}
Пример #20
0
		private void DestroyProject()
		{
			if (mProject != null)
			{
				mProject = null;
			}
		}
Пример #21
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();
			}
		}