diff --git a/data/resources/image/BitmapResources/BitmapResources.res b/data/resources/image/BitmapResources/BitmapResources.res
index 92adc07ee6..c2acad2bb3 100644
--- a/data/resources/image/BitmapResources/BitmapResources.res
+++ b/data/resources/image/BitmapResources/BitmapResources.res
@@ -445,7 +445,6 @@ Icons.32x32.TextFileIcon = backendicons\miscFiles\Icons
Icons.32x32.EmptyProjectIcon = backendicons\miscFiles\Icons.32x32.EmptyProjectIcon.png
Icons.32x32.CombineIcon = backendicons\miscFiles\Icons.32x32.CombineIcon.png
Icons.32x32.ResourceFileIcon = backendicons\miscFiles\Icons.32x32.ResourceFileIcon.png
-Icons.32x32.NAntBuildFileIcon = backendicons\miscFiles\Icons.32x32.NAntBuildFileIcon.png
Icons.16x16.AddInIcon = backendicons\miscFiles\AddIn16.png
Icons.32x32.AddInIcon = backendicons\miscFiles\AddIn32.png
@@ -469,17 +468,6 @@ HtmlHelp2.16x16.Search = PadIcons\HtmlHelp2.16x16.Search.png
HtmlHelp2.16x16.SearchResults = PadIcons\HtmlHelp2.16x16.SearchResults.png
HtmlHelp2.16x16.Toc = PadIcons\HtmlHelp2.16x16.Toc.png
-NAntAddIn.Icons.16x16.BuildFile = NAntIcons\NAntAddIn.Icons.16x16.BuildFile.png
-NAntAddIn.Icons.16x16.BuildFileError = NAntIcons\NAntAddIn.Icons.16x16.BuildFileError.png
-NAntAddIn.Icons.16x16.BuildTarget = NAntIcons\NAntAddIn.Icons.16x16.BuildTarget.png
-NAntAddIn.Icons.16x16.BuildTargetError = NAntIcons\NAntAddIn.Icons.16x16.BuildTargetError.png
-NAntAddIn.Icons.16x16.DefaultBuildTarget = NAntIcons\NAntAddIn.Icons.16x16.DefaultBuildTarget.png
-NAntAddIn.Icons.16x16.NAntPad = NAntIcons\NAntAddIn.Icons.16x16.NAntPad.png
-NAntAddIn.Icons.16x16.NewBuildFile = NAntIcons\NAntAddIn.Icons.16x16.NewBuildFile.png
-NAntAddIn.Icons.16x16.RunNAnt = NAntIcons\NAntAddIn.Icons.16x16.RunNAnt.png
-NAntAddIn.Icons.16x16.RunNAntClean = NAntIcons\NAntAddIn.Icons.16x16.RunNAntClean.png
-NAntAddIn.Icons.16x16.StopNAnt = NAntIcons\NAntAddIn.Icons.16x16.StopNAnt.png
-
CodeCoverage.Icons.16x16.Pad = CodeCoverageIcons\CodeCoverage.Icons.16x16.Pad.png
CodeCoverage.Icons.16x16.File = CodeCoverageIcons\CodeCoverage.Icons.16x16.File.png
CodeCoverage.Icons.16x16.Run = CodeCoverageIcons\CodeCoverage.Icons.16x16.Run.png
@@ -500,3 +488,6 @@ Icons.16x16.NavigateForward = NavigationIcons\Icons.16x16.NavigateF
#Setup icons (Wix)
Setup.Icons.16x16.SetupDialogsPad = SetupIcons\Setup.Icons.16x16.SetupDialogsPad.png
Setup.Icons.16x16.Component = SetupIcons\Setup.Icons.16x16.Component.png
+
+#Server Tools
+ServerTool.Server = ServerTool\server.png
\ No newline at end of file
diff --git a/samples/NAnt/NAnt.AddIn.Tests/AssemblyInfo.cs b/samples/NAnt/NAnt.AddIn.Tests/AssemblyInfo.cs
new file mode 100644
index 0000000000..92d12a843a
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/AssemblyInfo.cs
@@ -0,0 +1,32 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("2.0.0.1")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
diff --git a/samples/NAnt/NAnt.AddIn.Tests/CscNAntOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/CscNAntOutputTestFixture.cs
new file mode 100644
index 0000000000..195447725a
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/CscNAntOutputTestFixture.cs
@@ -0,0 +1,122 @@
+using System;
+using ICSharpCode.SharpDevelop;
+using NUnit.Framework;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests that C# compiler errors/warnings are located in the NAnt console
+ /// output.
+ ///
+ [TestFixture]
+ public class CscNAntOutputTestFixture
+ {
+ [Test]
+ public void ParseError085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntCscErrorOutput());
+
+ Assert.AreEqual(3, tasks.Count, "Should be three tasks.");
+
+ // First task.
+ Task task = tasks[0];
+ Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(33, task.Line, "Task line is incorrect.");
+ Assert.AreEqual(3, task.Column, "Task column is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task.");
+ Assert.AreEqual(@"Invalid expression term '/' (CS1525)",
+ task.Description,
+ "Task description is wrong.");
+
+ // Second task.
+ task = tasks[1];
+ Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(33, task.Line, "Task line is incorrect.");
+ Assert.AreEqual(4, task.Column, "Task column is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task.");
+ Assert.AreEqual(@"; expected (CS1002)",
+ task.Description,
+ "Task description is wrong.");
+
+ // Last task task.
+ task = tasks[2];
+ Assert.AreEqual(@"C:\Projects\dotnet\Test\corsavytest\corsavytest.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(47, task.Line, "Task line is incorrect.");
+ Assert.AreEqual(5, task.Column, "Task column is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task.");
+ Assert.AreEqual(@"External Program Failed: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.exe (return code was 1)",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ [Test]
+ public void ParseWarning085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntCscWarningOutput());
+
+ Assert.AreEqual(1, tasks.Count, "Should be three tasks.");
+
+ // First task.
+ Task task = tasks[0];
+ Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(38, task.Line, "Task line is incorrect.");
+ Assert.AreEqual(11, task.Column, "Task column is incorrect.");
+ Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be error task.");
+ Assert.AreEqual(@"The variable 'Test' is assigned but its value is never used (CS0219)",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+
+ string GetNAntCscErrorOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" +
+ "Target(s) specified: build \r\n" +
+ "\r\n" +
+ "\r\n" +
+ "init.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "gacreferences.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "build.debug:\r\n" +
+ "\r\n" +
+ " [csc] Compiling 3 files to 'C:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.exe'.\r\n" +
+ " [csc] c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs(34,4): error CS1525: Invalid expression term '/'\r\n" +
+ " [csc] c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs(34,5): error CS1002: ; expected\r\n" +
+ "\r\n" +
+ "BUILD FAILED\r\n" +
+ "\r\n" +
+ "C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(48,6):\r\n" +
+ "External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\csc.exe (return code was 1)\r\n" +
+ "\r\n" +
+ "Total time: 0.5 seconds.";
+ }
+
+ string GetNAntCscWarningOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" +
+ "Target(s) specified: build \r\n" +
+ "\r\n" +
+ "\r\n" +
+ "init.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "gacreferences.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "build.debug:\r\n" +
+ "\r\n" +
+ " [csc] Compiling 3 files to 'C:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.exe'.\r\n" +
+ " [csc] c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs(39,12): warning CS0219: The variable 'Test' is assigned but its value is never used\r\n" +
+ "\r\n" +
+ "build:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "BUILD SUCCEEDED\r\n" +
+ "\r\n" +
+ "Total time: 0.4 seconds.";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/FatalErrorNAntOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/FatalErrorNAntOutputTestFixture.cs
new file mode 100644
index 0000000000..43d047634c
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/FatalErrorNAntOutputTestFixture.cs
@@ -0,0 +1,133 @@
+using NUnit.Framework;
+using ICSharpCode.NAnt;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop;
+using System;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests that fatal errors are parsed correctly.
+ ///
+ [TestFixture]
+ public class FatalErrorNAntOutputTestFixture
+ {
+ [Test]
+ public void ParseCscError085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntCscOutput());
+
+ Assert.AreEqual(2, tasks.Count, "Should be two tasks.");
+
+ Task task = tasks[0];
+
+ Assert.AreEqual(String.Empty, task.FileName, "Task filename should be blank.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(0, task.Line, "Should be line number 0.");
+ Assert.AreEqual(0, task.Column, "Should be col number 0");
+ Assert.AreEqual("fatal error CS0042: Unexpected error creating debug information file 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.PDB' -- 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.pdb: The process cannot access the file because it is being used by another process.",
+ task.Description,
+ "Task description is wrong.");
+
+ task = tasks[1];
+ Assert.AreEqual("C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(47, task.Line, "Incorrect line number.");
+ Assert.AreEqual(5, task.Column, "Incorrect col number.");
+ Assert.AreEqual("External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\csc.exe (return code was 1)",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ [Test]
+ public void ParseVBError085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntVBOutput());
+
+ Assert.AreEqual(3, tasks.Count, "Should be three tasks.");
+
+ Task task = tasks[0];
+
+ Assert.AreEqual(String.Empty, task.FileName, "Task filename should be blank.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(0, task.Line, "Should be line number 0.");
+ Assert.AreEqual(0, task.Column, "Should be col number 0");
+ Assert.AreEqual("Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe': The process cannot access the file because it is being used by another process. (BC31019)",
+ task.Description,
+ "Task description is wrong.");
+
+ task = tasks[1];
+ Assert.AreEqual(String.Empty, task.FileName, "Task filename should be blank.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(0, task.Line, "Should be line number 0.");
+ Assert.AreEqual(0, task.Column, "Should be col number 0");
+ Assert.AreEqual("Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.pdb': Access is denied. (BC31019)",
+ task.Description,
+ "Task description is wrong.");
+
+ task = tasks[2];
+ Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(47, task.Line, "Incorrect line number.");
+ Assert.AreEqual(5, task.Column, "Incorrect col number.");
+ Assert.AreEqual("External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ string GetNAntCscOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" +
+ "Target(s) specified: build \r\n" +
+ "\r\n" +
+ "\r\n" +
+ "init.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "gacreferences.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "build.debug:\r\n" +
+ "\r\n" +
+ " [csc] Compiling 3 files to 'C:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.exe'.\r\n" +
+ " [csc] fatal error CS0042: Unexpected error creating debug information file 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.PDB' -- 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.pdb: The process cannot access the file because it is being used by another process.\r\n" +
+ " [csc] \r\n" +
+ " [csc] \r\n" +
+ "\r\n" +
+ "BUILD FAILED\r\n" +
+ "\r\n" +
+ "C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(48,6):\r\n" +
+ "External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\csc.exe (return code was 1)\r\n" +
+ "\r\n" +
+ "Total time: 0.3 seconds.\r\n" +
+ "";
+ }
+
+ string GetNAntVBOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/test/corsavyvbtest/corsavyvbtest.build\r\n" +
+ "Target(s) specified: build \r\n" +
+ "\r\n" +
+ "\r\n" +
+ "init.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "gacreferences.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "build.debug:\r\n" +
+ "\r\n" +
+ " [vbc] Compiling 2 files to 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe'.\r\n" +
+ " [vbc] vbc : error BC31019: Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe': The process cannot access the file because it is being used by another process. \r\n" +
+ " [vbc] vbc : error BC31019: Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.pdb': Access is denied. \r\n" +
+ "\r\n" +
+ "BUILD FAILED - 0 non-fatal error(s), 1 warning(s)\r\n" +
+ "\r\n" +
+ "C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build(48,6):\r\n" +
+ "External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)\r\n" +
+ "\r\n" +
+ "Total time: 0.4 seconds.\r\n" +
+ "";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/InvalidNAntBuildFileTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/InvalidNAntBuildFileTestFixture.cs
new file mode 100644
index 0000000000..dc425aedad
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/InvalidNAntBuildFileTestFixture.cs
@@ -0,0 +1,35 @@
+using ICSharpCode.NAnt;
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Xml;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests the class.
+ ///
+ [TestFixture]
+ public class InvalidNAntBuildFileTestFixture
+ {
+ NAntBuildFile buildFile;
+
+ [Test]
+ public void ReadFile()
+ {
+ StringReader reader = new StringReader("");
+ 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(0, error.Line, "Error's line number is incorrect.");
+ Assert.AreEqual(9, error.Column, "Error's column number is incorrect.");
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/InvalidXmlNAntOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/InvalidXmlNAntOutputTestFixture.cs
new file mode 100644
index 0000000000..c9c8028f43
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/InvalidXmlNAntOutputTestFixture.cs
@@ -0,0 +1,49 @@
+using System;
+using ICSharpCode.SharpDevelop;
+using NUnit.Framework;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests that the NAnt text output indicating the build file xml is
+ /// invalid is parsed correctly.
+ [TestFixture]
+ public class InvalidXmlNAntOutputTestFixture
+ {
+ [Test]
+ public void Parse085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput());
+
+ Assert.AreEqual(1, tasks.Count, "Should be one task.");
+
+ Task task = tasks[0];
+ Assert.AreEqual(@"C:\Projects\foo\foo.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(6, task.Line, "Task line is incorrect.");
+ Assert.AreEqual(4, task.Column, "Task column is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task.");
+ string description = "Error loading buildfile.\r\n The 'ifnot1' start tag on line '5' doesn't match the end tag of 'ifnot' in file 'file:///C:/Projects/foo/foo.build'. Line 7, position 5.";
+
+ Assert.AreEqual(description,
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ ///
+ /// Gets NAnt output for an invalid xml in a 0.85 build file.
+ string GetNAntOutput()
+ {
+ return "\r\n" +
+ "BUILD FAILED\r\n" +
+ "\r\n" +
+ "C:\\Projects\\foo\\foo.build(7,5):\r\n" +
+ "Error loading buildfile.\r\n" +
+ " The 'ifnot1' start tag on line '5' doesn't match the end tag of 'ifnot' in file 'file:///C:/Projects/foo/foo.build'. Line 7, position 5.\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "For more information regarding the cause of the build failure, run the build again in debug mode.\r\n" +
+ "\r\n" +
+ "Try 'nant -help' for more information";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/NAnt.AddIn.Tests.csproj b/samples/NAnt/NAnt.AddIn.Tests/NAnt.AddIn.Tests.csproj
new file mode 100644
index 0000000000..fca1492f20
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/NAnt.AddIn.Tests.csproj
@@ -0,0 +1,81 @@
+
+
+ Debug
+ AnyCPU
+ 2.0
+ {13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}
+ NAnt.AddIn.Tests
+ NAnt.AddIn.Tests
+ Library
+ 4
+ False
+ False
+ OnSuccessfulBuild
+ Full
+ False
+ Auto
+ 4194304
+ AnyCPU
+ 4096
+ bin\
+ true
+ False
+ v3.5
+
+
+ False
+ True
+ false
+
+
+ False
+ False
+ false
+
+
+
+ ..\..\..\bin\ICSharpCode.Core.dll
+
+
+ ..\..\..\bin\ICSharpCode.SharpDevelop.dll
+
+
+ ..\..\..\bin\Tools\NUnit\nunit.framework.dll
+
+
+
+ 3.5
+
+
+
+ 3.5
+
+
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}
+ NAnt.AddIn
+
+
+
+
\ No newline at end of file
diff --git a/samples/NAnt/NAnt.AddIn.Tests/NAntErrorAndWarningOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/NAntErrorAndWarningOutputTestFixture.cs
new file mode 100644
index 0000000000..0817b6d33a
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/NAntErrorAndWarningOutputTestFixture.cs
@@ -0,0 +1,64 @@
+using System;
+using ICSharpCode.SharpDevelop;
+using NUnit.Framework;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests that the NAnt errors and warnings are parsed correctly.
+ ///
+ [TestFixture]
+ public class NAntErrorAndWarningOutputTestFixture
+ {
+ [Test]
+ public void Parse085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput());
+
+ Assert.AreEqual(2, tasks.Count, "Should be two tasks.");
+
+ Task task = tasks[0];
+ Assert.AreEqual("C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be a warning task.");
+ Assert.AreEqual(4, task.Line, "Incorrect line number.");
+ Assert.AreEqual(3, task.Column, "Incorrect col number.");
+ Assert.AreEqual("Attribute 'propertyexists' for is deprecated. Use instead.",
+ task.Description,
+ "Task description is wrong.");
+
+ task = tasks[1];
+ Assert.AreEqual("C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(47, task.Line, "Incorrect line number.");
+ Assert.AreEqual(5, task.Column, "Incorrect col number.");
+ Assert.AreEqual("An empty string is not a valid value for attribute 'win32icon' of .",
+ task.Description,
+ "Task description is wrong.");
+
+ }
+
+ string GetNAntOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" +
+ "Target(s) specified: build \r\n" +
+ "\r\n" +
+ " [ifnot] C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(5,4): Attribute 'propertyexists' for is deprecated. Use instead.\r\n" +
+ "\r\n" +
+ "init.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "gacreferences.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "build.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "BUILD FAILED - 0 non-fatal error(s), 1 warning(s)\r\n" +
+ "\r\n" +
+ "C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(48,6):\r\n" +
+ "An empty string is not a valid value for attribute 'win32icon' of .\r\n" +
+ "\r\n" +
+ "Total time: 0.1 seconds.";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/NonFatalErrorNAntOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/NonFatalErrorNAntOutputTestFixture.cs
new file mode 100644
index 0000000000..ec1aa143f6
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/NonFatalErrorNAntOutputTestFixture.cs
@@ -0,0 +1,50 @@
+using NUnit.Framework;
+using ICSharpCode.NAnt;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop;
+using System;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ [TestFixture]
+ public class NonFatalErrorNAntOutputTestFixture
+ {
+ [Test]
+ public void Parse085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput());
+
+ Assert.AreEqual(1, tasks.Count, "Should be one task.");
+
+ Task task = tasks[0];
+
+ Assert.AreEqual("C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\src\\StandardAddIn.include", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be a warning task.");
+ Assert.AreEqual(93, task.Line, "Incorrect line number.");
+ Assert.AreEqual(4, task.Column, "Incorrect col number.");
+ Assert.AreEqual("Cannot delete directory 'C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\AddIns\\AddIns\\Misc\\Debugger.AddIn'. The directory does not exist.",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ string GetNAntOutput()
+ {
+ return "[nant] C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\src\\AddIns\\Misc\\Debugger\\Debugger.Core\\Debugger.Core.build clean\r\n" +
+ " Buildfile: file:///C:/Projects/dotnet/Corsavy/SharpDevelop/src/AddIns/Misc/Debugger/Debugger.Core/Debugger.Core.build\r\n" +
+ " Target(s) specified: clean \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " clean:\r\n" +
+ " \r\n" +
+ " \r\n" +
+ " SetProperties:\r\n" +
+ " \r\n" +
+ " [delete] C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\src\\StandardAddIn.include(94,5):\r\n" +
+ " [delete] Cannot delete directory 'C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\AddIns\\AddIns\\Misc\\Debugger.AddIn'. The directory does not exist.\r\n" +
+ " \r\n" +
+ " BUILD SUCCEEDED - 1 non-fatal error(s), 0 warning(s)\r\n" +
+ " \r\n" +
+ " Total time: 0.3 seconds.";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/ReadNAntBuildFileTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/ReadNAntBuildFileTestFixture.cs
new file mode 100644
index 0000000000..80c8d8d550
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/ReadNAntBuildFileTestFixture.cs
@@ -0,0 +1,106 @@
+using ICSharpCode.NAnt;
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests the class.
+ ///
+ [TestFixture]
+ public class ReadNAntBuildFileTestFixture
+ {
+ NAntBuildFile buildFile;
+
+ [SetUp]
+ public void Init()
+ {
+ StringReader reader = new StringReader(GetBuildFileXml());
+ buildFile = new NAntBuildFile(reader);
+ }
+
+ [Test]
+ public void ProjectName()
+ {
+ Assert.AreEqual("Hello World", buildFile.Name, "Project name is wrong.");
+ }
+
+ [Test]
+ public void DefaultTarget()
+ {
+ // Check the name.
+ Assert.IsNotNull(buildFile.DefaultTarget, "Should have a default target.");
+ Assert.AreEqual("test", buildFile.DefaultTarget.Name, "Default target read from build file is wrong.");
+ }
+
+ [Test]
+ 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(4, target.Line, "Clean target line number is incorrect.");
+ Assert.AreEqual(5, 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(13, target.Line, "Build target line number is incorrect.");
+ Assert.AreEqual(5, 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(31, target.Line, "Test target line number is incorrect.");
+ Assert.AreEqual(5, target.Column, "Test target column number is incorrect.");
+ }
+
+ ///
+ /// Gets the build file xml that will be used in this
+ /// test fixture.
+ ///
+ string GetBuildFileXml()
+ {
+ return "\r\n" +
+ " \r\n" +
+ " \r\n" +
+ "\r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ "\r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ "\r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ "";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/ReadOnlyPropertyNAntOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/ReadOnlyPropertyNAntOutputTestFixture.cs
new file mode 100644
index 0000000000..3ec5eb006e
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/ReadOnlyPropertyNAntOutputTestFixture.cs
@@ -0,0 +1,41 @@
+using System;
+using ICSharpCode.SharpDevelop;
+using NUnit.Framework;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ [TestFixture]
+ public class ReadOnlyPropertyNAntOutputTestFixture
+ {
+ [Test]
+ public void Parse085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput());
+
+ Assert.AreEqual(1, tasks.Count, "Should be one task.");
+
+ Task task = tasks[0];
+
+ Assert.AreEqual(String.Empty, task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be a warning task.");
+ Assert.AreEqual(0, task.Line, "Incorrect line number.");
+ Assert.AreEqual(0, task.Column, "Incorrect col number.");
+ Assert.AreEqual("Read-only property \"debug\" cannot be overwritten.",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ string GetNAntOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/Corsavy/SharpDevelop/src/SharpDevelop.build\r\n" +
+ "Target(s) specified: clean \r\n" +
+ "\r\n" +
+ " [property] Read-only property \"debug\" cannot be overwritten.\r\n" +
+ "\r\n" +
+ "clean:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "CallBuildfiles";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/TargetDoesNotExistNAntOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/TargetDoesNotExistNAntOutputTestFixture.cs
new file mode 100644
index 0000000000..26b78c06d0
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/TargetDoesNotExistNAntOutputTestFixture.cs
@@ -0,0 +1,44 @@
+using System;
+using ICSharpCode.SharpDevelop;
+using NUnit.Framework;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests that the "Target 'foo' does not exist" error is handled.
+ ///
+ [TestFixture]
+ public class TargetDoesNotExistNAntOutputTestFixture
+ {
+ [Test]
+ public void Parse085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput());
+
+ Assert.AreEqual(1, tasks.Count, "Should be one task.");
+
+ Task task = tasks[0];
+ Assert.AreEqual(String.Empty, task.FileName, "Should not have any filename information.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(0, task.Line, "Should be line number 0");
+ Assert.AreEqual(0, task.Column, "Should be col number 0");
+ Assert.AreEqual("Target 'abuild' does not exist in this project.",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ string GetNAntOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" +
+ "Target(s) specified: abuild \r\n" +
+ "\r\n" +
+ "\r\n" +
+ "BUILD FAILED\r\n" +
+ "\r\n" +
+ "Target 'abuild' does not exist in this project.\r\n" +
+ "\r\n" +
+ "Total time: 0.1 seconds.\r\n" +
+ "";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.Tests/VBErrorNAntOutputTestFixture.cs b/samples/NAnt/NAnt.AddIn.Tests/VBErrorNAntOutputTestFixture.cs
new file mode 100644
index 0000000000..bbd4842f66
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.Tests/VBErrorNAntOutputTestFixture.cs
@@ -0,0 +1,81 @@
+using NUnit.Framework;
+using ICSharpCode.NAnt;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop;
+using System;
+
+namespace ICSharpCode.NAnt.Tests
+{
+ ///
+ /// Tests that VB errors are parsed correctly.
+ ///
+ [TestFixture]
+ public class VBErrorNAntOutputTestFixture
+ {
+ [Test]
+ public void Parse085()
+ {
+ TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput());
+
+ Assert.AreEqual(3, tasks.Count, "Should be three tasks.");
+
+ Task task = tasks[0];
+
+ Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be a warning task.");
+ Assert.AreEqual(47, task.Line, "Incorrect line number.");
+ Assert.AreEqual(5, task.Column, "Incorrect col number.");
+ Assert.AreEqual("Attribute 'imports' for is deprecated. Use the element instead.",
+ task.Description,
+ "Task description is wrong.");
+
+ task = tasks[1];
+ Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\MainForm.vb", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(13, task.Line, "Incorrect line number.");
+ Assert.AreEqual(0, task.Column, "Should be col number 0");
+ Assert.AreEqual("Syntax error. (BC30035)",
+ task.Description,
+ "Task description is wrong.");
+
+ task = tasks[2];
+ Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build", task.FileName, "Task filename is incorrect.");
+ Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task.");
+ Assert.AreEqual(47, task.Line, "Incorrect line number.");
+ Assert.AreEqual(5, task.Column, "Incorrect col number.");
+ Assert.AreEqual("External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)",
+ task.Description,
+ "Task description is wrong.");
+ }
+
+ string GetNAntOutput()
+ {
+ return "Buildfile: file:///C:/Projects/dotnet/test/corsavyvbtest/corsavyvbtest.build\r\n" +
+ "Target(s) specified: build \r\n" +
+ "\r\n" +
+ "\r\n" +
+ "init.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "gacreferences.debug:\r\n" +
+ "\r\n" +
+ "\r\n" +
+ "build.debug:\r\n" +
+ "\r\n" +
+ " [vbc] C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build(48,6): Attribute 'imports' for is deprecated. Use the element instead.\r\n" +
+ " [vbc] Compiling 2 files to 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe'.\r\n" +
+ " [vbc] C:\\Projects\\dotnet\\test\\corsavyvbtest\\MainForm.vb(14) : error BC30035: Syntax error.\r\n" +
+ " [vbc] \r\n" +
+ " [vbc] /\r\n" +
+ " [vbc] ~\r\n" +
+ "\r\n" +
+ "BUILD FAILED - 0 non-fatal error(s), 1 warning(s)\r\n" +
+ "\r\n" +
+ "C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build(48,6):\r\n" +
+ "External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)\r\n" +
+ "\r\n" +
+ "Total time: 0.3 seconds.\r\n" +
+ "\r\n";
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn.sln b/samples/NAnt/NAnt.AddIn.sln
new file mode 100644
index 0000000000..938c412492
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn.sln
@@ -0,0 +1,24 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+# SharpDevelop 3.0.0.2745
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAnt.AddIn", "NAnt.AddIn\NAnt.AddIn.csproj", "{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAnt.AddIn.Tests", "NAnt.AddIn.Tests\NAnt.AddIn.Tests.csproj", "{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/samples/NAnt/NAnt.AddIn/Configuration/AssemblyInfo.cs b/samples/NAnt/NAnt.AddIn/Configuration/AssemblyInfo.cs
new file mode 100644
index 0000000000..1c656af21a
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Configuration/AssemblyInfo.cs
@@ -0,0 +1,25 @@
+using System.Reflection;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("NAnt.AddIn")]
+[assembly: AssemblyDescription("NAnt AddIn for SharpDevelop")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SharpDevelop")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
diff --git a/samples/NAnt/NAnt.AddIn/Icons/BitmapResources.res b/samples/NAnt/NAnt.AddIn/Icons/BitmapResources.res
new file mode 100644
index 0000000000..31938dd3be
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Icons/BitmapResources.res
@@ -0,0 +1,11 @@
+NAnt.AddIn.Icons.32x32.NAntBuildFileIcon = NAnt.AddIn.Icons.32x32.NAntBuildFileIcon.png
+NAnt.AddIn.Icons.16x16.BuildFile = NAnt.AddIn.Icons.16x16.BuildFile.png
+NAnt.AddIn.Icons.16x16.BuildFileError = NAnt.AddIn.Icons.16x16.BuildFileError.png
+NAnt.AddIn.Icons.16x16.BuildTarget = NAnt.AddIn.Icons.16x16.BuildTarget.png
+NAnt.AddIn.Icons.16x16.BuildTargetError = NAnt.AddIn.Icons.16x16.BuildTargetError.png
+NAnt.AddIn.Icons.16x16.DefaultBuildTarget = NAnt.AddIn.Icons.16x16.DefaultBuildTarget.png
+NAnt.AddIn.Icons.16x16.NAntPad = NAnt.AddIn.Icons.16x16.NAntPad.png
+NAnt.AddIn.Icons.16x16.NewBuildFile = NAnt.AddIn.Icons.16x16.NewBuildFile.png
+NAnt.AddIn.Icons.16x16.RunNAnt = NAnt.AddIn.Icons.16x16.RunNAnt.png
+NAnt.AddIn.Icons.16x16.RunNAntClean = NAnt.AddIn.Icons.16x16.RunNAntClean.png
+NAnt.AddIn.Icons.16x16.StopNAnt = NAnt.AddIn.Icons.16x16.StopNAnt.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildFile.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildFile.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildFile.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildFile.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildFileError.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildFileError.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildFileError.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildFileError.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildTarget.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildTarget.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildTarget.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildTarget.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildTargetError.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildTargetError.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.BuildTargetError.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.BuildTargetError.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.DefaultBuildTarget.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.DefaultBuildTarget.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.DefaultBuildTarget.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.DefaultBuildTarget.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.NAntPad.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.NAntPad.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.NAntPad.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.NAntPad.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.NewBuildFile.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.NewBuildFile.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.NewBuildFile.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.NewBuildFile.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.RunNAnt.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.RunNAnt.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.RunNAnt.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.RunNAnt.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.RunNAntClean.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.RunNAntClean.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.RunNAntClean.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.RunNAntClean.png
diff --git a/data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.StopNAnt.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.StopNAnt.png
similarity index 100%
rename from data/resources/image/BitmapResources/NAntIcons/NAntAddIn.Icons.16x16.StopNAnt.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.16x16.StopNAnt.png
diff --git a/data/resources/image/BitmapResources/backendicons/miscFiles/Icons.32x32.NAntBuildFileIcon.png b/samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.32x32.NAntBuildFileIcon.png
similarity index 100%
rename from data/resources/image/BitmapResources/backendicons/miscFiles/Icons.32x32.NAntBuildFileIcon.png
rename to samples/NAnt/NAnt.AddIn/Icons/NAnt.AddIn.Icons.32x32.NAntBuildFileIcon.png
diff --git a/samples/NAnt/NAnt.AddIn/Icons/build.bat b/samples/NAnt/NAnt.AddIn/Icons/build.bat
new file mode 100644
index 0000000000..c9a9fa8224
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Icons/build.bat
@@ -0,0 +1,3 @@
+..\..\..\..\..\SharpDevelopResources\BitmapResources\resasm BitmapResources.res
+move BitmapResources.resources ..\Resources\BitmapResources.resources
+pause
\ No newline at end of file
diff --git a/samples/NAnt/NAnt.AddIn/NAnt.AddIn.csproj b/samples/NAnt/NAnt.AddIn/NAnt.AddIn.csproj
new file mode 100644
index 0000000000..2deb7cbc9a
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/NAnt.AddIn.csproj
@@ -0,0 +1,103 @@
+
+
+ Debug
+ AnyCPU
+ 2.0
+ {1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}
+ ICSharpCode.NAnt
+ NAnt.AddIn
+ Library
+ 4
+ False
+ False
+ Full
+ False
+ Auto
+ 121634816
+ AnyCPU
+ 4096
+ true
+ v3.5
+
+
+ False
+ False
+ True
+ ..\..\..\AddIns\Samples\NAnt.AddIn
+ false
+
+
+ True
+ False
+ False
+ ..\..\..\AddIns\Samples\NAnt.AddIn
+ false
+
+
+
+ ..\..\..\bin\ICSharpCode.Core.dll
+ False
+
+
+ ..\..\..\bin\ICSharpCode.SharpDevelop.dll
+ False
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Always
+
+
+
+
+ Always
+
+
+ Always
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/NAnt/NAnt.AddIn/NAnt.addin b/samples/NAnt/NAnt.AddIn/NAnt.addin
new file mode 100644
index 0000000000..3207852729
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/NAnt.addin
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/NAnt/NAnt.AddIn/Resources/BitmapResources.resources b/samples/NAnt/NAnt.AddIn/Resources/BitmapResources.resources
new file mode 100644
index 0000000000..8967f82c30
Binary files /dev/null and b/samples/NAnt/NAnt.AddIn/Resources/BitmapResources.resources differ
diff --git a/samples/NAnt/NAnt.AddIn/Resources/NAntAddInOptionPanel.xfrm b/samples/NAnt/NAnt.AddIn/Resources/NAntAddInOptionPanel.xfrm
new file mode 100644
index 0000000000..9c26db01a8
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Resources/NAntAddInOptionPanel.xfrm
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/NAnt/NAnt.AddIn/Src/AddInOptions.cs b/samples/NAnt/NAnt.AddIn/Src/AddInOptions.cs
new file mode 100644
index 0000000000..d1639530d7
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/AddInOptions.cs
@@ -0,0 +1,153 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Diagnostics;
+using ICSharpCode.Core;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// The NAnt add-in options.
+ ///
+ public class AddInOptions
+ {
+ public static readonly string OptionsProperty = "NAntAddIn.Options";
+
+ #region Property names
+ public static readonly string NAntFileNameProperty = "NAntFileName";
+ public static readonly string NAntArgumentsProperty = "NAntArguments";
+ public static readonly string VerboseProperty = "Verbose";
+ public static readonly string ShowLogoProperty = "ShowLogo";
+ public static readonly string QuietProperty = "Quiet";
+ public static readonly string DebugModeProperty = "DebugMode";
+ #endregion
+
+ #region Property defaults
+ public static readonly string DefaultNAntFileName = "nant.exe";
+ #endregion
+
+ static Properties properties;
+
+ static AddInOptions()
+ {
+ properties = PropertyService.Get(OptionsProperty, new Properties());
+ }
+
+ static Properties Properties {
+ get {
+ Debug.Assert(properties != null);
+ return properties;
+ }
+ }
+
+ #region Properties
+
+ ///
+ /// Gets the NAnt executable filename.
+ ///
+ ///
+ /// This is either the full filename including path
+ /// or just the name of the executable (nant.exe) in which
+ /// case it is assumed that NAnt is on the path.
+ ///
+ public static string NAntFileName {
+ get {
+ return (string)Properties.Get(NAntFileNameProperty, DefaultNAntFileName);
+ }
+ set {
+ if (String.IsNullOrEmpty(value)) {
+ Properties.Set(NAntFileNameProperty, DefaultNAntFileName);
+ } else {
+ Properties.Set(NAntFileNameProperty, value);
+ }
+ }
+ }
+
+ ///
+ /// Gets the NAnt command line arguments.
+ ///
+ public static string NAntArguments {
+ get {
+ return (string)Properties.Get(NAntArgumentsProperty, String.Empty);
+ }
+ set {
+ Properties.Set(NAntArgumentsProperty, value);
+ }
+ }
+
+ ///
+ /// Gets the NAnt -verbose setting.
+ ///
+ public static bool Verbose {
+ get {
+ return (bool)Properties.Get(VerboseProperty, false);
+ }
+ set {
+ Properties.Set(VerboseProperty, value);
+ }
+ }
+
+ ///
+ /// Gets the NAnt show logo setting.
+ ///
+ public static bool ShowLogo {
+ get {
+ return (bool)Properties.Get(ShowLogoProperty, false);
+ }
+ set {
+ Properties.Set(ShowLogoProperty, value);
+ }
+ }
+
+ ///
+ /// Gets the NAnt -quiet setting.
+ ///
+ public static bool Quiet {
+ get {
+ return (bool)Properties.Get(QuietProperty, false);
+ }
+ set {
+ Properties.Set(QuietProperty, value);
+ }
+ }
+
+ ///
+ /// Gets the NAnt -debug setting.
+ ///
+ public static bool DebugMode {
+ get {
+ return (bool)Properties.Get(DebugModeProperty, false);
+ }
+ set {
+ Properties.Set(DebugModeProperty, value);
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/AbstractRunNAntCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/AbstractRunNAntCommand.cs
new file mode 100644
index 0000000000..fc3f632bff
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/AbstractRunNAntCommand.cs
@@ -0,0 +1,338 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.ComponentModel;
+using System.IO;
+
+using ICSharpCode.Core;
+using ICSharpCode.NAnt.Gui;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Project;
+using ICSharpCode.SharpDevelop.Util;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// The base class for all commands that run NAnt.
+ ///
+ public abstract class AbstractRunNAntCommand : AbstractMenuCommand
+ {
+ ///
+ /// The default NAnt build filename.
+ ///
+ public static readonly string DefaultBuildFileName = "default.build";
+
+ ///
+ /// The default NAnt build file extension.
+ ///
+ public static readonly string NAntBuildFileExtension = ".build";
+
+ const int Win32FileNotFoundErrorCode = 2;
+ const int Win32PathNotFoundErrorCode = 3;
+
+ static MessageViewCategory category;
+ static NAntRunner runner;
+
+ public AbstractRunNAntCommand()
+ {
+ if (runner == null) {
+ runner = NAntRunnerSingleton.Runner;
+ runner.NAntExited += new NAntExitEventHandler(NAntExited);
+ runner.OutputLineReceived += new LineReceivedEventHandler(OutputLineReceived);
+ }
+ }
+
+ public override void Run()
+ {
+ }
+
+ public static bool IsActiveConfigurationDebug {
+ get {
+
+ bool isDebug = false;
+
+ IProject project = ProjectService.CurrentProject;
+ if (project != null) {
+ if (String.Compare(project.ActiveConfiguration, "debug", true) == 0) {
+ isDebug = true;
+ }
+ }
+
+ return isDebug;
+ }
+ }
+
+ ///
+ /// Gets the NAnt build filename from the selected project.
+ ///
+ ///
+ /// The basic logic is:
+ /// Look for a file called "default.build".
+ /// Look for a file named after the project
+ /// ".build".
+ /// Look for the first ".build" file in the project.
+ /// If multiple ".build" files exist then, like NAnt,
+ /// this is an error, but currently we ignore this.
+ /// Note that this does not look in the project folder
+ /// for a .build file that is not added to the project.
+ ///
+ ///
+ /// The build filename for the project.
+ protected string GetProjectBuildFileName()
+ {
+ string fileName = String.Empty;
+
+ IProject project = ProjectService.CurrentProject;
+
+ // Look for "default.build".
+ string projectFileName = project.FileName;
+
+ string buildFileName = Path.Combine(Path.GetDirectoryName(projectFileName), DefaultBuildFileName);
+ if (project.IsFileInProject(buildFileName)) {
+ fileName = buildFileName;
+ } else {
+
+ // Look for .build
+ buildFileName = Path.ChangeExtension(projectFileName, NAntBuildFileExtension);
+ if (project.IsFileInProject(buildFileName)) {
+ fileName = buildFileName;
+ } else {
+
+ // Look for the first matching .build file.
+ ProjectItem projectItem = GetFirstMatchingFile(project, NAntBuildFileExtension);
+ if (projectItem != null) {
+ fileName = projectItem.FileName;
+ } else {
+ throw new NAntAddInException("Project does not contain a '.build' file.");
+ }
+ }
+ }
+
+ return fileName;
+ }
+
+ ///
+ /// Runs any pre-build steps such as saving changed files.
+ ///
+ protected void RunPreBuildSteps()
+ {
+ //ProjectService.DoBeforeCompileAction();
+ TaskService.ClearExceptCommentTasks();
+ }
+
+ ///
+ /// Runs the default target in the NAnt build.
+ ///
+ /// The build file to run.
+ /// The working folder for NAnt.
+ /// Flag indicating whether to set the NAnt debug property.
+ protected void RunBuild(string buildFileName, string workingDirectory, bool debug)
+ {
+ RunBuild(buildFileName, workingDirectory, debug, String.Empty, String.Empty);
+ }
+
+ protected void RunBuild(string buildFileName, string workingDirectory, bool debug, string target)
+ {
+ RunBuild(buildFileName, workingDirectory, debug, target, String.Empty);
+ }
+
+ ///
+ /// Runs the specified target in the NAnt build.
+ ///
+ /// The build file to run.
+ /// The working folder for NAnt.
+ /// Flag indicating whether to set the NAnt debug property.
+ /// The NAnt target to run.
+ /// Command line arguments to pass to NAnt.
+ protected void RunBuild(string buildFileName, string workingDirectory, bool debug, string target, string args)
+ {
+ if (IsBuildRunning) {
+ throw new NAntAddInException("A NAnt build is currently running.");
+ }
+
+ Category.ClearText();
+ ShowOutputPad();
+
+ runner.BuildFileName = buildFileName;
+ runner.NAntFileName = AddInOptions.NAntFileName;
+ runner.Verbose = AddInOptions.Verbose;
+ runner.WorkingDirectory = workingDirectory;
+ runner.Quiet = AddInOptions.Quiet;
+ runner.ShowLogo = AddInOptions.ShowLogo;
+ runner.DebugMode = AddInOptions.DebugMode;
+
+ if (debug) {
+ runner.Arguments = String.Concat("-D:debug=true ", AddInOptions.NAntArguments, " ", args, " ", target);
+ } else {
+ runner.Arguments = String.Concat(AddInOptions.NAntArguments, " ", args, " ", target);
+ }
+
+ CategoryWriteLine(StringParser.Parse("Running NAnt."));
+ CategoryWriteLine(runner.CommandLine);
+
+ try {
+ runner.Start();
+ } catch (Win32Exception ex) {
+ if (ex.NativeErrorCode == Win32FileNotFoundErrorCode || ex.NativeErrorCode == Win32PathNotFoundErrorCode) {
+ throw new NAntAddInException(GetNAntNotFoundErrorMessage(AddInOptions.NAntFileName), ex);
+ } else {
+ throw;
+ }
+ }
+ }
+
+ ///
+ /// Gets any extra arguments from the NAnt pad's text box.
+ ///
+ protected string GetPadTextBoxArguments()
+ {
+ string arguments = String.Empty;
+
+ IWorkbench Workbench = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.Workbench;
+ PadDescriptor padDescriptor = Workbench.GetPad(typeof(NAntPadContent));
+
+ if (padDescriptor != null && padDescriptor.PadContent != null) {
+ arguments = ((NAntPadContent)padDescriptor.PadContent).Arguments;
+ }
+
+ return arguments;
+ }
+
+ ///
+ /// Stops the currently running build.
+ ///
+ protected void StopBuild()
+ {
+ if (IsBuildRunning) {
+ if (MessageService.AskQuestion(StringParser.Parse("This will terminate the NAnt process. Are you sure?"))) {
+ runner.Stop();
+ CategoryWriteLine(StringParser.Parse("NAnt build stopped."));
+ }
+ }
+ }
+
+ protected bool IsBuildRunning {
+ get {
+ return runner.IsRunning;
+ }
+ }
+
+ ///
+ /// Gets the NAnt message view output window.
+ ///
+ MessageViewCategory Category {
+ get {
+ if (category == null) {
+ category = new MessageViewCategory("NAnt");
+ CompilerMessageView cmv = (CompilerMessageView)WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).PadContent;
+ cmv.AddCategory(category);
+ }
+
+ return category;
+ }
+ }
+
+ ///
+ /// Writes a line of text to the output window.
+ ///
+ void CategoryWriteLine(string message)
+ {
+ Category.AppendText(String.Concat(message, Environment.NewLine));
+ }
+
+ ///
+ /// Brings output pad to the front.
+ ///
+ void ShowOutputPad()
+ {
+ WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront();
+ }
+
+ ///
+ /// Looks for the first file that matches the specified
+ /// file extension.
+ ///
+ /// A filename extension.
+ /// A ProjectItem that has the specified extension,
+ /// or null.
+ ProjectItem GetFirstMatchingFile(IProject project, string extension)
+ {
+ foreach (ProjectItem projectItem in project.Items) {
+ string projectFileNameExtension = Path.GetExtension(projectItem.FileName);
+ if (String.Compare(projectFileNameExtension, extension, true) == 0) {
+ return projectItem;
+ }
+ }
+ return null;
+ }
+
+ ///
+ /// Displays the output from NAnt after it has exited.
+ ///
+ /// The event source.
+ /// The NAnt exit event arguments.
+ void NAntExited(object sender, NAntExitEventArgs e)
+ {
+ // Update output window.
+ string outputText = String.Empty;
+
+ System.Diagnostics.Debug.Assert(e.Error.Length == 0);
+
+ outputText = String.Concat(outputText, e.Output);
+
+ // Update task list.
+ TaskCollection tasks = NAntOutputParser.Parse(outputText);
+ foreach (Task task in tasks) {
+ WorkbenchSingleton.SafeThreadAsyncCall(TaskService.Add, task);
+ }
+
+ // Bring task list to front.
+ if (tasks.Count > 0 && ErrorListPad.ShowAfterBuild) {
+ IWorkbench workbench = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.Workbench;
+ PadDescriptor padDescriptor = workbench.GetPad(typeof(ErrorListPad));
+ if (padDescriptor != null) {
+ WorkbenchSingleton.SafeThreadAsyncCall(padDescriptor.BringPadToFront);
+ }
+ }
+ }
+
+ void OutputLineReceived(object sender, LineReceivedEventArgs e)
+ {
+ CategoryWriteLine(e.Line);
+ }
+
+ string GetNAntNotFoundErrorMessage(string fileName)
+ {
+ string formatString = "Unable to find NAnt '{0}'.\r\n\r\n" +
+ "Please configure the NAnt executable's location in the SharpDevelop Options.";
+
+ return String.Format(formatString, fileName);
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/GoToErrorCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/GoToErrorCommand.cs
new file mode 100644
index 0000000000..6656d58bca
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/GoToErrorCommand.cs
@@ -0,0 +1,57 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using ICSharpCode.Core;
+using ICSharpCode.NAnt.Gui;
+using ICSharpCode.SharpDevelop;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Opens up a NAnt build file and goes to the line of the
+ /// error.
+ ///
+ public class GoToErrorCommand : AbstractMenuCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ 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);
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/GoToTargetDefinitionCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/GoToTargetDefinitionCommand.cs
new file mode 100644
index 0000000000..77a9d962d4
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/GoToTargetDefinitionCommand.cs
@@ -0,0 +1,61 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using ICSharpCode.Core;
+using ICSharpCode.NAnt.Gui;
+using ICSharpCode.SharpDevelop;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Opens up a NAnt build file and goes to the line of the
+ /// target selected.
+ ///
+ public class GoToTargetDefinitionCommand : AbstractMenuCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ 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);
+ }
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/OpenNAntBuildFileCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/OpenNAntBuildFileCommand.cs
new file mode 100644
index 0000000000..258aea7aa7
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/OpenNAntBuildFileCommand.cs
@@ -0,0 +1,56 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using ICSharpCode.Core;
+using ICSharpCode.NAnt.Gui;
+using ICSharpCode.SharpDevelop;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Opens the build file selected in the NAnt pad view.
+ ///
+ public class OpenNAntBuildFileCommand : AbstractMenuCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ 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);
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/RefreshNantPadCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/RefreshNantPadCommand.cs
new file mode 100644
index 0000000000..859b6e0495
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/RefreshNantPadCommand.cs
@@ -0,0 +1,43 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using ICSharpCode.NAnt.Gui;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Refreshes the NAnt pad.
+ ///
+ public class RefreshNAntPadCommand : AbstractRunNAntCommand
+ {
+ public override void Run()
+ {
+ NAntPadContent.Instance.Refresh();
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/RunNAntCleanTargetCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/RunNAntCleanTargetCommand.cs
new file mode 100644
index 0000000000..a983238629
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/RunNAntCleanTargetCommand.cs
@@ -0,0 +1,59 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using ICSharpCode.Core;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Runs the NAnt "clean" target on the project's build file.
+ ///
+ public class RunNAntCleanTargetCommand : AbstractRunNAntCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ public override void Run()
+ {
+ try {
+ string buildFileName = GetProjectBuildFileName();
+
+ RunPreBuildSteps();
+
+ RunBuild(Path.GetFileName(buildFileName),
+ Path.GetDirectoryName(buildFileName),
+ IsActiveConfigurationDebug,
+ "clean");
+
+ } catch (NAntAddInException ex) {
+ MessageService.ShowMessage(ex.Message);
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/RunNAntCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/RunNAntCommand.cs
new file mode 100644
index 0000000000..f650ec3bf3
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/RunNAntCommand.cs
@@ -0,0 +1,58 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using ICSharpCode.Core;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Represents the command that runs NAnt on the project's build file.
+ ///
+ public class RunNAntCommand : AbstractRunNAntCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ public override void Run()
+ {
+ try {
+ string buildFileName = GetProjectBuildFileName();
+
+ RunPreBuildSteps();
+
+ RunBuild(Path.GetFileName(buildFileName),
+ Path.GetDirectoryName(buildFileName),
+ IsActiveConfigurationDebug);
+
+ } catch (NAntAddInException ex) {
+ MessageService.ShowMessage(ex.Message);
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/RunSelectedNAntCleanTargetCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/RunSelectedNAntCleanTargetCommand.cs
new file mode 100644
index 0000000000..b75ed483d7
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/RunSelectedNAntCleanTargetCommand.cs
@@ -0,0 +1,59 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using ICSharpCode.Core;
+using ICSharpCode.NAnt.Gui;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Runs the NAnt clean target for the file selected in the NAnt Pad view.
+ ///
+ public class RunSelectedNAntCleanTargetCommand : AbstractRunNAntCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ 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);
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/RunSelectedNAntTargetCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/RunSelectedNAntTargetCommand.cs
new file mode 100644
index 0000000000..7c1266558d
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/RunSelectedNAntTargetCommand.cs
@@ -0,0 +1,69 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using ICSharpCode.Core;
+using ICSharpCode.NAnt.Gui;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Runs the NAnt target selected in the NAnt Pad view.
+ ///
+ public class RunSelectedNAntTargetCommand : AbstractRunNAntCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ 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);
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Commands/StopNAntCommand.cs b/samples/NAnt/NAnt.AddIn/Src/Commands/StopNAntCommand.cs
new file mode 100644
index 0000000000..36bd6987cd
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Commands/StopNAntCommand.cs
@@ -0,0 +1,45 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+
+namespace ICSharpCode.NAnt.Commands
+{
+ ///
+ /// Represents the command that stops the currently running NAnt process.
+ ///
+ public class StopNAntCommand : AbstractRunNAntCommand
+ {
+ ///
+ /// Runs the .
+ ///
+ public override void Run()
+ {
+ StopBuild();
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Gui/NAntAddInOptionPanel.cs b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntAddInOptionPanel.cs
new file mode 100644
index 0000000000..850ee728ff
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntAddInOptionPanel.cs
@@ -0,0 +1,90 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Windows.Forms;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Gui;
+
+namespace ICSharpCode.NAnt.Gui
+{
+ ///
+ /// Options panel for the NAnt add-in.
+ ///
+ public class NAntAddInOptionPanel : AbstractOptionPanel
+ {
+ static readonly string commandTextBoxName = "nantCommandTextBox";
+ static readonly string argumentsTextBoxName = "argumentsTextBox";
+ static readonly string verboseCheckBoxName = "verboseCheckBox";
+ static readonly string browseButtonName = "browseButton";
+ static readonly string showLogoCheckBoxName = "showLogoCheckBox";
+ static readonly string quietCheckBoxName = "quietCheckBox";
+ static readonly string debugModeCheckBoxName = "debugModeCheckBox";
+
+ public override void LoadPanelContents()
+ {
+ SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.NAnt.Resources.NAntAddInOptionPanel.xfrm"));
+
+ ControlDictionary[commandTextBoxName].Text = AddInOptions.NAntFileName;
+ ControlDictionary[argumentsTextBoxName].Text = AddInOptions.NAntArguments;
+ ((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked = AddInOptions.Verbose;
+ ((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked = AddInOptions.ShowLogo;
+ ((CheckBox)ControlDictionary[quietCheckBoxName]).Checked = AddInOptions.Quiet;
+ ((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked = AddInOptions.DebugMode;
+
+ ControlDictionary[browseButtonName].Click += new EventHandler(OnBrowse);
+ }
+
+ public override bool StorePanelContents()
+ {
+ AddInOptions.NAntFileName = ControlDictionary[commandTextBoxName].Text;
+ AddInOptions.NAntArguments = ControlDictionary[argumentsTextBoxName].Text;
+ AddInOptions.Verbose = ((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked;
+ AddInOptions.ShowLogo = ((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked;
+ AddInOptions.Quiet = ((CheckBox)ControlDictionary[quietCheckBoxName]).Checked;
+ AddInOptions.DebugMode = ((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked;
+
+ return true;
+ }
+
+ ///
+ /// Allows the user to browse for the NAnt executable.
+ ///
+ void OnBrowse(object sender, EventArgs e)
+ {
+ using (OpenFileDialog openFileDialog = new OpenFileDialog()) {
+
+ openFileDialog.CheckFileExists = true;
+ openFileDialog.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
+
+ if (openFileDialog.ShowDialog() == DialogResult.OK) {
+ ControlDictionary[commandTextBoxName].Text = openFileDialog.FileName;
+ }
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildFileErrorTreeNode.cs b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildFileErrorTreeNode.cs
new file mode 100644
index 0000000000..71e5e3c38f
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildFileErrorTreeNode.cs
@@ -0,0 +1,55 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Windows.Forms;
+
+namespace ICSharpCode.NAnt.Gui
+{
+ ///
+ /// Represents a error in the
+ /// .
+ ///
+ public class NAntBuildFileErrorTreeNode : TreeNode
+ {
+ NAntBuildFileError buildFileError;
+ public NAntBuildFileErrorTreeNode(NAntBuildFileError error)
+ {
+ this.Text = error.Message;
+ this.ImageIndex = NAntPadTreeViewImageList.TargetErrorImage;
+ this.SelectedImageIndex = NAntPadTreeViewImageList.TargetErrorImage;
+ this.buildFileError = error;
+ }
+
+ public NAntBuildFileError Error {
+ get {
+ return buildFileError;
+ }
+ }
+
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildFileTreeNode.cs b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildFileTreeNode.cs
new file mode 100644
index 0000000000..3c42bb519b
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildFileTreeNode.cs
@@ -0,0 +1,170 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using System.Text;
+using System.Windows.Forms;
+
+namespace ICSharpCode.NAnt.Gui
+{
+ ///
+ /// Represents a NAnt build file in the .
+ ///
+ public class NAntBuildFileTreeNode : TreeNode
+ {
+ NAntBuildFile buildFile;
+ string projectName = String.Empty;
+
+ ///
+ /// Creates a new instance of the
+ /// class.
+ ///
+ /// The
+ /// associated with this tree node.
+ public NAntBuildFileTreeNode(string projectName, NAntBuildFile buildFile)
+ {
+ this.projectName = projectName;
+ this.buildFile = buildFile;
+
+ UpdateNode();
+ }
+
+ ///
+ /// Gets the associated with
+ /// this node.
+ ///
+ public NAntBuildFile BuildFile {
+ get {
+ return buildFile;
+ }
+
+ set {
+ SetBuildFile(value);
+ }
+ }
+
+ ///
+ /// Gets or sets the build file's filename.
+ ///
+ ///
+ /// Called when the build file has been renamed.
+ public string FileName {
+ get {
+ return buildFile.FileName;
+ }
+
+ set {
+ buildFile.FileName = value;
+ SetNodeText();
+ }
+ }
+
+ ///
+ /// Sets the node text.
+ ///
+ void SetNodeText()
+ {
+ StringBuilder nodeText = new StringBuilder();
+
+ if (projectName.Length > 0) {
+ nodeText.Append(projectName);
+ nodeText.Append(Path.DirectorySeparatorChar);
+ }
+ nodeText.Append(buildFile.FileName);
+
+ if (buildFile.DefaultTarget != null) {
+ nodeText.Append(" [");
+ nodeText.Append(buildFile.DefaultTarget.Name);
+ nodeText.Append("]");
+ }
+
+ this.Text = nodeText.ToString();
+ }
+
+ ///
+ /// Adds the targets to the node.
+ ///
+ /// A collection of NAntBuildTargets.
+ void AddTargets(NAntBuildTargetCollection targets)
+ {
+ foreach (NAntBuildTarget target in targets) {
+ AddTarget(this, target);
+ }
+ }
+
+ ///
+ /// Adds a NAnt build target to the tree.
+ ///
+ /// The parent tree node.
+ /// The NAnt build target.
+ void AddTarget(TreeNode node, NAntBuildTarget target)
+ {
+ NAntBuildTargetTreeNode targetNode = new NAntBuildTargetTreeNode(target);
+ node.Nodes.Add(targetNode);
+ }
+
+ ///
+ /// Adds an error node to the tree.
+ ///
+ /// The parent tree node.
+ void AddBuildFileError(TreeNode node, NAntBuildFileError buildFileError)
+ {
+ NAntBuildFileErrorTreeNode errorNode = new NAntBuildFileErrorTreeNode(buildFileError);
+ node.Nodes.Add(errorNode);
+ }
+
+ ///
+ /// Updates the display since the build file has changed.
+ ///
+ void SetBuildFile(NAntBuildFile buildFile)
+ {
+ Nodes.Clear();
+ this.buildFile = buildFile;
+ UpdateNode();
+ }
+
+ ///
+ /// Sets the node's image, text and adds target nodes.
+ ///
+ void UpdateNode()
+ {
+ this.ImageIndex = NAntPadTreeViewImageList.BuildFileImage;
+ this.SelectedImageIndex = NAntPadTreeViewImageList.BuildFileImage;
+
+ if (buildFile.HasError) {
+ this.ImageIndex = NAntPadTreeViewImageList.BuildFileErrorImage;
+ this.SelectedImageIndex = NAntPadTreeViewImageList.BuildFileErrorImage;
+ AddBuildFileError(this, buildFile.Error);
+ } else {
+ AddTargets(buildFile.Targets);
+ }
+
+ SetNodeText();
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildTargetTreeNode.cs b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildTargetTreeNode.cs
new file mode 100644
index 0000000000..ba6f1d9ee7
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntBuildTargetTreeNode.cs
@@ -0,0 +1,68 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace ICSharpCode.NAnt.Gui
+{
+ ///
+ /// Represents a in the
+ /// .
+ ///
+ public class NAntBuildTargetTreeNode : TreeNode
+ {
+ NAntBuildTarget target;
+
+ 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;
+ }
+
+ ///
+ /// Gets the
+ /// associated with this node.
+ ///
+ public NAntBuildTarget Target {
+ get {
+ return target;
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadContent.cs b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadContent.cs
new file mode 100644
index 0000000000..46d0a043d7
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadContent.cs
@@ -0,0 +1,331 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Windows.Forms;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Project;
+
+namespace ICSharpCode.NAnt.Gui
+{
+ ///
+ /// The NAnt pad.
+ ///
+ public class NAntPadContent : AbstractPadContent
+ {
+ Panel contentPanel;
+ NAntPadTreeView treeView;
+ TextBox textBox;
+ ToolStrip toolStrip;
+ bool disposed;
+
+ public NAntPadContent()
+ {
+ LoggingService.Debug("NAntPadContent.ctor");
+ // Create main panel.
+ contentPanel = new Panel();
+
+ // Initialise treeview.
+ treeView = new NAntPadTreeView();
+ treeView.Dock = DockStyle.Fill;
+
+ // Create ToolStrip.
+ toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/NAntPad/Toolbar");
+ toolStrip.GripStyle = ToolStripGripStyle.Hidden;
+
+ // Create text box.
+ textBox = new TextBox();
+ textBox.WordWrap = false;
+ textBox.Dock = DockStyle.Bottom;
+
+ // Tooltip.
+ ToolTip toolTip = new ToolTip();
+ toolTip.SetToolTip(textBox, StringParser.Parse("Enter NAnt properties."));
+
+ contentPanel.Controls.Add(treeView);
+ contentPanel.Controls.Add(toolStrip);
+ contentPanel.Controls.Add(textBox);
+
+ ProjectService.SolutionLoaded += SolutionLoaded;
+ ProjectService.SolutionClosed += SolutionClosed;
+ ProjectService.ProjectItemRemoved += ProjectItemRemoved;
+ ProjectService.ProjectItemAdded += ProjectItemAdded;
+ WorkbenchSingleton.Workbench.ViewOpened += WorkbenchViewOpened;
+ WorkbenchSingleton.Workbench.ViewClosed += WorkbenchViewClosed;
+ FileService.FileRenamed += FileRenamed;
+ FileService.FileRemoved += FileRemoved;
+ FileUtility.FileSaved += FileSaved;
+
+ NAntRunnerSingleton.Runner.NAntStarted += NAntStarted;
+ NAntRunnerSingleton.Runner.NAntStopped += NAntStopped;
+ NAntRunnerSingleton.Runner.NAntExited += NAntExited;
+
+ // Due to lazy loading we have missed the solution loaded event
+ // so add it now.
+ Refresh();
+ }
+
+ ///
+ /// Gets any extra command line arguments entered in the pad's text box.
+ ///
+ public string Arguments {
+ get {
+ return textBox.Text;
+ }
+ }
+
+ public static NAntPadContent Instance {
+ get {
+ PadDescriptor descriptor = WorkbenchSingleton.Workbench.GetPad(typeof(NAntPadContent));
+ return (NAntPadContent)descriptor.PadContent;
+ }
+ }
+
+ ///
+ /// Refreshes the contents NAnt pad.
+ ///
+ public void Refresh()
+ {
+ treeView.Clear();
+
+ Solution solution = ProjectService.OpenSolution;
+ if (solution != null) {
+ treeView.AddSolution(solution);
+ }
+ foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) {
+ if (IsStandaloneNAntBuildFile(view.PrimaryFileName)) {
+ treeView.AddBuildFile(String.Empty, view.PrimaryFileName);
+ }
+ }
+ }
+
+ ///
+ /// Gets the currently selected .
+ ///
+ /// This will return a NAntBuildFile if
+ /// a target node is selected.
+ public NAntBuildFile SelectedBuildFile {
+ get {
+ return treeView.SelectedBuildFile;
+ }
+ }
+
+ ///
+ /// Gets the current selected
+ ///
+ public NAntBuildTarget SelectedTarget {
+ get {
+ return treeView.SelectedTarget;
+ }
+ }
+
+ #region AbstractPadContent requirements
+
+ ///
+ /// The representing the pad
+ ///
+ public override Control Control {
+ get {
+ return contentPanel;
+ }
+ }
+
+ ///
+ /// Refreshes the pad
+ ///
+ public override void RedrawContent()
+ {
+ }
+
+ ///
+ /// Cleans up all used resources
+ ///
+ public override void Dispose()
+ {
+ if (!disposed) {
+ disposed = true;
+
+ treeView.Dispose();
+ contentPanel.Dispose();
+
+ ProjectService.SolutionLoaded -= SolutionLoaded;
+ ProjectService.SolutionClosed -= SolutionClosed;
+ ProjectService.ProjectItemRemoved -= ProjectItemRemoved;
+ ProjectService.ProjectItemAdded -= ProjectItemAdded;
+ WorkbenchSingleton.Workbench.ViewOpened -= WorkbenchViewOpened;
+ WorkbenchSingleton.Workbench.ViewClosed -= WorkbenchViewClosed;
+ FileService.FileRenamed -= FileRenamed;
+ FileService.FileRemoved -= FileRemoved;
+ FileUtility.FileSaved -= FileSaved;
+
+ NAntRunnerSingleton.Runner.NAntStarted -= NAntStarted;
+ NAntRunnerSingleton.Runner.NAntStopped -= NAntStopped;
+ NAntRunnerSingleton.Runner.NAntExited -= NAntExited;
+
+ base.Dispose();
+ }
+ }
+
+ #endregion
+
+ void SolutionClosed(object sender, EventArgs e)
+ {
+ LoggingService.Debug("SolutionClosed.");
+ treeView.Clear();
+ }
+
+ void SolutionLoaded(object sender, SolutionEventArgs e)
+ {
+ LoggingService.Debug("SolutionLoaded.");
+ AddSolutionToPad(e.Solution);
+ }
+
+ void AddSolutionToPad(Solution solution)
+ {
+ if (solution != null) {
+ treeView.AddSolution(solution);
+ }
+ }
+
+ void UpdateToolbar()
+ {
+ ToolbarService.UpdateToolbar(toolStrip);
+ }
+
+ 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);
+ }
+ }
+ }
+
+ void AddBuildFile(string fileName)
+ {
+ if (ProjectService.OpenSolution == null) return;
+ IProject project = ProjectService.OpenSolution.FindProjectContainingFile(fileName);
+ if (project != null) {
+ treeView.AddBuildFile(project.Name, fileName);
+ }
+ }
+
+ void ProjectItemAdded(object sender, ProjectItemEventArgs e)
+ {
+ LoggingService.Debug("ProjectItemAdded.");
+ if (e.ProjectItem.ItemType != ItemType.Folder) {
+ if (NAntBuildFile.IsBuildFile(e.ProjectItem.FileName)) {
+ treeView.AddBuildFile(e.Project.Name, e.ProjectItem.FileName);
+ }
+ }
+ }
+
+ 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);
+ }
+ }
+ }
+
+ void WorkbenchViewOpened(object sender, ViewContentEventArgs e)
+ {
+ if (IsStandaloneNAntBuildFile(e.Content.PrimaryFileName)) {
+ treeView.UpdateBuildFile(e.Content.PrimaryFileName);
+ }
+ }
+
+ void WorkbenchViewClosed(object sender, ViewContentEventArgs e)
+ {
+ if (IsStandaloneNAntBuildFile(e.Content.PrimaryFileName)) {
+ treeView.RemoveBuildFile(e.Content.PrimaryFileName);
+ }
+ }
+
+ bool IsStandaloneNAntBuildFile(string fileName)
+ {
+ if (fileName != null) {
+ return NAntBuildFile.IsBuildFile(fileName) && !IsInProject(fileName);
+ }
+ return false;
+ }
+
+ bool IsInProject(string fileName)
+ {
+ Solution solution = ProjectService.OpenSolution;
+ if (solution != null) {
+ foreach (IProject project in solution.Projects) {
+ if (project.IsFileInProject(fileName)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ void FileSaved(object sender, FileNameEventArgs e)
+ {
+ LoggingService.Debug("FileSaved.");
+ if (NAntBuildFile.IsBuildFile(e.FileName)) {
+ treeView.UpdateBuildFile(e.FileName);
+ }
+ }
+
+ void FileRemoved(object sender, FileEventArgs e)
+ {
+ LoggingService.Debug("FileRemoved.");
+ if (NAntBuildFile.IsBuildFile(e.FileName)) {
+ treeView.RemoveBuildFile(e.FileName);
+ }
+ }
+
+ void NAntStarted(object sender, EventArgs e)
+ {
+ UpdateToolbar();
+ }
+
+ void NAntStopped(object sender, EventArgs e)
+ {
+ UpdateToolbar();
+ }
+
+ void NAntExited(object sender, NAntExitEventArgs e)
+ {
+ WorkbenchSingleton.SafeThreadAsyncCall(UpdateToolbar);
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadTreeView.cs b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadTreeView.cs
new file mode 100644
index 0000000000..4228f37e84
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadTreeView.cs
@@ -0,0 +1,400 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Windows.Forms;
+
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Project;
+
+namespace ICSharpCode.NAnt.Gui
+{
+ ///
+ /// NAnt pad's tree view. Shows a high level view of build file in
+ /// a set of projects.
+ ///
+ public class NAntPadTreeView : System.Windows.Forms.UserControl, IOwnerState
+ {
+ private System.Windows.Forms.TreeView treeView;
+ const string ContextMenuAddInTreePath = "/SharpDevelop/Pads/NAntPad/ContextMenu";
+
+ ///
+ /// The possible states of the tree view.
+ ///
+ public enum NAntPadTreeViewState {
+ Nothing = 0,
+ BuildFileSelected = 1,
+ TargetSelected = 2,
+ ErrorSelected = 4
+ }
+
+ ///
+ /// The current state of the tree view.
+ ///
+ NAntPadTreeViewState state = NAntPadTreeViewState.Nothing;
+
+ delegate void AddSolutionInvoker(Solution solution);
+
+ public NAntPadTreeView()
+ {
+ //
+ // The InitializeComponent() call is required for Windows Forms designer support.
+ //
+ InitializeComponent();
+
+ treeView.Sorted = true;
+ treeView.HideSelection = false;
+ treeView.ImageList = NAntPadTreeViewImageList.GetImageList();
+ treeView.ContextMenuStrip = MenuService.CreateContextMenu(this, ContextMenuAddInTreePath);
+ treeView.DoubleClick += new EventHandler(TreeViewDoubleClick);
+ }
+
+ ///
+ /// Gets the "ownerstate" condition.
+ ///
+ public Enum InternalState {
+ get {
+ return state;
+ }
+ }
+
+ ///
+ /// Clears all items from the tree view.
+ ///
+ public void Clear()
+ {
+ if (InvokeRequired) {
+ MethodInvoker invoker = new MethodInvoker(Clear);
+ Invoke(invoker);
+ } else {
+ treeView.Nodes.Clear();
+ }
+ }
+
+ ///
+ /// Adds items to the tree view for each build file that exists
+ /// in all the solution's subprojects.
+ ///
+ /// A solution containing projects.
+ public void AddSolution(Solution solution)
+ {
+ if (InvokeRequired) {
+ AddSolutionInvoker invoker = new AddSolutionInvoker(AddSolution);
+ Invoke(invoker);
+ } else {
+ foreach (IProject project in solution.Projects) {
+ AddProject(project);
+ }
+ }
+ }
+
+ ///
+ /// Adds items to the tree view for each build file that exist
+ /// in a project.
+ ///
+ /// A SharpDevelop project.
+ 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);
+ }
+ }
+ }
+
+ ///
+ /// Removes the specified build file from the
+ /// tree view.
+ public void RemoveBuildFile(string fileName)
+ {
+ Debug.Assert(!InvokeRequired, "RemoveBuildFile InvokeRequired");
+
+ NAntBuildFileTreeNode node = FindMatchingNode(fileName);
+ if (node != null) {
+ node.Remove();
+ }
+ }
+
+ ///
+ /// Renames the build file.
+ ///
+ /// The filename to update.
+ /// The updated filename.
+ public void RenameBuildFile(string oldFileName, string newFileName)
+ {
+ Debug.Assert(!InvokeRequired, "RenameBuildFile InvokeRequired");
+
+ NAntBuildFileTreeNode node = FindMatchingNode(oldFileName);
+
+ if (node != null) {
+ node.FileName = Path.GetFileName(newFileName);
+ }
+ }
+
+ ///
+ /// Updates the build file in the tree view.
+ ///
+ /// The build file name.
+ 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);
+ }
+ }
+
+ ///
+ /// Adds a build file to the tree.
+ ///
+ /// The name of the project.
+ /// The build file name.
+ /// if the project's
+ /// active configuration is debug;
+ /// otherwise.
+ 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);
+ }
+ }
+
+ ///
+ /// Gets the currently selected .
+ ///
+ /// This will return a NAntBuildFile if
+ /// a target node is selected.
+ public NAntBuildFile SelectedBuildFile {
+ get {
+ NAntBuildFile buildFile = null;
+
+ TreeNode selectedNode = treeView.SelectedNode;
+ if (selectedNode is NAntBuildFileTreeNode) {
+ NAntBuildFileTreeNode buildNode = (NAntBuildFileTreeNode)selectedNode;
+ buildFile = buildNode.BuildFile;
+ } else if(selectedNode is NAntBuildTargetTreeNode) {
+ NAntBuildTargetTreeNode targetNode = (NAntBuildTargetTreeNode)selectedNode;
+ NAntBuildFileTreeNode buildNode = (NAntBuildFileTreeNode)targetNode.Parent;
+ buildFile = buildNode.BuildFile;
+ } else if(selectedNode is NAntBuildFileErrorTreeNode) {
+ NAntBuildFileErrorTreeNode errorNode = (NAntBuildFileErrorTreeNode)selectedNode;
+ NAntBuildFileTreeNode buildNode = (NAntBuildFileTreeNode)errorNode.Parent;
+ buildFile = buildNode.BuildFile;
+ }
+
+ return buildFile;
+ }
+ }
+
+ ///
+ /// Gets the current selected
+ ///
+ public NAntBuildTarget SelectedTarget {
+ get {
+ NAntBuildTarget target = null;
+
+ NAntBuildTargetTreeNode targetNode = treeView.SelectedNode as NAntBuildTargetTreeNode;
+
+ if (targetNode != null) {
+ target = targetNode.Target;
+ }
+
+ return target;
+ }
+ }
+
+ ///
+ /// Gets the current selected
+ ///
+ public NAntBuildFileError SelectedError {
+ get {
+ NAntBuildFileError error = null;
+
+ NAntBuildFileErrorTreeNode errorNode = treeView.SelectedNode as NAntBuildFileErrorTreeNode;
+
+ if (errorNode != null) {
+ error = errorNode.Error;
+ }
+
+ return error;
+ }
+ }
+
+ ///
+ /// Gets whether a target is selected.
+ ///
+ public bool IsTargetSelected {
+ get {
+ bool isSelected = false;
+
+ if (SelectedTarget != null) {
+ isSelected = true;
+ }
+
+ return isSelected;
+ }
+ }
+
+ #region Windows Forms Designer generated code
+ ///
+ /// This method is required for Windows Forms designer support.
+ /// Do not change the method contents inside the source code editor. The Forms designer might
+ /// not be able to load this method if it was changed manually.
+ ///
+ private void InitializeComponent() {
+ this.treeView = new System.Windows.Forms.TreeView();
+ this.SuspendLayout();
+ //
+ // treeView
+ //
+ this.treeView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.treeView.ImageIndex = -1;
+ this.treeView.Location = new System.Drawing.Point(0, 0);
+ this.treeView.Name = "treeView";
+ this.treeView.SelectedImageIndex = -1;
+ this.treeView.Size = new System.Drawing.Size(292, 266);
+ this.treeView.TabIndex = 0;
+ this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TreeViewMouseDown);
+ //
+ // NAntPadTreeView
+ //
+ this.Controls.Add(this.treeView);
+ this.Name = "NAntPadTreeView";
+ this.Size = new System.Drawing.Size(292, 266);
+ this.ResumeLayout(false);
+ }
+ #endregion
+
+ ///
+ /// User clicked the tree view.
+ ///
+ /// The event source.
+ /// The event arguments.
+ void TreeViewMouseDown(object sender, MouseEventArgs e)
+ {
+ TreeNode node = treeView.GetNodeAt(e.X, e.Y);
+
+ treeView.SelectedNode = node;
+
+ state = NAntPadTreeViewState.Nothing;
+ if (IsBuildFileNodeSelected) {
+ state = NAntPadTreeViewState.BuildFileSelected;
+ }
+
+ if (IsBuildTargetNodeSelected) {
+ state = NAntPadTreeViewState.TargetSelected;
+ }
+
+ if (IsBuildFileErrorNodeSelected) {
+ state = NAntPadTreeViewState.ErrorSelected;
+ }
+ }
+
+ ///
+ /// Gets whether a build file is selected.
+ ///
+ bool IsBuildFileNodeSelected {
+ get {
+ return treeView.SelectedNode is NAntBuildFileTreeNode;
+ }
+ }
+
+ ///
+ /// Gets whether a target is selected.
+ ///
+ bool IsBuildTargetNodeSelected {
+ get {
+ return treeView.SelectedNode is NAntBuildTargetTreeNode;
+ }
+ }
+
+ ///
+ /// Gets whether a build file error is selected.
+ ///
+ bool IsBuildFileErrorNodeSelected {
+ get {
+ return treeView.SelectedNode is NAntBuildFileErrorTreeNode;
+ }
+ }
+
+ ///
+ /// Double clicking a node on the tree view opens the corresponding
+ /// file.
+ ///
+ /// The event source.
+ /// The event arguments.
+ 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);
+ }
+ }
+ }
+
+ ///
+ /// Looks for the tree node that is displaying the specified
+ /// build file.
+ ///
+ /// The build file to look for.
+ /// The matching tree node if the build file exists
+ /// in the tree; otherwise .
+ NAntBuildFileTreeNode FindMatchingNode(string fileName)
+ {
+ foreach (NAntBuildFileTreeNode node in treeView.Nodes) {
+ string nodeFileName = Path.Combine(node.BuildFile.Directory, node.BuildFile.FileName);
+ if (String.Compare(Path.GetFullPath(fileName), Path.GetFullPath(nodeFileName), true) == 0) {
+ return node;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadTreeViewImageList.cs b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadTreeViewImageList.cs
new file mode 100644
index 0000000000..1f20620efa
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/Gui/NAntPadTreeViewImageList.cs
@@ -0,0 +1,84 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Windows.Forms;
+using ICSharpCode.SharpDevelop;
+
+namespace ICSharpCode.NAnt.Gui
+{
+ ///
+ /// Represents the images that are used in the
+ /// .
+ ///
+ public class NAntPadTreeViewImageList
+ {
+ ///
+ /// The NAnt build file image index.
+ ///
+ public static int BuildFileImage = 0;
+
+ ///
+ /// The NAnt build target image index.
+ ///
+ public static int TargetImage = 1;
+
+ ///
+ /// The NAnt default build target image index.
+ ///
+ public static int DefaultTargetImage = 2;
+
+ ///
+ /// The error icon displayed when the build file has errors.
+ ///
+ public static int BuildFileErrorImage = 3;
+
+ ///
+ /// The error icon displayed as the first target when the build file has errors.
+ ///
+ public static int TargetErrorImage = 4;
+
+ NAntPadTreeViewImageList()
+ {
+ }
+
+ ///
+ /// Creates an image list to be used in the
+ /// .
+ public static ImageList GetImageList()
+ {
+ ImageList imageList = new ImageList();
+ imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildFile"));
+ imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildTarget"));
+ imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.DefaultBuildTarget"));
+ imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildFileError"));
+ imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildTargetError"));
+
+ return imageList;
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/IsNAntRunningCondition.cs b/samples/NAnt/NAnt.AddIn/Src/IsNAntRunningCondition.cs
new file mode 100644
index 0000000000..8d233a486c
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/IsNAntRunningCondition.cs
@@ -0,0 +1,43 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using ICSharpCode.Core;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Determines whether #develop is currently running NAnt.
+ ///
+ public class IsNAntRunningCondition : IConditionEvaluator
+ {
+ public bool IsValid(object caller, Condition condition)
+ {
+ return NAntRunnerSingleton.Runner.IsRunning;
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntAddInException.cs b/samples/NAnt/NAnt.AddIn/Src/NAntAddInException.cs
new file mode 100644
index 0000000000..fcf02d9c05
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntAddInException.cs
@@ -0,0 +1,57 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Runtime.Serialization;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// The exception that is thrown when a non-fatal
+ /// error occurs in the NAnt add-in.
+ ///
+ [Serializable()]
+ public class NAntAddInException : ApplicationException
+ {
+ public NAntAddInException()
+ {
+ }
+
+ public NAntAddInException(string message)
+ : base(message)
+ {
+ }
+
+ public NAntAddInException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+
+ protected NAntAddInException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntBuildFile.cs b/samples/NAnt/NAnt.AddIn/Src/NAntBuildFile.cs
new file mode 100644
index 0000000000..b9656233f9
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntBuildFile.cs
@@ -0,0 +1,380 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using System.Xml;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Represents a NAnt Build File.
+ ///
+ public class NAntBuildFile
+ {
+ ///
+ /// Standard NAnt build file's extension.
+ ///
+ public static readonly string BuildFileNameExtension = ".build";
+
+ ///
+ /// Standard NAnt include file's extension.
+ ///
+ public static readonly string IncludeFileNameExtension = ".include";
+
+ static readonly string TargetElementName = "target";
+ static readonly string ProjectElementName = "project";
+
+ static readonly string NameAttributeName = "name";
+ static readonly string DefaultAttributeName = "default";
+
+ string directory = String.Empty;
+ string fileName = String.Empty;
+ string name = String.Empty;
+ string defaultTargetName = String.Empty;
+ NAntBuildFileError buildFileError;
+
+ NAntBuildTargetCollection targets = new NAntBuildTargetCollection();
+ NAntBuildTarget defaultTarget;
+
+ enum ParseState
+ {
+ Nothing = 0,
+ WaitingForProjectName = 1,
+ WaitingForTargetName = 2
+ }
+
+ ///
+ /// Creates a new instance of the
+ /// class.
+ ///
+ /// The build filename.
+ public NAntBuildFile(string fileName)
+ {
+ this.directory = Path.GetDirectoryName(fileName);
+ this.fileName = Path.GetFileName(fileName);
+
+ ReadBuildFile(fileName);
+ }
+
+ ///
+ /// Creates a new instance of the
+ /// class.
+ ///
+ /// The used to
+ /// feed the XML data into the
+ /// object.
+ public NAntBuildFile(TextReader reader)
+ {
+ ParseBuildFile(reader);
+ }
+
+ ///
+ /// Gets or sets the filename without the path information.
+ ///
+ public string FileName {
+ get {
+ return fileName;
+ }
+
+ set {
+ fileName = value;
+ }
+ }
+
+ ///
+ /// Gets the build file's path information.
+ ///
+ public string Directory {
+ get {
+ return directory;
+ }
+ }
+
+ ///
+ /// Gets the project name.
+ ///
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ ///
+ /// Checks the build file is a NAnt build file.
+ ///
+ public static bool IsBuildFile(string fileName)
+ {
+ bool isBuildFile = false;
+
+ string extension = Path.GetExtension(fileName);
+
+ if (String.Compare(extension, BuildFileNameExtension, true) == 0) {
+ isBuildFile = true;
+ } else if (String.Compare(extension, IncludeFileNameExtension, true) == 0) {
+ isBuildFile = true;
+ }
+
+ return isBuildFile;
+ }
+
+ ///
+ /// Gets the NAnt build targets.
+ ///
+ public NAntBuildTargetCollection Targets {
+ get {
+ return targets;
+ }
+ }
+
+ ///
+ /// Gets the default NAnt target.
+ ///
+ public NAntBuildTarget DefaultTarget {
+ get {
+ return defaultTarget;
+ }
+ }
+
+ ///
+ /// Gets whether there is an error with this build file.
+ ///
+ public bool HasError {
+ get {
+ return (buildFileError != null);
+ }
+ }
+
+ ///
+ /// Gets the error associated with the build file.
+ ///
+ public NAntBuildFileError Error {
+ get {
+ return buildFileError;
+ }
+ }
+
+ ///
+ /// Reads the NAnt build file and extracts target names.
+ ///
+ /// The name of the build file.
+ void ReadBuildFile(string fileName)
+ {
+ StreamReader reader = new StreamReader(fileName, true);
+ ParseBuildFile(reader);
+ }
+
+ ///
+ /// Gets the default target's name or returns an empty string.
+ ///
+ /// The root node of the build file.
+ /// The default target's name or an empty string if
+ /// it does not exist.
+ string GetDefaultTargetName(XmlElement root)
+ {
+ string defaultTargetName = String.Empty;
+
+ XmlAttribute nameAttribute = root.Attributes["default"];
+
+ if (nameAttribute != null) {
+ defaultTargetName = nameAttribute.Value;
+ }
+
+ return defaultTargetName;
+ }
+
+ ///
+ /// Gets the build file's project name or returns an empty string.
+ ///
+ /// The root node of the build file.
+ /// The project name or an empty string if
+ /// it does not exist.
+ string GetProjectName(XmlElement root)
+ {
+ string projectName = String.Empty;
+
+ XmlAttribute nameAttribute = root.Attributes["name"];
+
+ if (nameAttribute != null) {
+ projectName = nameAttribute.Value;
+ }
+
+ return projectName;
+ }
+
+ ///
+ /// Tests whether matches the
+ /// default target name.
+ ///
+ /// The default target
+ /// name.
+ /// A target's name.
+ /// if the target name matches
+ /// the default; otherwise .
+ bool IsDefaultTargetName(string defaultTargetName, string targetName)
+ {
+ bool isDefault = false;
+
+ if (defaultTargetName.Length > 0) {
+ if (String.Compare(defaultTargetName, targetName, true) == 0) {
+ isDefault = true;
+ }
+ }
+
+ return isDefault;
+ }
+
+ ///
+ /// Parse the NAnt build file.
+ ///
+ /// A TextReader from which to read
+ /// the build file.
+ void ParseBuildFile(TextReader textReader)
+ {
+ XmlTextReader xmlReader = new XmlTextReader(textReader);
+
+ try
+ {
+ ParseState state = ParseState.WaitingForProjectName;
+
+ while(xmlReader.Read())
+ {
+ if (state == ParseState.WaitingForProjectName) {
+ if (IsProjectElement(xmlReader)) {
+ ParseProjectElement(xmlReader);
+ state = ParseState.WaitingForTargetName;
+ }
+ } else {
+ if (IsTargetElement(xmlReader)) {
+ ParseTargetElement(xmlReader);
+ }
+ }
+ }
+ } catch(XmlException ex) {
+ buildFileError = new NAntBuildFileError(ex.Message, ex.LineNumber - 1, ex.LinePosition - 1);
+ } finally {
+ xmlReader.Close();
+ }
+ }
+
+ ///
+ /// Parses the current XmlTextReader node if it
+ /// is the NAnt Project element.
+ ///
+ /// An XmlTextReader currently being
+ /// read.
+ void ParseProjectElement(XmlTextReader xmlReader)
+ {
+ name = GetAttribute(xmlReader, NameAttributeName);
+ defaultTargetName = GetAttribute(xmlReader, DefaultAttributeName);
+ }
+
+ ///
+ /// Tests whether the current element is the project element.
+ ///
+ ///
+ /// if the current
+ /// element is the project element;
+ /// otherwise
+ bool IsProjectElement(XmlTextReader xmlReader)
+ {
+ bool isProjectElement = false;
+
+ if (xmlReader.NodeType == XmlNodeType.Element) {
+ if (xmlReader.Name == ProjectElementName) {
+ isProjectElement = true;
+ }
+ }
+
+ return isProjectElement;
+ }
+
+ ///
+ /// Tests whether the current element is a target element.
+ ///
+ /// An xml text reader currently
+ /// reading the build file xml.
+ /// if the current
+ /// element is a target element;
+ /// otherwise
+ bool IsTargetElement(XmlTextReader xmlReader)
+ {
+ bool isTargetElement = false;
+
+ if (xmlReader.NodeType == XmlNodeType.Element) {
+ if (xmlReader.Name == TargetElementName) {
+ isTargetElement = true;
+ }
+ }
+
+ return isTargetElement;
+ }
+
+ ///
+ /// Parses the current XmlTextReader node if it
+ /// is the NAnt Target element.
+ ///
+ void ParseTargetElement(XmlTextReader xmlReader)
+ {
+ // Take off one for line/col since SharpDevelop is zero based.
+ int line = xmlReader.LineNumber - 1;
+ int col = xmlReader.LinePosition - 1;
+
+ string targetName = GetAttribute(xmlReader, NameAttributeName);
+
+ bool isDefaultTarget = IsDefaultTargetName(defaultTargetName, targetName);
+
+ NAntBuildTarget target =
+ new NAntBuildTarget(targetName, isDefaultTarget, line, col);
+
+ targets.Add(target);
+
+ if (isDefaultTarget) {
+ defaultTarget = target;
+ }
+ }
+
+ ///
+ /// Gets the named attribute's value.
+ ///
+ /// The attribute's value or an empty string if
+ /// it was not found.
+ ///
+ string GetAttribute(XmlTextReader xmlReader, string name)
+ {
+ string attributeValue = String.Empty;
+
+ if (xmlReader.MoveToAttribute(name)) {
+ if (xmlReader.Value != null) {
+ attributeValue = xmlReader.Value;
+ }
+ }
+
+ return attributeValue;
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntBuildFileError.cs b/samples/NAnt/NAnt.AddIn/Src/NAntBuildFileError.cs
new file mode 100644
index 0000000000..9040113bd4
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntBuildFileError.cs
@@ -0,0 +1,72 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Represents an error found in the NAnt build file.
+ ///
+ public class NAntBuildFileError
+ {
+ string message = String.Empty;
+ int line;
+ int column;
+
+ public NAntBuildFileError(string message, int line, int column)
+ {
+ this.message = message;
+ this.line = line;
+ this.column = column;
+ }
+
+ public string Message {
+ get {
+ return message;
+ }
+ }
+
+ public int Column {
+ get {
+ return column;
+ }
+ set {
+ column = value;
+ }
+ }
+ public int Line {
+ get {
+ return line;
+ }
+ set {
+ line = value;
+ }
+ }
+
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntBuildTarget.cs b/samples/NAnt/NAnt.AddIn/Src/NAntBuildTarget.cs
new file mode 100644
index 0000000000..9ac6df98c0
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntBuildTarget.cs
@@ -0,0 +1,104 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Represents a NAnt build target.
+ ///
+ public class NAntBuildTarget
+ {
+ string name = String.Empty;
+ bool isDefault;
+ int line;
+ int column;
+
+ public NAntBuildTarget()
+ {
+ }
+
+ ///
+ /// Creates a new instance of the
+ /// with the specified name.
+ ///
+ /// The target name.
+ /// if the
+ /// target is the default target; otherwise
+ /// .
+ /// The line number of the target element
+ /// in the build file.
+ /// The column number of the target element
+ /// in the build file.
+ public NAntBuildTarget(string name, bool isDefault, int line, int col)
+ {
+ this.name = name;
+ this.isDefault = isDefault;
+ this.line = line;
+ this.column = col;
+ }
+
+ ///
+ /// Gets the name of the target.
+ ///
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ ///
+ /// Gets whether this is the default target.
+ ///
+ public bool IsDefault {
+ get {
+ return isDefault;
+ }
+ }
+
+ ///
+ /// Gets the line in the build file where this
+ /// target can be found.
+ ///
+ public int Line {
+ get {
+ return line;
+ }
+ }
+
+ ///
+ /// Gets the column in the build file where this
+ /// target can be found.
+ ///
+ public int Column {
+ get {
+ return column;
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntBuildTargetCollection.cs b/samples/NAnt/NAnt.AddIn/Src/NAntBuildTargetCollection.cs
new file mode 100644
index 0000000000..ef2d35a8bf
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntBuildTargetCollection.cs
@@ -0,0 +1,272 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Collections;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ ///
+ /// A collection that stores objects.
+ ///
+ ///
+ ///
+ [Serializable()]
+ public class NAntBuildTargetCollection : CollectionBase {
+
+ ///
+ ///
+ /// Initializes a new instance of .
+ ///
+ ///
+ public NAntBuildTargetCollection()
+ {
+ }
+
+ ///
+ ///
+ /// Initializes a new instance of based on another .
+ ///
+ ///
+ ///
+ /// A from which the contents are copied
+ ///
+ public NAntBuildTargetCollection(NAntBuildTargetCollection val)
+ {
+ this.AddRange(val);
+ }
+
+ ///
+ ///
+ /// Initializes a new instance of containing any array of objects.
+ ///
+ ///
+ ///
+ /// A array of objects with which to intialize the collection
+ ///
+ public NAntBuildTargetCollection(NAntBuildTarget[] val)
+ {
+ this.AddRange(val);
+ }
+
+ ///
+ /// Represents the entry at the specified index of the .
+ ///
+ /// The zero-based index of the entry to locate in the collection.
+ ///
+ /// The entry at the specified index of the collection.
+ ///
+ /// is outside the valid range of indexes for the collection.
+ public NAntBuildTarget this[int index] {
+ get {
+ return ((NAntBuildTarget)(List[index]));
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ ///
+ /// Adds a with the specified value to the
+ /// .
+ ///
+ /// The to add.
+ ///
+ /// The index at which the new element was inserted.
+ ///
+ ///
+ public int Add(NAntBuildTarget val)
+ {
+ return List.Add(val);
+ }
+
+ ///
+ /// Copies the elements of an array to the end of the .
+ ///
+ ///
+ /// An array of type containing the objects to add to the collection.
+ ///
+ ///
+ /// None.
+ ///
+ ///
+ public void AddRange(NAntBuildTarget[] val)
+ {
+ for (int i = 0; i < val.Length; i++) {
+ this.Add(val[i]);
+ }
+ }
+
+ ///
+ ///
+ /// Adds the contents of another to the end of the collection.
+ ///
+ ///
+ ///
+ /// A containing the objects to add to the collection.
+ ///
+ ///
+ /// None.
+ ///
+ ///
+ public void AddRange(NAntBuildTargetCollection val)
+ {
+ for (int i = 0; i < val.Count; i++)
+ {
+ this.Add(val[i]);
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether the
+ /// contains the specified .
+ ///
+ /// The to locate.
+ ///
+ /// if the is contained in the collection;
+ /// otherwise, .
+ ///
+ ///
+ public bool Contains(NAntBuildTarget val)
+ {
+ return List.Contains(val);
+ }
+
+ ///
+ /// Copies the values to a one-dimensional instance at the
+ /// specified index.
+ ///
+ /// The one-dimensional that is the destination of the values copied from .
+ /// The index in where copying begins.
+ ///
+ /// None.
+ ///
+ /// is multidimensional. -or- The number of elements in the is greater than the available space between and the end of .
+ /// is .
+ /// is less than 's lowbound.
+ ///
+ public void CopyTo(NAntBuildTarget[] array, int index)
+ {
+ List.CopyTo(array, index);
+ }
+
+ ///
+ /// Returns the index of a in
+ /// the .
+ ///
+ /// The to locate.
+ ///
+ /// The index of the of in the
+ /// , if found; otherwise, -1.
+ ///
+ ///
+ public int IndexOf(NAntBuildTarget val)
+ {
+ return List.IndexOf(val);
+ }
+
+ ///
+ /// Inserts a into the at the specified index.
+ ///
+ /// The zero-based index where should be inserted.
+ /// The to insert.
+ /// None.
+ ///
+ public void Insert(int index, NAntBuildTarget val)
+ {
+ List.Insert(index, val);
+ }
+
+ ///
+ /// Returns an enumerator that can iterate through
+ /// the .
+ ///
+ /// None.
+ ///
+ public new NAntBuildTargetEnumerator GetEnumerator()
+ {
+ return new NAntBuildTargetEnumerator(this);
+ }
+
+ ///
+ /// Removes a specific from the
+ /// .
+ ///
+ /// The to remove from the .
+ /// None.
+ /// is not found in the Collection.
+ public void Remove(NAntBuildTarget val)
+ {
+ List.Remove(val);
+ }
+
+ public class NAntBuildTargetEnumerator : IEnumerator
+ {
+ IEnumerator baseEnumerator;
+ IEnumerable temp;
+
+ public NAntBuildTargetEnumerator(NAntBuildTargetCollection mappings)
+ {
+ this.temp = ((IEnumerable)(mappings));
+ this.baseEnumerator = temp.GetEnumerator();
+ }
+
+ public NAntBuildTarget Current {
+ get {
+ return ((NAntBuildTarget)(baseEnumerator.Current));
+ }
+ }
+
+ object IEnumerator.Current {
+ get {
+ return baseEnumerator.Current;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ return baseEnumerator.MoveNext();
+ }
+
+ bool IEnumerator.MoveNext()
+ {
+ return baseEnumerator.MoveNext();
+ }
+
+ public void Reset()
+ {
+ baseEnumerator.Reset();
+ }
+
+ void IEnumerator.Reset()
+ {
+ baseEnumerator.Reset();
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntExitEventArgs.cs b/samples/NAnt/NAnt.AddIn/Src/NAntExitEventArgs.cs
new file mode 100644
index 0000000000..28a020a1df
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntExitEventArgs.cs
@@ -0,0 +1,79 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Represents the method that will handle the
+ /// event.
+ ///
+ public delegate void NAntExitEventHandler(object sender, NAntExitEventArgs e);
+
+ ///
+ /// The event arguments.
+ ///
+ public class NAntExitEventArgs : EventArgs
+ {
+ string output;
+ int exitCode;
+ string error;
+
+ public NAntExitEventArgs(string output, string error, int exitCode)
+ {
+ this.output = output;
+ this.error = error;
+ this.exitCode = exitCode;
+ }
+
+ ///
+ /// Gets the command line output from NAnt.
+ ///
+ public string Output {
+ get {
+ return output;
+ }
+ }
+
+ public string Error {
+ get {
+ return error;
+ }
+ }
+
+ ///
+ /// Gets the NAnt exit code.
+ ///
+ public int ExitCode {
+ get {
+ return exitCode;
+ }
+ }
+
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntOutputParser.cs b/samples/NAnt/NAnt.AddIn/Src/NAntOutputParser.cs
new file mode 100644
index 0000000000..a61ffc8467
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntOutputParser.cs
@@ -0,0 +1,344 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.IO;
+using System.Text.RegularExpressions;
+
+using ICSharpCode.SharpDevelop;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Utility class that parses the console output from NAnt.
+ ///
+ public class NAntOutputParser
+ {
+ NAntOutputParser()
+ {
+ }
+
+ ///
+ /// Parses the NAnt console output and extracts a set of
+ /// Tasks.
+ ///
+ /// The NAnt console output to parse.
+ /// A .
+ public static TaskCollection Parse(string output)
+ {
+ TaskCollection tasks = new TaskCollection();
+
+ output = output.Replace("\r\n", "\n");
+
+ // Look for errors on a per line basis.
+ Task task = null;
+ StringReader reader = new StringReader(output);
+ while (reader.Peek() != -1) {
+
+ string currentLine = reader.ReadLine();
+ if (currentLine.StartsWith("BUILD FAILED")) {
+ break;
+ }
+
+ task = ParseLine(currentLine);
+ if (task != null) {
+ tasks.Add(task);
+ }
+ }
+ reader.Close();
+
+ // Look for multiline build errors.
+ task = ParseMultilineBuildError(output);
+ if (task != null) {
+ tasks.Add(task);
+ }
+
+ // Look for NAnt build failed.
+ task = ParseNAntBuildFailedError(output);
+ if (task != null) {
+ tasks.Add(task);
+ }
+
+ return tasks;
+ }
+
+ ///
+ /// Parses a single line of text looking for errors.
+ ///
+ /// A NAnt output line.
+ /// A if the line contains an error or
+ /// a warning; otherwise .
+ static Task ParseLine(string textLine)
+ {
+ Task task = null;
+
+ task = ParseCSharpError(textLine);
+
+ if (task == null) {
+ task = ParseVBError(textLine);
+ }
+
+ if (task == null) {
+ task = ParseFatalError(textLine);
+ }
+
+ if (task == null) {
+ task = ParseVBFatalError(textLine);
+ }
+
+ if (task == null) {
+ task = ParseNAntWarning(textLine);
+ }
+ if (task == null) {
+ task = ParseNAntError(textLine);
+ }
+
+ return task;
+ }
+
+ ///
+ /// Looks for errors of the form
+ /// "C:/MyProject/MyProject.build(40,3): error CS1000: An error occurred."
+ ///
+ /// The line of text to parse.
+ /// A if an error was found; otherwise
+ /// .
+ static Task ParseCSharpError(string textLine)
+ {
+ Task task = null;
+ Match match = Regex.Match(textLine, @"^.*?(\w+:[/\\].*?)\(([\d]*),([\d]*)\): (.*?) (.*?): (.*?)$");
+ if (match.Success) {
+ try {
+ // Take off 1 for line/col since SharpDevelop is zero index based.
+ int line = Convert.ToInt32(match.Groups[2].Value) - 1;
+ int col = Convert.ToInt32(match.Groups[3].Value) - 1;
+ string description = String.Concat(match.Groups[6].Value, " (", match.Groups[5], ")");
+
+ TaskType taskType = TaskType.Error;
+ if (String.Compare(match.Groups[4].Value, "warning", true) == 0) {
+ taskType = TaskType.Warning;
+ }
+ task = new Task(match.Groups[1].Value, description, col, line, taskType);
+ } catch (Exception) {
+ // Ignore.
+ }
+ }
+
+ return task;
+ }
+
+ ///
+ /// Looks for errors of the form
+ /// "C:/MyProject/MyProject.build(40,3): ifnot is deprecated."
+ ///
+ /// The line of text to parse.
+ /// A if an error was found; otherwise
+ /// .
+ static Task ParseNAntError(string textLine)
+ {
+ Task task = null;
+
+ Match match = Regex.Match(textLine, @"^.*?(\w+:[/\\].*?)\(([\d]*),([\d]*)\): (.*?)$");
+ if (match.Success) {
+ try {
+ // Take off 1 for line/col since SharpDevelop is zero index based.
+ int line = Convert.ToInt32(match.Groups[2].Value) - 1;
+ int col = Convert.ToInt32(match.Groups[3].Value) - 1;
+
+ task = new Task(match.Groups[1].Value, match.Groups[4].Value, col, line, TaskType.Warning);
+ } catch (Exception) {
+ // Ignore.
+ }
+ }
+
+ return task;
+ }
+
+ ///
+ /// Looks for errors of the form
+ /// "C:/MyProject/MyProject.build(40): error CS1000: An error occurred."
+ ///
+ ///
+ /// This should handle C++ errors too.
+ /// The line of text to parse.
+ /// A if an error was found; otherwise
+ /// .
+ static Task ParseVBError(string textLine)
+ {
+ Task task = null;
+ Match match = Regex.Match(textLine, @"^.*?(\w+:[/\\].*?)\(([\d]*)\) : (.*?) (.*?): (.*?)$");
+ if (match.Success) {
+ try {
+ // Take off 1 for line/col since SharpDevelop is zero index based.
+ int line = Convert.ToInt32(match.Groups[2].Value) - 1;
+ string description = String.Concat(match.Groups[5].Value, " (", match.Groups[4], ")");
+
+ TaskType taskType = TaskType.Error;
+ if (String.Compare(match.Groups[3].Value, "warning", true) == 0) {
+ taskType = TaskType.Warning;
+ }
+ task = new Task(match.Groups[1].Value, description, 0, line, taskType);
+ } catch (Exception) {
+ // Ignore.
+ }
+ }
+
+ return task;
+ }
+
+ ///
+ /// Looks for errors of the form
+ /// "fatal error CS00042: An error occurred."
+ ///
+ /// The line of text to parse.
+ /// A if an error was found; otherwise
+ /// .
+ static Task ParseFatalError(string textLine)
+ {
+ Task task = null;
+ Match match = Regex.Match(textLine, @"^.*?(fatal error .*?: .*?)$");
+ if (match.Success) {
+ try {
+ task = new Task(String.Empty, match.Groups[1].Value, 0, 0, TaskType.Error);
+ } catch (Exception) {
+ // Ignore.
+ }
+ }
+
+ return task;
+ }
+
+ ///
+ /// Looks for errors of the form
+ /// "vbc : error BC31019: Unable to write to output file."
+ ///
+ /// The line of text to parse.
+ /// A if an error was found; otherwise
+ /// .
+ static Task ParseVBFatalError(string textLine)
+ {
+ Task task = null;
+ Match match = Regex.Match(textLine, @"^.*?vbc : error (.*?): (.*?)$");
+ if (match.Success) {
+ try {
+ string description = String.Concat(match.Groups[2].Value, " (", match.Groups[1].Value, ")");
+ task = new Task(String.Empty, description, 0, 0, TaskType.Error);
+ } catch (Exception) {
+ // Ignore.
+ }
+ }
+
+ return task;
+ }
+
+ ///
+ /// Looks for errors of the form
+ /// "fatal error CS00042: An error occurred."
+ ///
+ /// The line of text to parse.
+ /// A if a warning was found; otherwise
+ /// .
+ static Task ParseNAntWarning(string textLine)
+ {
+ Task task = null;
+ Match match = Regex.Match(textLine, @"^.*?(Read-only property .*? cannot be overwritten.)$");
+ if (match.Success) {
+ try {
+ task = new Task(String.Empty, match.Groups[1].Value, 0, 0, TaskType.Warning);
+ } catch (Exception) {
+ // Ignore.
+ }
+ }
+
+ return task;
+ }
+
+ ///
+ /// Looks for errors of the form
+ /// "BUILD FAILED"
+ /// "[csc] C:/foo/foo.cs(5,5):"
+ /// "Something bad happened."
+ ///
+ /// The line of text to parse.
+ /// A if an error was found; otherwise
+ /// .
+ static Task ParseNAntBuildFailedError(string output)
+ {
+ Task task = null;
+
+ Match match = Regex.Match(output, @"^BUILD FAILED.*?$\n^$\n^(\w+:[/\\].*?)\(([\d]*),([\d]*)\):$\n^(.*?)$\n^(.*?)$", RegexOptions.Multiline);
+
+ if (match.Success) {
+
+ try {
+ // Take off 1 for line/col since SharpDevelop is zero index based.
+ int line = Convert.ToInt32(match.Groups[2].Value) - 1;
+ int col = Convert.ToInt32(match.Groups[3].Value) - 1;
+ string description = String.Concat(match.Groups[4], Environment.NewLine, match.Groups[5]);
+ task = new Task(match.Groups[1].Value, description, col, line, TaskType.Error);
+ } catch(Exception) { };
+ } else {
+
+ match = Regex.Match(output, @"^BUILD FAILED$\n^$\n^(.*?)$", RegexOptions.Multiline);
+
+ if (match.Success) {
+ task = new Task(String.Empty, match.Groups[1].Value, 0, 0, TaskType.Error);
+ }
+ }
+
+ return task;
+ }
+
+ ///
+ /// Parses errors of the form.
+ /// "[delete] C:\foo\foo.build(94,5):"
+ /// "[delete] Cannot delete directory 'C:\foo\bin'. The directory does not exist."
+ ///
+ /// The line of text to parse.
+ /// A if an error was found; otherwise
+ /// .
+ static Task ParseMultilineBuildError(string output)
+ {
+ Task task = null;
+
+ Match match = Regex.Match(output, @"^.*?\[delete\] (\w+:[/\\].*?)\(([\d]*),([\d]*)\):$\n^.*?\[delete\] (.*?)$", RegexOptions.Multiline);
+
+ if (match.Success) {
+
+ try {
+ // Take off 1 for line/col since SharpDevelop is zero index based.
+ int line = Convert.ToInt32(match.Groups[2].Value) - 1;
+ int col = Convert.ToInt32(match.Groups[3].Value) - 1;
+ string description = String.Concat(match.Groups[4]);
+ task = new Task(match.Groups[1].Value, description, col, line, TaskType.Error);
+ } catch(Exception) { };
+ }
+
+ return task;
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntRunner.cs b/samples/NAnt/NAnt.AddIn/Src/NAntRunner.cs
new file mode 100644
index 0000000000..7eec303b79
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntRunner.cs
@@ -0,0 +1,304 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Text;
+using ICSharpCode.SharpDevelop.Util;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Runs NAnt.
+ ///
+ public class NAntRunner
+ {
+ string arguments = String.Empty;
+ string buildFileName = String.Empty;
+ string nantFileName = String.Empty;
+ string workingDirectory = String.Empty;
+ bool verbose;
+ bool quiet;
+ bool showLogo;
+ bool debugMode;
+ ProcessRunner runner;
+
+ ///
+ /// Triggered when NAnt exits.
+ ///
+ public event NAntExitEventHandler NAntExited;
+
+ ///
+ /// The NAnt runner was started.
+ ///
+ public event EventHandler NAntStarted;
+
+ ///
+ /// The NAnt runner was stopped. Being stopped is not the
+ /// same as NAnt exiting.
+ ///
+ public event EventHandler NAntStopped;
+
+ ///
+ /// Triggered when an output line is received from NAnt.
+ ///
+ public event LineReceivedEventHandler OutputLineReceived;
+
+ public NAntRunner()
+ {
+ }
+
+ ///
+ /// Gets or sets the NAnt -buildfile parameter.
+ ///
+ public string BuildFileName {
+ get {
+ return buildFileName;
+ }
+
+ set {
+ buildFileName = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the NAnt executable path.
+ ///
+ public string NAntFileName {
+ get {
+ return nantFileName;
+ }
+
+ set {
+ nantFileName = value;
+ }
+ }
+
+ public string WorkingDirectory {
+ get {
+ return workingDirectory;
+ }
+
+ set {
+ workingDirectory = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the NAnt -verbose option.
+ ///
+ public bool Verbose {
+ get {
+ return verbose;
+ }
+
+ set {
+ verbose = value;
+ }
+ }
+
+ public string Arguments {
+ get {
+ return arguments;
+ }
+
+ set {
+ arguments = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the NAnt -quiet option.
+ ///
+ public bool Quiet {
+ get {
+ return quiet;
+ }
+
+ set {
+ quiet = value;
+ }
+ }
+
+ ///
+ /// Maps to the NAnt -nologo option.
+ ///
+ public bool ShowLogo {
+ get {
+ return showLogo;
+ }
+
+ set {
+ showLogo = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the NAnt -debug option.
+ ///
+ public bool DebugMode {
+ get {
+ return debugMode;
+ }
+
+ set {
+ debugMode = value;
+ }
+ }
+
+ ///
+ /// Gets the full NAnt command line that will be used by
+ /// the runner.
+ ///
+ public string CommandLine {
+ get {
+ return String.Concat(nantFileName, " ", GetArguments());
+ }
+ }
+
+ ///
+ /// Gets whether the NAnt runner is currently running.
+ ///
+ public bool IsRunning {
+ get {
+ bool isRunning = false;
+
+ if (runner != null) {
+ isRunning = runner.IsRunning;
+ }
+
+ return isRunning;
+ }
+ }
+
+ public void Start()
+ {
+ string arguments = GetArguments();
+
+ runner = new ProcessRunner();
+ runner.WorkingDirectory = workingDirectory;
+ runner.ProcessExited += new EventHandler(ProcessExited);
+
+ if (OutputLineReceived != null) {
+ runner.OutputLineReceived += new LineReceivedEventHandler(OnOutputLineReceived);
+ runner.ErrorLineReceived += new LineReceivedEventHandler(OnOutputLineReceived);
+ }
+ runner.Start(nantFileName, arguments);
+ OnNAntStarted();
+ }
+
+ ///
+ /// Stops the currently running NAnt instance.
+ ///
+ public void Stop()
+ {
+ if (runner != null) {
+ runner.Kill();
+ OnNAntStopped();
+ }
+ }
+
+ protected void OnNAntExited(string output, string error, int exitCode)
+ {
+ if (NAntExited != null) {
+ NAntExited(this, new NAntExitEventArgs(output, error, exitCode));
+ }
+ }
+
+ protected void OnNAntStarted()
+ {
+ if (NAntStarted != null) {
+ NAntStarted(this, new EventArgs());
+ }
+ }
+
+ protected void OnNAntStopped()
+ {
+ if (NAntStopped != null) {
+ NAntStopped(this, new EventArgs());
+ }
+ }
+
+ ///
+ /// Raises the event.
+ ///
+ /// The event source.
+ /// The event arguments.
+ protected void OnOutputLineReceived(object sender, LineReceivedEventArgs e)
+ {
+ if (OutputLineReceived != null) {
+ OutputLineReceived(this, e);
+ }
+ }
+
+ ///
+ /// Handles the NAnt process exit event.
+ ///
+ /// The event source.
+ /// The event arguments.
+ void ProcessExited(object sender, EventArgs e)
+ {
+ ProcessRunner runner = (ProcessRunner)sender;
+ OnNAntExited(runner.StandardOutput, runner.StandardError, runner.ExitCode);
+ }
+
+ ///
+ /// Adds extra command line arguments to those specified
+ /// by the user in the string.
+ ///
+ ///
+ string GetArguments()
+ {
+ StringBuilder nantArguments = new StringBuilder();
+
+ if (!showLogo) {
+ nantArguments.Append("-nologo ");
+ }
+
+ if (verbose) {
+ nantArguments.Append("-v ");
+ }
+
+ if (quiet) {
+ nantArguments.Append("-q ");
+ }
+
+ if (debugMode) {
+ nantArguments.Append("-debug ");
+ }
+
+ if (buildFileName.Length > 0) {
+ nantArguments.Append("-buildfile:");
+ nantArguments.Append(buildFileName);
+ nantArguments.Append(" ");
+ }
+
+ nantArguments.Append(this.arguments);
+
+ return nantArguments.ToString();
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/NAntRunnerSingleton.cs b/samples/NAnt/NAnt.AddIn/Src/NAntRunnerSingleton.cs
new file mode 100644
index 0000000000..1624c5b13e
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/NAntRunnerSingleton.cs
@@ -0,0 +1,59 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ /// Single NAntRunner that is used by all commands.
+ ///
+ ///
+ /// The NAnt add-in only allows one build to be run at a time.
+ ///
+ public class NAntRunnerSingleton
+ {
+ static NAntRunner runner;
+
+ NAntRunnerSingleton()
+ {
+ }
+
+ ///
+ /// Gets the instance.
+ ///
+ public static NAntRunner Runner {
+ get {
+ if (runner == null) {
+ runner = new NAntRunner();
+ }
+
+ return runner;
+ }
+ }
+ }
+}
diff --git a/samples/NAnt/NAnt.AddIn/Src/TaskCollection.cs b/samples/NAnt/NAnt.AddIn/Src/TaskCollection.cs
new file mode 100644
index 0000000000..3fa451a993
--- /dev/null
+++ b/samples/NAnt/NAnt.AddIn/Src/TaskCollection.cs
@@ -0,0 +1,273 @@
+// SharpDevelop samples
+// Copyright (c) 2007, AlphaSierraPapa
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// - Redistributions of source code must retain the above copyright notice, this list
+// of conditions and the following disclaimer.
+//
+// - Redistributions in binary form must reproduce the above copyright notice, this list
+// of conditions and the following disclaimer in the documentation and/or other materials
+// provided with the distribution.
+//
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+using System;
+using System.Collections;
+using ICSharpCode.SharpDevelop;
+
+namespace ICSharpCode.NAnt
+{
+ ///
+ ///
+ /// A collection that stores objects.
+ ///
+ ///
+ ///
+ [Serializable()]
+ public class TaskCollection : CollectionBase {
+
+ ///
+ ///
+ /// Initializes a new instance of .
+ ///
+ ///
+ public TaskCollection()
+ {
+ }
+
+ ///
+ ///
+ /// Initializes a new instance of based on another .
+ ///
+ ///
+ ///
+ /// A from which the contents are copied
+ ///
+ public TaskCollection(TaskCollection val)
+ {
+ this.AddRange(val);
+ }
+
+ ///
+ ///
+ /// Initializes a new instance of containing any array of objects.
+ ///
+ ///
+ ///
+ /// A array of objects with which to intialize the collection
+ ///
+ public TaskCollection(Task[] val)
+ {
+ this.AddRange(val);
+ }
+
+ ///
+ /// Represents the entry at the specified index of the .
+ ///
+ /// The zero-based index of the entry to locate in the collection.
+ ///
+ /// The entry at the specified index of the collection.
+ ///
+ /// is outside the valid range of indexes for the collection.
+ public Task this[int index] {
+ get {
+ return ((Task)(List[index]));
+ }
+ set {
+ List[index] = value;
+ }
+ }
+
+ ///
+ /// Adds a with the specified value to the
+ /// .
+ ///
+ /// The to add.
+ ///
+ /// The index at which the new element was inserted.
+ ///
+ ///
+ public int Add(Task val)
+ {
+ return List.Add(val);
+ }
+
+ ///
+ /// Copies the elements of an array to the end of the .
+ ///
+ ///
+ /// An array of type containing the objects to add to the collection.
+ ///
+ ///
+ /// None.
+ ///
+ ///
+ public void AddRange(Task[] val)
+ {
+ for (int i = 0; i < val.Length; i++) {
+ this.Add(val[i]);
+ }
+ }
+
+ ///
+ ///
+ /// Adds the contents of another to the end of the collection.
+ ///
+ ///
+ ///
+ /// A containing the objects to add to the collection.
+ ///
+ ///
+ /// None.
+ ///
+ ///
+ public void AddRange(TaskCollection val)
+ {
+ for (int i = 0; i < val.Count; i++)
+ {
+ this.Add(val[i]);
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether the
+ /// contains the specified .
+ ///
+ /// The to locate.
+ ///
+ /// if the is contained in the collection;
+ /// otherwise, .
+ ///
+ ///
+ public bool Contains(Task val)
+ {
+ return List.Contains(val);
+ }
+
+ ///
+ /// Copies the values to a one-dimensional instance at the
+ /// specified index.
+ ///
+ /// The one-dimensional that is the destination of the values copied from .
+ /// The index in where copying begins.
+ ///
+ /// None.
+ ///
+ /// is multidimensional. -or- The number of elements in the is greater than the available space between and the end of .
+ /// is .
+ /// is less than 's lowbound.
+ ///
+ public void CopyTo(Task[] array, int index)
+ {
+ List.CopyTo(array, index);
+ }
+
+ ///
+ /// Returns the index of a in
+ /// the .
+ ///
+ /// The to locate.
+ ///
+ /// The index of the of in the
+ /// , if found; otherwise, -1.
+ ///
+ ///
+ public int IndexOf(Task val)
+ {
+ return List.IndexOf(val);
+ }
+
+ ///
+ /// Inserts a into the at the specified index.
+ ///
+ /// The zero-based index where should be inserted.
+ /// The to insert.
+ /// None.
+ ///
+ public void Insert(int index, Task val)
+ {
+ List.Insert(index, val);
+ }
+
+ ///
+ /// Returns an enumerator that can iterate through
+ /// the .
+ ///
+ /// None.
+ ///
+ public new TaskEnumerator GetEnumerator()
+ {
+ return new TaskEnumerator(this);
+ }
+
+ ///
+ /// Removes a specific from the
+ /// .
+ ///
+ /// The to remove from the .
+ /// None.
+ /// is not found in the Collection.
+ public void Remove(Task val)
+ {
+ List.Remove(val);
+ }
+
+ public class TaskEnumerator : IEnumerator
+ {
+ IEnumerator baseEnumerator;
+ IEnumerable temp;
+
+ public TaskEnumerator(TaskCollection mappings)
+ {
+ this.temp = ((IEnumerable)(mappings));
+ this.baseEnumerator = temp.GetEnumerator();
+ }
+
+ public Task Current {
+ get {
+ return ((Task)(baseEnumerator.Current));
+ }
+ }
+
+ object IEnumerator.Current {
+ get {
+ return baseEnumerator.Current;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ return baseEnumerator.MoveNext();
+ }
+
+ bool IEnumerator.MoveNext()
+ {
+ return baseEnumerator.MoveNext();
+ }
+
+ public void Reset()
+ {
+ baseEnumerator.Reset();
+ }
+
+ void IEnumerator.Reset()
+ {
+ baseEnumerator.Reset();
+ }
+ }
+ }
+}
diff --git a/data/templates/file/Misc/EmptyNAntBuildFile.xft b/samples/NAnt/NAnt.AddIn/Templates/EmptyNAntBuildFile.xft
similarity index 73%
rename from data/templates/file/Misc/EmptyNAntBuildFile.xft
rename to samples/NAnt/NAnt.AddIn/Templates/EmptyNAntBuildFile.xft
index 9705139e6e..779314b10a 100644
--- a/data/templates/file/Misc/EmptyNAntBuildFile.xft
+++ b/samples/NAnt/NAnt.AddIn/Templates/EmptyNAntBuildFile.xft
@@ -2,13 +2,13 @@
- ${res:Templates.File.NAnt.NAntBuildFile.Description}
+ Creates a new NAnt build file.
diff --git a/src/Main/StartUp/Project/Resources/BitmapResources.resources b/src/Main/StartUp/Project/Resources/BitmapResources.resources
index 5708ee2a4e..1ec51336d1 100644
Binary files a/src/Main/StartUp/Project/Resources/BitmapResources.resources and b/src/Main/StartUp/Project/Resources/BitmapResources.resources differ