/// <summary> /// Creates a new instance of the <see cref="NAntBuildFileTreeNode"/> /// class. /// </summary> /// <param name="buildFile">The <see cref="NAntBuildFile"/> /// associated with this tree node.</param> public NAntBuildFileTreeNode(string projectName, NAntBuildFile buildFile) { this.projectName = projectName; this.buildFile = buildFile; UpdateNode(); }
/// <summary> /// Runs the <see cref="RunSelectedNAntTargetCommand"/>. /// </summary> public override void Run() { try { NAntBuildFile buildFile = NAntPadContent.Instance.SelectedBuildFile; if (buildFile != null) { NAntBuildTarget target = NAntPadContent.Instance.SelectedTarget; string targetName = String.Empty; if (target != null) { targetName = target.Name; } RunPreBuildSteps(); RunBuild(buildFile.FileName, buildFile.Directory, IsActiveConfigurationDebug, targetName, GetPadTextBoxArguments()); } } catch (Exception ex) { MessageService.ShowMessage(ex.Message); } }
void FileRemoved(object sender, FileEventArgs e) { LoggingService.Debug("FileRemoved."); if (NAntBuildFile.IsBuildFile(e.FileName)) { treeView.RemoveBuildFile(e.FileName); } }
bool IsStandaloneNAntBuildFile(string fileName) { if (fileName != null) { return(NAntBuildFile.IsBuildFile(fileName) && !IsInProject(fileName)); } return(false); }
void ProjectItemRemoved(object sender, ProjectItemEventArgs e) { LoggingService.Debug("ProjectItemRemoved."); if (e.ProjectItem.ItemType != ItemType.Folder) { if (NAntBuildFile.IsBuildFile(e.ProjectItem.FileName)) { treeView.RemoveBuildFile(e.ProjectItem.FileName); } } }
/// <summary> /// Adds a build file to the tree. /// </summary> /// <param name="projectName">The name of the project.</param> /// <param name="fileName">The build file name.</param> /// <param name="debug"><see langword="true"/> if the project's /// active configuration is debug; <see langword="false"/> /// otherwise.</param> public void AddBuildFile(string projectName, string fileName) { Debug.Assert(!InvokeRequired, "AddBuildFile InvokeRequired"); if (File.Exists(fileName)) { NAntBuildFile buildFile = new NAntBuildFile(fileName); NAntBuildFileTreeNode node = new NAntBuildFileTreeNode(projectName, buildFile); treeView.Nodes.Add(node); } }
/// <summary> /// Runs the <see cref="OpenNAntBuildFile"/>. /// </summary> public override void Run() { NAntPadTreeView padTreeView = (NAntPadTreeView)Owner; NAntBuildFile buildFile = padTreeView.SelectedBuildFile; if (buildFile != null) { string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); FileService.OpenFile(fileName); } }
/// <summary> /// Runs the <see cref="GoToErrorCommand"/>. /// </summary> public override void Run() { NAntPadTreeView padTreeView = (NAntPadTreeView)Owner; NAntBuildFile buildFile = padTreeView.SelectedBuildFile; if (buildFile != null) { string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); FileService.JumpToFilePosition(fileName, buildFile.Error.Line, buildFile.Error.Column); } }
/// <summary> /// Adds items to the tree view for each build file that exist /// in a project. /// </summary> /// <param name="project">A SharpDevelop project.</param> public void AddProject(IProject project) { Debug.Assert(!InvokeRequired, "AddProject InvokeRequired"); foreach (ProjectItem projectItem in project.Items) { if (NAntBuildFile.IsBuildFile(projectItem.FileName)) { AddBuildFile(project.Name, projectItem.FileName); } } }
/// <summary> /// Updates the build file in the tree view. /// </summary> /// <param name="fileName">The build file name.</param> public void UpdateBuildFile(string fileName) { Debug.Assert(!InvokeRequired, "UpdateBuildFile InvokeRequired"); NAntBuildFileTreeNode node = FindMatchingNode(fileName); if (node != null) { NAntBuildFile buildFile = new NAntBuildFile(fileName); node.BuildFile = buildFile; } else { AddBuildFile(String.Empty, fileName); } }
/// <summary> /// Runs the <see cref="RunSelectedNAntCleanTargetCommand"/>. /// </summary> public override void Run() { try { NAntBuildFile buildFile = NAntPadContent.Instance.SelectedBuildFile; if (buildFile != null) { RunPreBuildSteps(); RunBuild(buildFile.FileName, buildFile.Directory, IsActiveConfigurationDebug, "clean", GetPadTextBoxArguments()); } } catch (Exception ex) { MessageService.ShowMessage(ex.Message); } }
public void ReadFile() { StringReader reader = new StringReader("<project>"); buildFile = new NAntBuildFile(reader); Assert.IsTrue(buildFile.HasError); NAntBuildFileError error = buildFile.Error; Assert.AreEqual("Unexpected end of file has occurred. The following elements are not closed: project. Line 1, position 10.", error.Message, "Error message is incorrect."); Assert.AreEqual(1, error.Line, "Error's line number is incorrect."); Assert.AreEqual(10, error.Column, "Error's column number is incorrect."); }
void FileRenamed(object sender, FileRenameEventArgs e) { if (!e.IsDirectory) { // source and target are populated. if (NAntBuildFile.IsBuildFile(e.SourceFile) && NAntBuildFile.IsBuildFile(e.TargetFile)) { treeView.RenameBuildFile(e.SourceFile, e.TargetFile); } else if (NAntBuildFile.IsBuildFile(e.SourceFile)) { treeView.RemoveBuildFile(e.SourceFile); } else { AddBuildFile(e.TargetFile); } } }
/// <summary> /// Double clicking a node on the tree view opens the corresponding /// file. /// </summary> /// <param name="sender">The event source.</param> /// <param name="e">The event arguments.</param> void TreeViewDoubleClick(object sender, EventArgs e) { NAntBuildFile buildFile = SelectedBuildFile; if (buildFile != null) { string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); if (IsBuildTargetNodeSelected) { FileService.JumpToFilePosition(fileName, SelectedTarget.Line, SelectedTarget.Column); } else if (IsBuildFileErrorNodeSelected) { FileService.JumpToFilePosition(fileName, SelectedError.Line, SelectedError.Column); } else { FileService.OpenFile(fileName); } } }
/// <summary> /// Updates the display since the build file has changed. /// </summary> void SetBuildFile(NAntBuildFile buildFile) { Nodes.Clear(); this.buildFile = buildFile; UpdateNode(); }
public void Init() { StringReader reader = new StringReader(GetBuildFileXml()); buildFile = new NAntBuildFile(reader); }