/// <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); } }
public NAntBuildTargetTreeNode(NAntBuildTarget target) { if (target.IsDefault) { this.Text = String.Concat(target.Name, " [default]"); this.ImageIndex = NAntPadTreeViewImageList.DefaultTargetImage; this.SelectedImageIndex = NAntPadTreeViewImageList.DefaultTargetImage; this.ForeColor = Color.Blue; } else { this.Text = target.Name; this.ImageIndex = NAntPadTreeViewImageList.TargetImage; this.SelectedImageIndex = NAntPadTreeViewImageList.TargetImage; } this.target = target; }
/// <summary> /// Runs the <see cref="GoToDefinitionCommand"/>. /// </summary> public override void Run() { NAntPadTreeView padTreeView = (NAntPadTreeView)Owner; NAntBuildFile buildFile = padTreeView.SelectedBuildFile; if (buildFile != null) { NAntBuildTarget target = padTreeView.SelectedTarget; if (target != null) { string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); FileService.JumpToFilePosition(fileName, target.Line, target.Column); } } }
public void Targets() { Assert.AreEqual(3, buildFile.Targets.Count, "Should have 3 targets."); NAntBuildTarget target = buildFile.Targets[0]; Assert.AreEqual("clean", target.Name, "Target name should be 'clean'."); Assert.IsFalse(target.IsDefault, "Clean target should not have default target flag set."); Assert.AreEqual(5, target.Line, "Clean target line number is incorrect."); Assert.AreEqual(6, target.Column, "Clean target column number is incorrect."); target = buildFile.Targets[1]; Assert.IsFalse(target.IsDefault, "Build target should not have default target flag set."); Assert.AreEqual("build", target.Name, "Target name should be 'build'."); Assert.AreEqual(14, target.Line, "Build target line number is incorrect."); Assert.AreEqual(6, target.Column, "Build target column number is incorrect."); target = buildFile.Targets[2]; Assert.AreEqual("test", target.Name, "Target name should be 'test'."); Assert.IsTrue(target.IsDefault, "Test target should have default target flag set."); Assert.AreEqual(32, target.Line, "Test target line number is incorrect."); Assert.AreEqual(6, target.Column, "Test target column number is incorrect."); }
/// <summary> /// Adds a NAnt build target to the tree. /// </summary> /// <param name="node">The parent tree node.</param> /// <param name="target">The NAnt build target.</param> void AddTarget(TreeNode node, NAntBuildTarget target) { NAntBuildTargetTreeNode targetNode = new NAntBuildTargetTreeNode(target); node.Nodes.Add(targetNode); }