Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hutchinson <mhutchinson@novell.com>2009-08-12 23:19:27 +0400
committerMichael Hutchinson <mhutchinson@novell.com>2009-08-12 23:19:27 +0400
commitffaf27a31c6b0f0a118ddc1b670ae3fafafdc8fc (patch)
tree575f8076507e9ad5bacbfd8e7a509f2cdeb5b219
parentc9825fb73d1cb4297054cd9148996de5fd244a55 (diff)
parent6d6562f4bb50bb656a9d69c5d3f5fc7d47724398 (diff)
* profiles/all:
* extras/extras.mdw: Remove the ASP.NET sln from extras since it's now in main. * main/Main.sln: * main/configure.in: * main/src/addins/Makefile.am: * main/src/addins/TextTemplating: * main/src/addins/AspNet/Makefile.am: * main/src/addins/TextTemplating/Makefile.am: * main/src/addins/TextTemplating/TextTransform: * main/src/addins/AspNet/MonoDevelop.AspNet.Mvc: * main/src/addins/TextTemplating/Mono.TextTemplating: * main/src/addins/TextTemplating/TextTransform/Makefile.am: * main/src/addins/TextTemplating/Mono.TextTemplating.Tests: * main/src/addins/TextTemplating/MonoDevelop.TextTemplating: * main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Makefile.am: * main/src/addins/TextTemplating/Mono.TextTemplating/Makefile.am: * main/src/addins/TextTemplating/TextTransform/TextTransform.csproj: * main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj: * main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am: * main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj: * main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj: * main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj: * main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj: Include the ASP.NET MVC and TextTemplating addins in the main solution and build. * main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight.csproj: Fix build. svn path=/trunk/monodevelop/; revision=139787
-rw-r--r--extras/extras.mdw3
-rw-r--r--main/ChangeLog6
-rw-r--r--main/Main.sln58
-rw-r--r--main/configure.in6
-rw-r--r--main/src/addins/AspNet/ChangeLog6
-rw-r--r--main/src/addins/AspNet/Makefile.am3
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcCommands.cs38
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs133
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectBinding.cs57
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectConfiguration.cs40
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AssemblyInfo.cs51
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/ChangeLog267
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/CodeTemplates/AddView/Empty.tt29
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/AddViewDialog.cs311
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs179
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Makefile.am70
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.addin.xml99
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj136
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Controller.xft.xml46
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/EmptyProject.xpt.xml52
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/GlobalAsax.xft.xml61
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Project.xpt.xml92
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/UserControl.xft.xml26
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewContentPage.xft.xml26
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewMasterPage.xft.xml38
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewPage.xft.xml35
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigApp.xft.xml143
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigViews.xft.xml59
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/TextTemplating/MvcTextTemplateHost.cs84
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs370
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/generated.cs35
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/gui.stetic436
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/ChangeLog5
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj4
-rw-r--r--main/src/addins/ChangeLog6
-rw-r--r--main/src/addins/Makefile.am3
-rw-r--r--main/src/addins/MonoDevelop.Moonlight/ChangeLog4
-rw-r--r--main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight.csproj9
-rw-r--r--main/src/addins/TextTemplating/ChangeLog9
-rw-r--r--main/src/addins/TextTemplating/Makefile.am4
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ChangeLog42
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs112
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs174
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj47
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs191
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs35
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/ChangeLog177
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Makefile.am51
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs69
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs56
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs66
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ITextTemplatingEngineHost.cs52
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs134
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs166
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs65
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj78
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs62
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/IExtendedTextTemplatingEngineHost.cs36
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs317
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs254
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs54
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs369
-rw-r--r--main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs295
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/AssemblyInfo.cs51
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/ChangeLog60
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs293
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am48
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.addin.xml48
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj115
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4ParsedDocument.cs97
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4Parser.cs68
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/T4SyntaxMode.xml242
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs55
-rw-r--r--main/src/addins/TextTemplating/TextTransform/AssemblyInfo.cs39
-rw-r--r--main/src/addins/TextTemplating/TextTransform/ChangeLog25
-rw-r--r--main/src/addins/TextTemplating/TextTransform/Makefile.am35
-rw-r--r--main/src/addins/TextTemplating/TextTransform/Options.cs1112
-rw-r--r--main/src/addins/TextTemplating/TextTransform/TextTransform.cs107
-rw-r--r--main/src/addins/TextTemplating/TextTransform/TextTransform.csproj65
-rw-r--r--profiles/all1
80 files changed, 8391 insertions, 11 deletions
diff --git a/extras/extras.mdw b/extras/extras.mdw
index 3017c21d16..fbdb9d8558 100644
--- a/extras/extras.mdw
+++ b/extras/extras.mdw
@@ -12,7 +12,6 @@
<Item>GeckoWebBrowser/GeckoWebBrowser.sln</Item>
<Item>BooBinding/BooBinding.sln</Item>
<Item>AspNetEdit/AspNetEdit.sln</Item>
- <Item>MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.sln</Item>
<Item>MonoDevelop.IPhone/MonoDevelop.IPhone.sln</Item>
</Items>
-</WorkspaceItem>
+</WorkspaceItem> \ No newline at end of file
diff --git a/main/ChangeLog b/main/ChangeLog
index fc8d10bef6..51314139e9 100644
--- a/main/ChangeLog
+++ b/main/ChangeLog
@@ -1,6 +1,12 @@
2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
* Main.sln:
+ * configure.in: Include the ASP.NET MVC and TextTemplating
+ addins in the main solution and build.
+
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Main.sln:
* configure.in: Track moving & renaming ASP.NET addin.
2009-08-11 Lluis Sanchez Gual <lluis@novell.com>
diff --git a/main/Main.sln b/main/Main.sln
index 2e9f907144..e5e5c353eb 100644
--- a/main/Main.sln
+++ b/main/Main.sln
@@ -128,6 +128,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNet", "AspNet", "{0ADCD8
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.AspNet", "src\addins\AspNet\MonoDevelop.AspNet\MonoDevelop.AspNet.csproj", "{1CF94D07-5480-4D10-A3CD-2EBD5E87B02E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.AspNet.Mvc", "src\addins\AspNet\MonoDevelop.AspNet.Mvc\MonoDevelop.AspNet.Mvc.csproj", "{B32AD0DD-5247-437B-A2EF-1A4676C1B072}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TextTemplating", "TextTemplating", "{68F63ACB-A9B2-468F-B365-0F41F0D5F1DA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.TextTemplating", "src\addins\TextTemplating\Mono.TextTemplating\Mono.TextTemplating.csproj", "{A2364D6A-00EF-417C-80A6-815726C70032}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextTransform", "src\addins\TextTemplating\TextTransform\TextTransform.csproj", "{D1D35409-C814-47F6-B038-B9B5BF0FE490}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.TextTemplating", "src\addins\TextTemplating\MonoDevelop.TextTemplating\MonoDevelop.TextTemplating.csproj", "{8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.TextTemplating.Tests", "src\addins\TextTemplating\Mono.TextTemplating.Tests\Mono.TextTemplating.Tests.csproj", "{CB590106-8331-4CBE-8131-B154E7BF79E1}"
+EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "contrib", "contrib", "{F12939F1-D55A-4CE9-9F33-8D959BFC7D6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "contrib\Mono.Cecil\Mono.Cecil.csproj", "{3EC06433-F168-4C5B-A885-99CE4AB617E1}"
@@ -423,6 +435,14 @@ Global
{8A04FF99-5DFE-4E3D-A24F-72A621C8DDC6}.DebugWin32|x86.Build.0 = Debug|x86
{8A04FF99-5DFE-4E3D-A24F-72A621C8DDC6}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{8A04FF99-5DFE-4E3D-A24F-72A621C8DDC6}.Release|Any CPU.Build.0 = Debug|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.DebugWin32|x86.Build.0 = Debug|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}.Release|Any CPU.Build.0 = Release|Any CPU
{8E47B77A-A649-494C-9BF2-B845E39CADE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E47B77A-A649-494C-9BF2-B845E39CADE9}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
{8E47B77A-A649-494C-9BF2-B845E39CADE9}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
@@ -475,6 +495,14 @@ Global
{A2329308-3751-4DBD-9A75-5F7B8B024625}.DebugWin32|x86.Build.0 = Debug|Any CPU
{A2329308-3751-4DBD-9A75-5F7B8B024625}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2329308-3751-4DBD-9A75-5F7B8B024625}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.DebugWin32|x86.Build.0 = Debug|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A2364D6A-00EF-417C-80A6-815726C70032}.Release|Any CPU.Build.0 = Release|Any CPU
{A437F1A3-78DF-4F00-8053-D32A8B1EB679}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A437F1A3-78DF-4F00-8053-D32A8B1EB679}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A437F1A3-78DF-4F00-8053-D32A8B1EB679}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
@@ -511,6 +539,14 @@ Global
{AE84B4A7-E6B1-4565-8904-16284DCE41B6}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
{AE84B4A7-E6B1-4565-8904-16284DCE41B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE84B4A7-E6B1-4565-8904-16284DCE41B6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.DebugWin32|x86.Build.0 = Debug|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072}.Release|Any CPU.Build.0 = Release|Any CPU
{B841F25D-4F6D-4E0D-885F-212B54381F28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B841F25D-4F6D-4E0D-885F-212B54381F28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B841F25D-4F6D-4E0D-885F-212B54381F28}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
@@ -535,6 +571,14 @@ Global
{BFE8691A-D323-4622-9021-7B8B27F81599}.DebugWin32|x86.Build.0 = Debug|x86
{BFE8691A-D323-4622-9021-7B8B27F81599}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{BFE8691A-D323-4622-9021-7B8B27F81599}.Release|Any CPU.Build.0 = Debug|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.DebugWin32|x86.Build.0 = Debug|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CB590106-8331-4CBE-8131-B154E7BF79E1}.Release|Any CPU.Build.0 = Release|Any CPU
{CFC02FEC-BDF4-40B9-94D6-35E73F76A92E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CFC02FEC-BDF4-40B9-94D6-35E73F76A92E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CFC02FEC-BDF4-40B9-94D6-35E73F76A92E}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
@@ -543,6 +587,14 @@ Global
{CFC02FEC-BDF4-40B9-94D6-35E73F76A92E}.DebugWin32|x86.Build.0 = Debug|Any CPU
{CFC02FEC-BDF4-40B9-94D6-35E73F76A92E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CFC02FEC-BDF4-40B9-94D6-35E73F76A92E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.DebugWin32|x86.Build.0 = Debug|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490}.Release|Any CPU.Build.0 = Release|Any CPU
{DA8EDEA6-7DA8-435D-B1A0-F3A0CA07F424}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA8EDEA6-7DA8-435D-B1A0-F3A0CA07F424}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA8EDEA6-7DA8-435D-B1A0-F3A0CA07F424}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
@@ -639,6 +691,7 @@ Global
{50D6768C-C072-4E79-AFC5-C1C40767EF45} = {D417E929-2B3A-46AC-BBE8-027ADB63A790}
{100568FC-F4E8-439B-94AD-41D11724E45B} = {D417E929-2B3A-46AC-BBE8-027ADB63A790}
{0ADCD824-2506-4A61-9B88-ABF1D5267CE8} = {D417E929-2B3A-46AC-BBE8-027ADB63A790}
+ {68F63ACB-A9B2-468F-B365-0F41F0D5F1DA} = {D417E929-2B3A-46AC-BBE8-027ADB63A790}
{7FF7B14D-BFE7-493A-9B52-B5F4CA71A2DC} = {DEEB9163-3966-4E5E-9AB5-FBB3E01AC82A}
{F0F81D55-6265-474F-BE08-CE71818181B5} = {DEEB9163-3966-4E5E-9AB5-FBB3E01AC82A}
{19DE0F35-D204-4FD8-A553-A19ECE05E24D} = {DEEB9163-3966-4E5E-9AB5-FBB3E01AC82A}
@@ -660,6 +713,11 @@ Global
{A7A4246D-CEC4-42DF-A3C1-C31B9F51C4EC} = {DE462010-393D-4655-A42C-2C78BB14D2FA}
{0AF16AF1-0876-413E-9803-08BD33C19E00} = {DE462010-393D-4655-A42C-2C78BB14D2FA}
{1CF94D07-5480-4D10-A3CD-2EBD5E87B02E} = {0ADCD824-2506-4A61-9B88-ABF1D5267CE8}
+ {B32AD0DD-5247-437B-A2EF-1A4676C1B072} = {0ADCD824-2506-4A61-9B88-ABF1D5267CE8}
+ {A2364D6A-00EF-417C-80A6-815726C70032} = {68F63ACB-A9B2-468F-B365-0F41F0D5F1DA}
+ {D1D35409-C814-47F6-B038-B9B5BF0FE490} = {68F63ACB-A9B2-468F-B365-0F41F0D5F1DA}
+ {8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC} = {68F63ACB-A9B2-468F-B365-0F41F0D5F1DA}
+ {CB590106-8331-4CBE-8131-B154E7BF79E1} = {68F63ACB-A9B2-468F-B365-0F41F0D5F1DA}
{3EC06433-F168-4C5B-A885-99CE4AB617E1} = {F12939F1-D55A-4CE9-9F33-8D959BFC7D6C}
{201F7AC0-D2D5-4F51-85A8-17475DADBED3} = {F12939F1-D55A-4CE9-9F33-8D959BFC7D6C}
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} = {F12939F1-D55A-4CE9-9F33-8D959BFC7D6C}
diff --git a/main/configure.in b/main/configure.in
index 223a3c597c..e083ec8d68 100644
--- a/main/configure.in
+++ b/main/configure.in
@@ -362,7 +362,13 @@ src/addins/ChangeLogAddIn/Makefile
src/addins/MonoDevelop.GtkCore/Makefile
src/addins/MonoDevelop.GtkCore/libstetic/Makefile
src/addins/MonoDevelop.GtkCore/libsteticui/Makefile
+src/addins/TextTemplating/Makefile
+src/addins/TextTemplating/Mono.TextTemplating/Makefile
+src/addins/TextTemplating/TextTransform/Makefile
+src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile
+src/addins/AspNet/Makefile
src/addins/AspNet/MonoDevelop.AspNet/Makefile
+src/addins/AspNet/MonoDevelop.AspNet.Mvc/Makefile
src/addins/MonoDevelop.Autotools/Makefile
src/addins/MonoDevelop.DesignerSupport/Makefile
src/addins/MonoDevelop.WebReferences/Makefile
diff --git a/main/src/addins/AspNet/ChangeLog b/main/src/addins/AspNet/ChangeLog
new file mode 100644
index 0000000000..ee5e8af19b
--- /dev/null
+++ b/main/src/addins/AspNet/ChangeLog
@@ -0,0 +1,6 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Makefile.am:
+ * MonoDevelop.AspNet.Mvc: Include the ASP.NET MVC and
+ TextTemplating addins in the main solution and build.
+
diff --git a/main/src/addins/AspNet/Makefile.am b/main/src/addins/AspNet/Makefile.am
new file mode 100644
index 0000000000..e27cad6a75
--- /dev/null
+++ b/main/src/addins/AspNet/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = \
+ MonoDevelop.AspNet \
+ MonoDevelop.AspNet.Mvc
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcCommands.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcCommands.cs
new file mode 100644
index 0000000000..c10386a955
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcCommands.cs
@@ -0,0 +1,38 @@
+//
+// AspMvcCommands.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace MonoDevelop.AspNet.Mvc
+{
+
+
+ public enum AspMvcCommands
+ {
+ AddView,
+ AddController
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs
new file mode 100644
index 0000000000..e9d3621973
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProject.cs
@@ -0,0 +1,133 @@
+//
+// AspMvcProject.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Xml;
+using MonoDevelop.Projects;
+using MonoDevelop.Core.Serialization;
+
+namespace MonoDevelop.AspNet.Mvc
+{
+
+
+ public class AspMvcProject : AspNetAppProject
+ {
+ static void Check24 ()
+ {
+ Type mr = Type.GetType ("Mono.Runtime");
+ if (mr != null) {
+ string version = (string) mr.GetMethod ("GetDisplayName", BindingFlags.NonPublic|BindingFlags.Static).Invoke (null, null);
+ //MD only builds on 2.0 or later
+ if (version.StartsWith ("Mono 2.0") || version.StartsWith ("Mono 2.2"))
+ MonoDevelop.Core.Gui.MessageService.ShowWarning ("ASP.NET MVC projects only build and run on Mono 2.4 or later");
+ }
+ }
+
+ public AspMvcProject ()
+ {
+ Check24 ();
+ }
+
+ public AspMvcProject (string languageName)
+ : base (languageName)
+ {
+ Check24 ();
+ }
+
+ public AspMvcProject (string languageName, ProjectCreateInformation info, XmlElement projectOptions)
+ : base (languageName, info, projectOptions)
+ {
+ Check24 ();
+ }
+
+ public override SolutionItemConfiguration CreateConfiguration (string name)
+ {
+ AspMvcProjectConfiguration conf = new AspMvcProjectConfiguration ();
+
+ conf.Name = name;
+ conf.CompilationParameters = LanguageBinding.CreateCompilationParameters (null);
+ return conf;
+ }
+
+ public override string ProjectType {
+ get { return "AspNetMvc"; }
+ }
+
+ public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework)
+ {
+ return framework.IsCompatibleWithFramework ("3.5");
+ }
+
+ public override IEnumerable<string> GetSpecialDirectories ()
+ {
+ foreach (string s in base.GetSpecialDirectories ())
+ yield return s;
+ yield return "Views";
+ yield return "Models";
+ yield return "Controllers";
+ }
+
+ public IList<string> GetCodeTemplates (string type)
+ {
+ List<string> files = new List<string> ();
+ HashSet<string> names = new HashSet<string> ();
+
+ string asmDir = Path.GetDirectoryName (typeof (AspMvcProject).Assembly.Location);
+
+ string[] dirs = new string[] {
+ Path.Combine (Path.Combine (this.BaseDirectory, "CodeTemplates"), type),
+ Path.Combine (Path.Combine (asmDir, "CodeTemplates"), type)
+ };
+
+ foreach (string directory in dirs)
+ if (Directory.Exists (directory))
+ foreach (string file in Directory.GetFiles (directory, "*.tt", SearchOption.TopDirectoryOnly))
+ if (names.Add (Path.GetFileName (file)))
+ files.Add (file);
+
+ return files;
+ }
+
+ protected override void PopulateSupportFileList (MonoDevelop.Projects.FileCopySet list, string solutionConfiguration)
+ {
+ base.PopulateSupportFileList (list, solutionConfiguration);
+
+ //HACK: workaround for MD not local-copying package references
+ foreach (ProjectReference projectReference in References) {
+ if (projectReference.Package != null && projectReference.Package.Name == "system.web.mvc") {
+ if (projectReference.LocalCopy && projectReference.ReferenceType == ReferenceType.Gac)
+ foreach (MonoDevelop.Core.Assemblies.SystemAssembly assem in projectReference.Package.Assemblies)
+ list.Add (assem.Location);
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectBinding.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectBinding.cs
new file mode 100644
index 0000000000..4599e74231
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectBinding.cs
@@ -0,0 +1,57 @@
+//
+// AspMvcProjectBinding.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.AspNet.Mvc
+{
+
+
+ public class AspMvcProjectBinding : IProjectBinding
+ {
+ public Project CreateProject (ProjectCreateInformation info, System.Xml.XmlElement projectOptions)
+ {
+ string lang = projectOptions.GetAttribute ("language");
+ return new AspMvcProject (lang, info, projectOptions);
+ }
+
+ public Project CreateSingleFileProject (string sourceFile)
+ {
+ throw new InvalidOperationException ();
+ }
+
+ public bool CanCreateSingleFileProject (string sourceFile)
+ {
+ return false;
+ }
+
+ public string Name {
+ get { return "AspNetMvc"; }
+ }
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectConfiguration.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectConfiguration.cs
new file mode 100644
index 0000000000..141117a9b0
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AspMvcProjectConfiguration.cs
@@ -0,0 +1,40 @@
+//
+// AspMvcProjectConfiguration.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace MonoDevelop.AspNet.Mvc
+{
+
+
+ public class AspMvcProjectConfiguration : AspNetAppProjectConfiguration
+ {
+
+ public AspMvcProjectConfiguration ()
+ {
+ }
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AssemblyInfo.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AssemblyInfo.cs
new file mode 100644
index 0000000000..f61959ecd7
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/AssemblyInfo.cs
@@ -0,0 +1,51 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("MonoDevelop.AspNet.Mvc")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/ChangeLog b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/ChangeLog
new file mode 100644
index 0000000000..372d4131f7
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/ChangeLog
@@ -0,0 +1,267 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Makefile.am:
+ * MonoDevelop.AspNet.Mvc.csproj: Include the ASP.NET MVC and
+ TextTemplating addins in the main solution and build.
+
+2009-08-11 Michael Hutchinson <mhutchinson@novell.com>
+
+ * System.Web.Mvc.dll:
+ * MonoDevelop.AspNet.Mvc.csproj:
+ * MonoDevelop.AspNet.Mvc.addin.xml: Remove the MVC dll now
+ that Mono 2.4 series ships it.
+
+2009-07-29 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/AddViewDialog.cs: Track API.
+
+ * gtk-gui/gui.stetic:
+ * MonoDevelop.AspNet.Mvc.csproj:
+ * gtk-gui/MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs: Flush.
+
+2009-06-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.csproj: Add another project dependency.
+
+2009-06-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/FolderNodeBuilderExtension.cs: Track FilePath API.
+
+2009-04-29 Michael Hutchinson <mhutchinson@novell.com>
+
+ * AspMvcProject.cs: Fix possible NRE.
+
+2009-04-21 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/AddViewDialog.cs: Fix build.
+
+2009-04-17 Michael Hutchinson <mhutchinson@novell.com>
+
+ * AspMvcProject.cs: Track namespace changes.
+
+2009-04-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.addin.xml: Bump MD version.
+
+2009-04-09 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/AddViewDialog.cs: Track parser API.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/AddViewDialog.cs: Refresh the placeholder list properly.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/AddViewDialog.cs: When auto-selecting site master,
+ refresh the placeholders list.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * CodeTemplates/AddView/Empty.tt: Fix missing runat="server"
+ in Content tags.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.addin.xml: Update package name.
+
+ * AspMvcProject.cs: Check we're on the 2.4 runtime or later.
+ Update package name.
+
+ * Templates/Project.xpt.xml: Add some "Hello World" content.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/AddViewDialog.cs: Disable class selector, and the widget
+ it uses has broken input handling in modal dialogs.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * AspMvcProject.cs: Add a workaround for Bug 491377: Package
+ references can't be local-copied even if they aren't GAC
+ assemblies.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Templates/WebConfigApp.xft.xml: Fix web.config.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * System.Web.Mvc.dll: Need assembly signed with winfx key.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * System.Web.Mvc.dll:
+ * MonoDevelop.AspNet.Mvc.csproj:
+ * MonoDevelop.AspNet.Mvc.addin.xml: Fix refs. Add a local
+ copy of the GMCS-built, MS-PL System.Web.Mvc dll.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * gtk-gui/gui.stetic: Track build directory change.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.csproj: Move output dir from ../bin
+ to ../build.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * gtk-gui:
+ * gtk-gui/gui.stetic:
+ * gtk-gui/generated.cs:
+ * gtk-gui/MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs: Add
+ missing files.
+
+2009-03-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.csproj:
+ * MonoDevelop.AspNet.Mvc.addin.xml: Reference the
+ TextTemplating addin.
+
+ * Gui/AddViewDialog.cs: Fix warning.
+
+ * Gui/FolderNodeBuilderExtension.cs: Move error-showing code
+ to the TemplatingService.
+
+2009-03-09 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.addin.xml: Update dependencies.
+
+ * Gui/AddViewDialog.cs:
+ * MonoDevelop.AspNet.Mvc.csproj: Add class picker.
+
+2009-03-06 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/AddViewDialog.cs: Get the placeholder list from the
+ master page. Better validation of input.
+
+2009-03-06 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.csproj: Updated.
+
+ * AspMvcProject.cs: Add method for looking up .tt files.
+
+ * Gui/AddViewDialog.cs: New Add View dialog.
+
+ * Gui/FolderNodeBuilderExtension.cs: Use new Add View dialog
+ and the MVC T4 host.
+
+ * CodeTemplates:
+ * TextTemplating:
+ * CodeTemplates/AddView:
+ * CodeTemplates/AddController: Added.
+
+ * TextTemplating/MvcTextTemplateHost.cs: ASP.NET MVC T4 host.
+
+ * CodeTemplates/AddView/Empty.tt: Simple empty tt file.
+
+ * Templates/UserControl.xft.xml: Add more whitespace.
+
+2009-03-04 Michael Hutchinson <mhutchinson@novell.com>
+
+ * T4/Engine.cs:
+ * T4/Tokeniser.cs:
+ * T4/ToStringHelper.cs:
+ * T4/ParsedTemplate.cs:
+ * T4/TextTransformation.cs:
+ * T4/DirectiveProcessor.cs:
+ * MonoDevelop.AspNet.Mvc.csproj:
+ * T4/ITextTemplatingEngineHost.cs:
+ * T4/DirectiveProcessorException.cs:
+ * T4/RequiresProvidesDirectiveProcessor.cs: Move T4
+ implementation to its own assembly. Tweak some appdomain
+ stuff.
+
+2009-03-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * T4/Engine.cs: Handle culture, encoding, extension directive
+ values.
+
+2009-03-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * T4/Engine.cs:
+ * T4/Template.cs:
+ * T4/Tokeniser.cs:
+ * T4/ParsedTemplate.cs:
+ * MonoDevelop.AspNet.Mvc.csproj: T4 implementation is complete
+ except for handling some of the directive values and custom
+ directives.
+
+2009-03-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * T4:
+ * T4/Engine.cs:
+ * T4/Template.cs:
+ * T4/Tokeniser.cs:
+ * T4/ToStringHelper.cs:
+ * T4/DirectiveProcessor.cs:
+ * T4/TextTransformation.cs:
+ * MonoDevelop.AspNet.Mvc.csproj:
+ * T4/ITextTemplatingEngineHost.cs:
+ * T4/DirectiveProcessorException.cs:
+ * T4/RequiresProvidesDirectiveProcessor.cs: Added an
+ incomplete T4 implemention.
+
+2009-02-28 Michael Hutchinson <mhutchinson@novell.com>
+
+ * AspMvcProject.cs: Add Models, Views, Controllers to special
+ folders list.
+
+2009-02-27 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui:
+ * AspMvcCommands.cs:
+ * MonoDevelop.AspNet.Mvc.addin.xml:
+ * Gui/FolderNodeBuilderExtension.cs: Add context menu commands
+ for adding views and controllers to the appropriate folders.
+
+ * MonoDevelop.AspNet.Mvc.csproj: Updated.
+
+2009-02-26 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.csproj: Flush.
+
+2009-02-26 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Templates/Project.xpt.xml:
+ * Templates/EmptyProject.xpt.xml: Set SpecificVersion false
+ for some references.
+
+2009-02-24 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Templates/ViewContentPage.xft.xml: Fix MasterPageFile
+ attribute name.
+
+2009-02-24 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Templates/ViewContentPage.xft.xml: Use master content
+ generator.
+
+2009-02-21 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Templates/Project.xpt.xml:
+ * Templates/GlobalAsax.xft.xml:
+ * MonoDevelop.AspNet.Mvc.csproj:
+ * Templates/WebConfigApp.xft.xml:
+ * Templates/EmptyProject.xpt.xml:
+ * MonoDevelop.AspNet.Mvc.addin.xml:
+ * Templates/WebConfigViews.xft.xml: Added web.config,
+ global.asax templates.
+
+2009-02-20 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Templates/Project.xpt.xml:
+ * Templates/EmptyProject.xpt.xml: Add Web.configs.
+
+2009-02-20 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Templates/Project.xpt.xml:
+ * Templates/EmptyProject.xpt.xml: Set target framework
+ version. Create default MVC directories.
+
+2009-02-18 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.AspNet.Mvc.addin.xml: Fix MVC project type
+ registration.
+
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/CodeTemplates/AddView/Empty.tt b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/CodeTemplates/AddView/Empty.tt
new file mode 100644
index 0000000000..862e316c3a
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/CodeTemplates/AddView/Empty.tt
@@ -0,0 +1,29 @@
+<#@ template language="C#v3.5" HostSpecific="true" #>
+<#
+MvcTextTemplateHost mvcHost = (MvcTextTemplateHost) Host;
+string dataTypeString = mvcHost.ViewDataTypeGenericString;
+
+if (mvcHost.IsViewUserControl) { #>
+<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<#= dataTypeString #>" %>
+
+<# } else if (mvcHost.IsViewContentPage) { #>
+<%@ Page Language="C#" MasterPageFile="<#= mvcHost.MasterPage #>" Inherits="System.Web.Mvc.ViewPage<#= dataTypeString #>" %>
+<#
+ foreach (string contentID in mvcHost.ContentPlaceHolders) {
+#>
+<asp:Content ID="<#= contentID #>Content" ContentPlaceHolderID="<#= contentID #>" runat="server">
+</asp:Content>
+<#
+ }
+} else if(mvcHost.IsViewPage) { #>
+<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<#= dataTypeString #>" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <div>
+
+ </div>
+</body>
+<# } #> \ No newline at end of file
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/AddViewDialog.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/AddViewDialog.cs
new file mode 100644
index 0000000000..c6a6b36957
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/AddViewDialog.cs
@@ -0,0 +1,311 @@
+//
+// AddViewDialog.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using MonoDevelop.AspNet.Gui;
+using MonoDevelop.Projects.Dom.Parser;
+using PP = System.IO.Path;
+
+namespace MonoDevelop.AspNet.Mvc.Gui
+{
+
+
+ public partial class AddViewDialog : Gtk.Dialog
+ {
+ AspMvcProject project;
+ IList<string> loadedTemplateList;
+ string oldMaster;
+ Gtk.ListStore primaryPlaceholderStore = new Gtk.ListStore (typeof (String));
+ System.CodeDom.Compiler.CodeDomProvider provider;
+ MonoDevelop.SourceEditor.DropDownBox dataClassCombo;
+ TypeDataProvider classDataProvider;
+
+ public AddViewDialog (AspMvcProject project)
+ {
+ this.project = project;
+ this.Build ();
+
+ dataClassCombo = new MonoDevelop.SourceEditor.DropDownBox ();
+
+ int w, h;
+ Gtk.Icon.SizeLookup (Gtk.IconSize.Menu, out w, out h);
+ dataClassCombo.DefaultIconHeight = Math.Max (h, 16);
+ dataClassCombo.DefaultIconWidth = Math.Max (w, 16);
+ dataClassAlignment.Add (dataClassCombo);
+ dataClassAlignment.QueueResize ();
+ dataClassCombo.ShowAll ();
+
+ provider = project.LanguageBinding.GetCodeDomProvider ();
+
+ ContentPlaceHolders = new List<string> ();
+ string siteMaster = project.VirtualToLocalPath ("~/Views/Shared/Site.master", null);
+ if (project.Files.GetFile (siteMaster) != null)
+ masterEntry.Text = "~/Views/Shared/Site.master";
+
+ loadedTemplateList = project.GetCodeTemplates ("AddView");
+ bool foundEmptyTemplate = false;
+ int templateIndex = 0;
+ foreach (string file in loadedTemplateList) {
+ string name = PP.GetFileNameWithoutExtension (file);
+ templateCombo.AppendText (name);
+ if (!foundEmptyTemplate){
+ if (name == "Empty") {
+ templateCombo.Active = templateIndex;
+ foundEmptyTemplate = true;
+ } else
+ templateIndex++;
+ }
+ }
+
+ if (!foundEmptyTemplate)
+ throw new Exception ("The Empty.tt template is missing.");
+
+ primaryPlaceholderCombo.Model = primaryPlaceholderStore;
+
+ UpdateTypePanelSensitivity (null, null);
+ UpdateMasterPanelSensitivity (null, null);
+ Validate ();
+ }
+
+ protected virtual void Validate (object sender, EventArgs e)
+ {
+ Validate ();
+ }
+
+ void Validate ()
+ {
+ buttonOk.Sensitive = IsValid ();
+ }
+
+ protected virtual void UpdateMasterPanelSensitivity (object sender, EventArgs e)
+ {
+ bool canHaveMaster = !IsPartialView;
+ masterCheck.Sensitive = canHaveMaster;
+ masterPanel.Sensitive = canHaveMaster && HasMaster;
+ MasterChanged (null, null);
+ Validate ();
+ }
+
+ protected virtual void UpdateTypePanelSensitivity (object sender, EventArgs e)
+ {
+ //FIXME: need to fix the class list widget
+ bool enabled = typePanel.Sensitive = false; // stronglyTypedCheck.Active;
+
+ if (enabled && classDataProvider == null) {
+ dataClassCombo.DataProvider = classDataProvider = new TypeDataProvider (project);
+ if (classDataProvider.List.Count > 0)
+ dataClassCombo.SetItem (0);
+ }
+
+ Validate ();
+ }
+
+ public override void Dispose ()
+ {
+ Destroy ();
+ base.Dispose ();
+ }
+
+ public bool IsValid ()
+ {
+ if (!IsValidIdentifier (ViewName))
+ return false;
+
+ if (!IsPartialView && HasMaster) {
+ if (String.IsNullOrEmpty (MasterFile) || !System.IO.File.Exists (project.VirtualToLocalPath (oldMaster, null)))
+ return false;
+ //PrimaryPlaceHolder can be empty
+ }
+
+ if (IsStronglyTyped && (ViewDataType == null))
+ return false;
+
+ return true;
+ }
+
+ bool IsValidIdentifier (string identifier)
+ {
+ return !String.IsNullOrEmpty (identifier) && provider.IsValidIdentifier (identifier);
+ }
+
+ protected virtual void ShowMasterSelectionDialog (object sender, System.EventArgs e)
+ {
+ //MonoDevelop.AspNet.Gui.
+ using (var dialog = new MonoDevelop.Projects.Gui.Dialogs.ProjectFileSelectorDialog (project, null, "*.master")) {
+ dialog.Title = MonoDevelop.Core.GettextCatalog.GetString ("Select a Master Page...");
+ dialog.Modal = true;
+ dialog.TransientFor = this;
+ dialog.DestroyWithParent = true;
+ int response = dialog.Run ();
+ if (response == (int)Gtk.ResponseType.Ok)
+ masterEntry.Text = project.LocalToVirtualPath (dialog.SelectedFile.FilePath);
+ dialog.Destroy ();
+ }
+ }
+
+ protected virtual void MasterChanged (object sender, EventArgs e)
+ {
+ if (IsPartialView || !HasMaster)
+ return;
+
+ if (masterEntry.Text == oldMaster)
+ return;
+ oldMaster = masterEntry.Text;
+
+ primaryPlaceholderStore.Clear ();
+ ContentPlaceHolders.Clear ();
+
+ string realPath = project.VirtualToLocalPath (oldMaster, null);
+ if (!System.IO.File.Exists (realPath))
+ return;
+
+ MonoDevelop.AspNet.Parser.AspNetParsedDocument pd
+ = ProjectDomService.GetParsedDocument (ProjectDomService.GetProjectDom (project), realPath)
+ as MonoDevelop.AspNet.Parser.AspNetParsedDocument;
+
+ if (pd != null && pd.Document != null) {
+ try {
+ MonoDevelop.AspNet.Parser.ContentPlaceHolderVisitor visitor
+ = new MonoDevelop.AspNet.Parser.ContentPlaceHolderVisitor ();
+ pd.Document.RootNode.AcceptVisit (visitor);
+ ContentPlaceHolders.AddRange (visitor.PlaceHolders);
+
+ for (int i = 0; i < ContentPlaceHolders.Count; i++) {
+ string placeholder = ContentPlaceHolders[i];
+ primaryPlaceholderStore.AppendValues (placeholder);
+
+ if (placeholder.Contains ("main") || placeholder.Contains ("Main")
+ || placeholder.Contains ("content") || placeholder.Contains ("Main"))
+ primaryPlaceholderCombo.Active = i;
+ }
+ } catch (Exception ex) {
+ MonoDevelop.Core.LoggingService.LogError ("Unhandled exception getting master regions for '" +
+ realPath + "'", ex);
+ }
+ }
+
+ Validate ();
+ }
+
+ #region Public properties
+
+ public MonoDevelop.Projects.Dom.IType ViewDataType {
+ get {
+ return (MonoDevelop.Projects.Dom.IType)dataClassCombo.CurrentItem;
+ }
+ }
+
+ public string MasterFile {
+ get {
+ return masterEntry.Text;
+ }
+ }
+
+ public bool HasMaster {
+ get {
+ return masterCheck.Active;
+ }
+ }
+
+ public string PrimaryPlaceHolder {
+ get {
+ return primaryPlaceholderCombo.ActiveText;
+ }
+ }
+
+ public List<string> ContentPlaceHolders {
+ get; private set;
+ }
+
+ public string TemplateFile {
+ get {
+ return loadedTemplateList[templateCombo.Active];
+ }
+ }
+
+ public string ViewName {
+ get {
+ return nameEntry.Text;
+ }
+ set {
+ nameEntry.Text = value ?? "";
+ }
+ }
+
+ public bool IsPartialView {
+ get { return partialCheck.Active; }
+ }
+
+ public bool IsStronglyTyped {
+ get { return stronglyTypedCheck.Active; }
+ }
+
+ #endregion
+
+ class TypeDataProvider : MonoDevelop.SourceEditor.DropDownBoxListWindow.IListDataProvider
+ {
+ MonoDevelop.Projects.Dom.Output.Ambience ambience;
+
+ public List<MonoDevelop.Projects.Dom.IType> List { get; private set; }
+
+ public TypeDataProvider (MonoDevelop.Projects.DotNetProject project)
+ {
+ List = new List<MonoDevelop.Projects.Dom.IType> ();
+ MonoDevelop.Projects.Dom.Parser.ProjectDom dom =
+ MonoDevelop.Projects.Dom.Parser.ProjectDomService.GetProjectDom (project);
+ List.AddRange (dom.Types);
+ this.ambience = MonoDevelop.Projects.Dom.Output.AmbienceService.GetAmbienceForLanguage (project.LanguageName);
+ }
+
+ public int IconCount { get { return List.Count; } }
+
+ public void Reset ()
+ {
+ //called when the list is shown
+ }
+
+ public string GetText (int n)
+ {
+ return ambience.GetString (List[n], MonoDevelop.Projects.Dom.Output.OutputFlags.IncludeGenerics
+ | MonoDevelop.Projects.Dom.Output.OutputFlags.UseFullName);
+ }
+
+ public Gdk.Pixbuf GetIcon (int n)
+ {
+ return MonoDevelop.Core.Gui.ImageService.GetPixbuf (List[n].StockIcon,Gtk.IconSize.Menu);
+ }
+
+ public object GetTag (int n)
+ {
+ return List[n];
+ }
+ }
+ }
+}
+
+
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs
new file mode 100644
index 0000000000..8807f0c6b7
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Gui/FolderNodeBuilderExtension.cs
@@ -0,0 +1,179 @@
+//
+// FolderNodeBuilderExtension.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Gui;
+using MonoDevelop.Projects;
+using MonoDevelop.Ide.Gui.Components;
+using MonoDevelop.Ide.Gui.Pads.ProjectPad;
+using MonoDevelop.AspNet.Mvc.TextTemplating;
+
+namespace MonoDevelop.AspNet.Mvc.Gui
+{
+
+ class FolderNodeBuilderExtension : NodeBuilderExtension
+ {
+ public override bool CanBuildNode (Type dataType)
+ {
+ return typeof (ProjectFolder).IsAssignableFrom (dataType);
+ }
+
+ public override Type CommandHandlerType {
+ get { return typeof (FolderCommandHandler); }
+ }
+ }
+
+ class FolderCommandHandler : NodeCommandHandler
+ {
+ [CommandUpdateHandler (AspMvcCommands.AddController)]
+ public void AddControllerUpdate (CommandInfo info)
+ {
+ ProjectFolder pf = (ProjectFolder)CurrentNode.DataItem;
+ FilePath rootName = pf.Project.BaseDirectory.Combine ("Controllers");
+ info.Enabled = info.Visible = (pf.Path == rootName || pf.Path.IsChildPathOf (rootName));
+ }
+
+ [CommandHandler (AspMvcCommands.AddController)]
+ public void AddController ()
+ {
+ AddFile ("AspMvcController");
+ }
+
+ [CommandUpdateHandler (AspMvcCommands.AddView)]
+ public void AddViewUpdate (CommandInfo info)
+ {
+ ProjectFolder pf = (ProjectFolder)CurrentNode.DataItem;
+ FilePath rootName = pf.Project.BaseDirectory.Combine ("Views");
+ info.Enabled = info.Visible = (pf.Path == rootName || pf.Path.IsChildPathOf (rootName));
+ }
+
+ [CommandHandler (AspMvcCommands.AddView)]
+ public void AddView ()
+ {
+ AspMvcProject project = CurrentNode.GetParentDataItem (typeof(AspMvcProject), true) as AspMvcProject;
+ if (project == null)
+ return;
+
+ object currentItem = CurrentNode.DataItem;
+
+ ProjectFolder folder = CurrentNode.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;
+ string path = folder != null? folder.Path : project.BaseDirectory;
+
+ AddView (project, path, null);
+
+ ITreeNavigator nav = Tree.GetNodeAtObject (currentItem);
+ if (nav != null)
+ nav.Expanded = true;
+ }
+
+ public static void AddView (AspMvcProject project, string path, string name)
+ {
+ string outputFile = null;
+ MvcTextTemplateHost host = null;
+ AppDomain domain = null;
+ AddViewDialog dialog = null;
+
+ try {
+ dialog = new AddViewDialog (project);
+ dialog.ViewName = name;
+
+ bool fileGood = false;
+ while (!fileGood) {
+ Gtk.ResponseType resp = (Gtk.ResponseType) MessageService.ShowCustomDialog (dialog);
+ dialog.Hide ();
+ if (resp != Gtk.ResponseType.Ok || ! dialog.IsValid ())
+ return;
+
+ outputFile = System.IO.Path.Combine (path, dialog.ViewName) + (dialog.IsPartialView? ".ascx" : ".aspx");
+
+ if (System.IO.File.Exists (outputFile)) {
+ fileGood = MessageService.AskQuestion ("Overwrite file?", "The file '{0}' already exists.\n" +
+ "Would you like to overwrite it?", AlertButton.OverwriteFile, AlertButton.Cancel)
+ != AlertButton.Cancel;
+ } else
+ break;
+ }
+
+ AppDomainSetup info = new AppDomainSetup ();
+ info.ApplicationBase = System.IO.Path.GetDirectoryName (typeof (MvcTextTemplateHost).Assembly.Location);
+ domain = AppDomain.CreateDomain ("AspMvcGenerationDomain", null, info);
+ host = MvcTextTemplateHost.Create (domain);
+
+ if (dialog.HasMaster) {
+ host.IsViewContentPage = true;
+ host.ContentPlaceholder = dialog.PrimaryPlaceHolder;
+ host.MasterPage = dialog.MasterFile;
+ host.ContentPlaceHolders = dialog.ContentPlaceHolders;
+ }
+ else if (dialog.IsPartialView)
+ host.IsViewUserControl = true;
+ else
+ host.IsViewPage = true;
+
+ if (dialog.IsStronglyTyped) {
+ //TODO: use dialog.ViewDataType to construct
+ // host.ViewDataTypeGenericString and host.ViewDataType
+ }
+
+ host.ProcessTemplate (dialog.TemplateFile, outputFile);
+ MonoDevelop.TextTemplating.TextTemplatingService.ShowTemplateHostErrors (host.Errors);
+
+ } finally {
+ if (domain != null)
+ AppDomain.Unload (domain);
+ if (dialog != null)
+ dialog.Destroy ();
+ }
+
+ if (System.IO.File.Exists (outputFile)) {
+ project.AddFile (outputFile);
+ MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.Save (project);
+ }
+ }
+
+ //adapted from GtkCore
+ void AddFile (string id)
+ {
+ AspMvcProject project = CurrentNode.GetParentDataItem (typeof(AspMvcProject), true) as AspMvcProject;
+ if (project == null)
+ return;
+
+ object currentItem = CurrentNode.DataItem;
+
+ ProjectFolder folder = CurrentNode.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;
+ string path = folder != null? folder.Path : project.BaseDirectory;
+
+ MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.CreateProjectFile (project, path, id);
+ MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.Save (project);
+
+ ITreeNavigator nav = Tree.GetNodeAtObject (currentItem);
+ if (nav != null)
+ nav.Expanded = true;
+ }
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Makefile.am b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Makefile.am
new file mode 100644
index 0000000000..8f8ddb97fe
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Makefile.am
@@ -0,0 +1,70 @@
+ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.AspNet.Mvc
+ASSEMBLY = $(ADDIN_BUILD)/MonoDevelop.AspNet.Mvc.dll
+
+DEPS = \
+ $(top_builddir)/build/AddIns/MonoDevelop.AspNet/MonoDevelop.AspNet.dll \
+ $(top_builddir)/build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll \
+ $(top_builddir)/build/AddIns/MonoDevelop.SourceEditor2.dll \
+ $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating/Mono.TextTemplating.dll \
+ $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.dll \
+ $(top_builddir)/build/AddIns/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Components.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Core.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Ide.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Projects.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll
+
+REFS = \
+ $(GTK_SHARP_LIBS) \
+ -r:Mono.Posix \
+ -r:System \
+ -r:System.Core \
+ -r:System.Xml
+
+FILES = \
+ AspMvcCommands.cs \
+ AspMvcProject.cs \
+ AspMvcProjectBinding.cs \
+ AspMvcProjectConfiguration.cs \
+ AssemblyInfo.cs \
+ gtk-gui/generated.cs \
+ gtk-gui/MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs \
+ Gui/AddViewDialog.cs \
+ Gui/FolderNodeBuilderExtension.cs \
+ TextTemplating/MvcTextTemplateHost.cs
+
+RES = \
+ gtk-gui/gui.stetic \
+ MonoDevelop.AspNet.Mvc.addin.xml
+
+DATA_FILES =
+
+DATA_FILE_BUILD = $(addprefix $(ADDIN_BUILD)/Schemas/, $(notdir $(DATA_FILES)))
+
+all: $(ASSEMBLY) $(ASSEMBLY).mdb $(DATA_FILE_BUILD)
+
+$(ASSEMBLY): $(build_sources) $(build_resources) $(DEPS)
+ mkdir -p $(ADDIN_BUILD)
+ $(CSC) $(CSC_FLAGS) -debug -out:$@ -target:library $(REFS) $(build_deps) \
+ $(build_resources:%=/resource:%) $(build_sources)
+
+$(ASSEMBLY).mdb: $(ASSEMBLY)
+
+$(DATA_FILE_BUILD): $(srcdir)$(subst $(ADDIN_BUILD),, $@)
+ mkdir -p $(ADDIN_BUILD)/Schemas
+ cp $(srcdir)/$(subst $(ADDIN_BUILD),,$@) $@
+
+check: all
+
+assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.AspNet.Mvc
+assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb
+
+schemadir = $(MD_ADDIN_DIR)/MonoDevelop.AspNet.Mvc/Schemas
+schema_DATA = $(DATA_FILES)
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DATA_FILE_BUILD)
+EXTRA_DIST = $(FILES) $(RES) $(DATA_FILES)
+
+include $(top_srcdir)/Makefile.include
+
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.addin.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.addin.xml
new file mode 100644
index 0000000000..8fe5ee567a
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.addin.xml
@@ -0,0 +1,99 @@
+<Addin id = "AspNet.Mvc"
+ namespace = "MonoDevelop"
+ name = "ASP.NET MVC Support"
+ author = "Michael Hutchinson"
+ copyright = "MIT X11"
+ url = "http://monodevelop.com/"
+ description = "Support for ASP.NET MVC projects."
+ category = "Web Development"
+ version = "2.1.0">
+
+ <Runtime>
+ <Import file = "Templates/Controller.xft.xml"/>
+ <Import file = "Templates/ViewPage.xft.xml"/>
+ <Import file = "Templates/ViewContentPage.xft.xml"/>
+ <Import file = "Templates/UserControl.xft.xml"/>
+ <Import file = "Templates/ViewMasterPage.xft.xml" />
+ <Import file = "Templates/Project.xpt.xml" />
+ <Import file = "Templates/EmptyProject.xpt.xml"/>
+ <Import file = "Templates/GlobalAsax.xft.xml"/>
+ <Import file = "Templates/WebConfigApp.xft.xml"/>
+ <Import file = "Templates/WebConfigViews.xft.xml"/>
+ <Import file = "CodeTemplates/AddView/Empty.tt" />
+ </Runtime>
+
+ <Dependencies>
+ <Addin id="Core" version="2.1.0"/>
+ <Addin id="Core.Gui" version="2.1.0"/>
+ <Addin id="Projects" version="2.1.0"/>
+ <Addin id="Projects.Gui" version="2.1.0"/>
+ <Addin id="Ide" version="2.1.0"/>
+ <Addin id="XmlEditor" version="2.1.0" />
+ <Addin id="AspNet" version="2.1.0" />
+ <Addin id="SourceEditor2" version="2.1.0" />
+ <Addin id="TextTemplating" version="2.1.0" />
+ </Dependencies>
+
+ <Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes">
+ <DotNetProjectSubtype
+ guid="{603c0e0b-db56-11dc-be95-000d561079b0}"
+ type="MonoDevelop.AspNet.Mvc.AspMvcProject"
+ />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/FileTemplates">
+ <FileTemplate id = "AspMvcController"
+ file = "Templates/Controller.xft.xml"/>
+ <FileTemplate id = "AspMvcViewPage"
+ file = "Templates/ViewPage.xft.xml"/>
+ <FileTemplate id = "AspMvcViewContentPage"
+ file = "Templates/ViewContentPage.xft.xml"/>
+ <FileTemplate id = "AspMvcUserControl"
+ file = "Templates/UserControl.xft.xml"/>
+ <FileTemplate id = "AspMvcViewMasterPage"
+ file = "Templates/ViewMasterPage.xft.xml" />
+ <FileTemplate id = "AspMvcGlobalAsax"
+ file = "Templates/GlobalAsax.xft.xml" />
+ <FileTemplate id = "AspMvcWebConfigApp"
+ file = "Templates/WebConfigApp.xft.xml" />
+ <FileTemplate id = "AspMvcWebConfigViews"
+ file = "Templates/WebConfigViews.xft.xml" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/ProjectTemplates">
+ <ProjectTemplate id = "AspMvcProject" file = "Templates/Project.xpt.xml" />
+ <ProjectTemplate id = "AspMvcProject-Empty" file = "Templates/EmptyProject.xpt.xml"/>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/ProjectModel/ProjectBindings">
+ <ProjectBinding id = "AspNetMvc" class = "MonoDevelop.AspNet.Mvc.AspMvcProjectBinding" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/ProjectModel/SerializableClasses">
+ <DataType class = "MonoDevelop.AspNet.Mvc.AspMvcProject" />
+ <DataType class = "MonoDevelop.AspNet.Mvc.AspMvcProjectConfiguration" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/Commands">
+ <Category _name = "ASP.NET" id = "AspNet">
+ <Command id = "MonoDevelop.AspNet.Mvc.AspMvcCommands.AddController"
+ _label = "Controller..."
+ _description = "Add an ASP.NET MVC controller" />
+ <Command id = "MonoDevelop.AspNet.Mvc.AspMvcCommands.AddView"
+ _label = "View..."
+ _description = "Add an ASP.NET MVC view" />
+ </Category>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Add">
+ <Condition id="activeproject" value="AspNetMvc">
+ <CommandItem id = "MonoDevelop.AspNet.Mvc.AspMvcCommands.AddController" insertbefore="MonoDevelop.Ide.Commands.ProjectCommands.AddNewFiles" disabledVisible="false"/>
+ <CommandItem id = "MonoDevelop.AspNet.Mvc.AspMvcCommands.AddView" disabledVisible="false" />
+ <SeparatorItem id = "MvcAddSeparator" />
+ </Condition>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
+ <NodeBuilder id="AspMvcFolderNodeBuilderExtension" class = "MonoDevelop.AspNet.Mvc.Gui.FolderNodeBuilderExtension"/>
+ </Extension>
+</Addin>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj
new file mode 100644
index 0000000000..d932b016bf
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/MonoDevelop.AspNet.Mvc.csproj
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{B32AD0DD-5247-437B-A2EF-1A4676C1B072}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>MonoDevelop.AspNet.Mvc</RootNamespace>
+ <AssemblyName>MonoDevelop.AspNet.Mvc</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\build</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\build</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="AspMvcProjectBinding.cs" />
+ <Compile Include="AspMvcProject.cs" />
+ <Compile Include="AspMvcProjectConfiguration.cs" />
+ <Compile Include="AspMvcCommands.cs" />
+ <Compile Include="Gui\FolderNodeBuilderExtension.cs" />
+ <Compile Include="TextTemplating\MvcTextTemplateHost.cs" />
+ <Compile Include="gtk-gui\generated.cs" />
+ <Compile Include="Gui\AddViewDialog.cs" />
+ <Compile Include="gtk-gui\MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="Mono.Posix" />
+ <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="MonoDevelop.AspNet.Mvc.addin.xml">
+ <LogicalName>MonoDevelop.AspNet.Mvc.addin.xml</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="gtk-gui\gui.stetic">
+ <LogicalName>gui.stetic</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <ProjectReference Include="..\..\TextTemplating\Mono.TextTemplating\Mono.TextTemplating.csproj">
+ <Project>{A2364D6A-00EF-417C-80A6-815726C70032}</Project>
+ <Name>Mono.TextTemplating</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\TextTemplating\MonoDevelop.TextTemplating\MonoDevelop.TextTemplating.csproj">
+ <Project>{8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}</Project>
+ <Name>MonoDevelop.TextTemplating</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Components\MonoDevelop.Components.csproj">
+ <Project>{3344D566-484B-4AEC-BBCF-86BC484D14B0}</Project>
+ <Name>MonoDevelop.Components</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
+ <Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
+ <Name>MonoDevelop.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Core.Gui\MonoDevelop.Core.Gui.csproj">
+ <Project>{659B0888-3956-4040-BDB1-B45F6D64E7FA}</Project>
+ <Name>MonoDevelop.Core.Gui</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.csproj">
+ <Project>{2C24D515-4A2C-445C-8419-C09231913CFA}</Project>
+ <Name>MonoDevelop.DesignerSupport</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
+ <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
+ <Name>MonoDevelop.Ide</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Projects\MonoDevelop.Projects.csproj">
+ <Project>{04BED15A-DDC5-48BC-A36C-3E360A0348C0}</Project>
+ <Name>MonoDevelop.Projects</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Projects.Gui\MonoDevelop.Projects.Gui.csproj">
+ <Project>{00E87426-F1BD-4B55-9B3E-7267EE93E002}</Project>
+ <Name>MonoDevelop.Projects.Gui</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor.csproj">
+ <Project>{F8F92AA4-A376-4679-A9D4-60E7B7FBF477}</Project>
+ <Name>MonoDevelop.SourceEditor</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\MonoDevelop.XmlEditor\MonoDevelop.XmlEditor.csproj">
+ <Project>{86DFC74A-B0B6-4C73-9E05-9098DA8FA5F1}</Project>
+ <Name>MonoDevelop.XmlEditor</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\MonoDevelop.AspNet\MonoDevelop.AspNet.csproj">
+ <Project>{1CF94D07-5480-4D10-A3CD-2EBD5E87B02E}</Project>
+ <Name>MonoDevelop.AspNet</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="true" IsAutotoolsProject="true" RelativeConfigureInPath="../../../..">
+ <BuildFilesVar Sync="true" Name="FILES" />
+ <DeployFilesVar Sync="true" Name="DATA_FILES" />
+ <ResourcesVar Sync="true" Name="RES" />
+ <OthersVar Name="DATA_FILES" />
+ <GacRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <AsmRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <ProjectRefVar Sync="true" Name="DEPS" />
+ </MonoDevelop.Autotools.MakefileInfo>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Controller.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Controller.xft.xml
new file mode 100644
index 0000000000..fca9d3242f
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Controller.xft.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<Template originator="Michael Hutchinson"
+ created="2009/02/17"
+ lastModified="2009/02/17">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC Controller</_Name>
+ <Icon>md-html-file-icon</Icon>
+ <_Category>ASP.NET MVC</_Category>
+ <LanguageName>*</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <_Description>Creates an ASP.NET MVC Controller.</_Description>
+ </TemplateConfiguration>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <CodeDomFile>
+ <CompileUnit>
+ <Namespaces>
+ <Namespace Name="">
+ <Imports>
+ <NamespaceImport Namespace="System" />
+ <NamespaceImport Namespace="System.Collections.Generic" />
+ <NamespaceImport Namespace="System.Linq" />
+ <NamespaceImport Namespace="System.Web" />
+ <NamespaceImport Namespace="System.Web.Mvc" />
+ <NamespaceImport Namespace="System.Web.Mvc.Ajax" />
+ </Imports>
+ </Namespace>
+ <Namespace Name="${Namespace}">
+ <Types>
+ <TypeDeclaration Name="${Name}" IsClass="true" >
+ <BaseTypes>
+ <TypeReference BaseType="Controller" />
+ </BaseTypes>
+ <Members>
+ </Members>
+ </TypeDeclaration>
+ </Types>
+ </Namespace>
+ </Namespaces>
+ </CompileUnit>
+ </CodeDomFile>
+ </TemplateFiles>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/EmptyProject.xpt.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/EmptyProject.xpt.xml
new file mode 100644
index 0000000000..da46c5ce14
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/EmptyProject.xpt.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<Template originator="Michael Hutchinson"
+ created="2009/02/17"
+ lastModified="2009/02/17">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>Empty ASP.NET MVC Project</_Name>
+ <_Category>C#/ASP.NET</_Category>
+ <Icon>md-project-web</Icon>
+ <LanguageName>C#</LanguageName>
+ <_Description>Creates an empty ASP.NET MVC Web Project.</_Description>
+ </TemplateConfiguration>
+
+ <!-- Actions -->
+ <Actions>
+ </Actions>
+
+ <!-- Template Content -->
+ <Combine name = "${ProjectName}" directory = ".">
+ <Options>
+ <StartupProject>${ProjectName}</StartupProject>
+ </Options>
+
+ <Project name = "${ProjectName}" directory = "." type = "AspNetMvc">
+ <Options TargetFrameworkVersion = "3.5" />
+ <References>
+ <Reference type="Gac" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <Reference type="Gac" refto="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <Reference type="Gac" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <Reference type="Gac" refto="System.Core" />
+ <Reference type="Gac" refto="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <Reference type="Gac" refto="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" SpecificVersion="false" />
+ <Reference type="Gac" refto="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference type="Gac" refto="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" SpecificVersion="false" />
+ <Reference type="Gac" refto="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" SpecificVersion="false" />
+ <Reference type="Gac" refto="System.Xml.Linq" />
+ </References>
+ <Files>
+ <Directory name="Content" />
+ <Directory name="Controllers" />
+ <Directory name="Models" />
+ <Directory name="Scripts" />
+ <Directory name="Views">
+ <FileTemplateReference TemplateID="AspMvcWebConfigViews" name="Web.config" SuppressAutoOpen="true" />
+ </Directory>
+ <FileTemplateReference TemplateID="AspMvcWebConfigApp" name="Web.config" SuppressAutoOpen="true" />
+ <FileTemplateReference TemplateID="AspMvcGlobalAsax" name="Global.asax" SuppressAutoOpen="true" />
+ </Files>
+ </Project>
+ </Combine>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/GlobalAsax.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/GlobalAsax.xft.xml
new file mode 100644
index 0000000000..f363196d8c
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/GlobalAsax.xft.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<Template Originator="Michael Hutchinson"
+ Created="2009/02/20"
+ LastModified="2009/02/20">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET Global.asax</_Name>
+ <_Category>ASP.NET MVC</_Category>
+ <Icon>md-html-file-icon</Icon>
+ <LanguageName>C#</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <DefaultFilename IsFixed="True">Global.asax</DefaultFilename>
+ <_Description>Creates an ASP.NET MVC Global.asax file.</_Description>
+ </TemplateConfiguration>
+
+ <Conditions>
+ <ParentProject PermittedCreationPaths="" ExcludedFiles="/Global.asax" />
+ </Conditions>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <AspNetFile name="Global.asax">
+ <FileText>
+<![CDATA[<%@ Application Inherits="${Namespace}.MvcApplication" %>]]>
+ </FileText>
+ </AspNetFile>
+ <File name="Global.asax.cs" DependsOn="Global.asax" >
+<![CDATA[
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
+
+namespace ${Namespace}
+{
+ public class MvcApplication : System.Web.HttpApplication
+ {
+ public static void RegisterRoutes(RouteCollection routes)
+ {
+ routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
+
+ routes.MapRoute(
+ "Default",
+ "{controller}/{action}/{id}",
+ new { controller = "Home", action = "Index", id = "" }
+ );
+
+ }
+
+ protected void Application_Start()
+ {
+ RegisterRoutes(RouteTable.Routes);
+ }
+ }
+}]]>
+ </File>
+ </TemplateFiles>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Project.xpt.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Project.xpt.xml
new file mode 100644
index 0000000000..a51024ad31
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/Project.xpt.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<Template originator="Michael Hutchinson"
+ created="2009/02/17"
+ lastModified="2009/02/17">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC Project</_Name>
+ <_Category>C#/ASP.NET</_Category>
+ <Icon>md-project-web</Icon>
+ <LanguageName>C#</LanguageName>
+ <_Description>Creates an ASP.NET MVC Web Project.</_Description>
+ </TemplateConfiguration>
+
+ <!-- Actions -->
+ <Actions>
+ </Actions>
+
+ <!-- Template Content -->
+ <Combine name = "${ProjectName}" directory = ".">
+ <Options>
+ <StartupProject>${ProjectName}</StartupProject>
+ </Options>
+
+ <Project name = "${ProjectName}" directory = "." type = "AspNetMvc">
+ <Options TargetFrameworkVersion = "3.5" />
+ <References>
+ <Reference type="Gac" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <Reference type="Gac" refto="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <Reference type="Gac" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <Reference type="Gac" refto="System.Core" />
+ <Reference type="Gac" refto="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <Reference type="Gac" refto="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" SpecificVersion="false" />
+ <Reference type="Gac" refto="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference type="Gac" refto="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" SpecificVersion="false" />
+ <Reference type="Gac" refto="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" SpecificVersion="false" />
+ <Reference type="Gac" refto="System.Xml.Linq" />
+ </References>
+ <Files>
+ <Directory name="Content" />
+ <Directory name="Controllers">
+ <File name="HomeController.cs"><![CDATA[using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Mvc.Ajax;
+
+namespace Controllers
+{
+
+ [HandleError]
+ public class HomeController : Controller
+ {
+ public ActionResult Index ()
+ {
+ ViewData["Message"] = "Welcome to ASP.NET MVC on Mono!";
+ return View ();
+ }
+ }
+}
+]]>
+ </File>
+ </Directory>
+ <Directory name="Models" />
+ <Directory name="Scripts" />
+ <Directory name="Views">
+ <FileTemplateReference TemplateID="AspMvcWebConfigViews" name="Web.config" SuppressAutoOpen="true" />
+ <Directory name="Home">
+ <AspNetFile name="Index.aspx">
+ <FileText><![CDATA[<%@ Page Language="${AspNetLanguage}" Inherits="System.Web.Mvc.ViewPage" %>
+${Doctype}
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <div>
+ <%= Html.Encode(ViewData["Message"]) %>
+ </div>
+</body>
+]]>
+ </FileText>
+ </AspNetFile>
+ </Directory>
+ </Directory>
+ <FileTemplateReference TemplateID="AspMvcWebConfigApp" name="Web.config" SuppressAutoOpen="true" />
+ <FileTemplateReference TemplateID="AspMvcGlobalAsax" name="Global.asax" SuppressAutoOpen="true" />
+ </Files>
+ </Project>
+ </Combine>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/UserControl.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/UserControl.xft.xml
new file mode 100644
index 0000000000..500f7fd97e
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/UserControl.xft.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<Template originator="Michael Hutchinson"
+ created="2009/02/17"
+ lastModified="2009/02/17">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC View User Control</_Name>
+ <Icon>md-html-file-icon</Icon>
+ <_Category>ASP.NET MVC</_Category>
+ <LanguageName>*</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <_Description>Creates an ASP.NET MVC User Control.</_Description>
+ </TemplateConfiguration>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <AspNetFile name="${Name}.ascx">
+ <FileText>
+ <![CDATA[<%@ Control Language="${AspNetLanguage}" Inherits="System.Web.Mvc.ViewUserControl" %>
+
+ ]]>
+ </FileText>
+ </AspNetFile>
+ </TemplateFiles>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewContentPage.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewContentPage.xft.xml
new file mode 100644
index 0000000000..ede305cf8a
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewContentPage.xft.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<Template originator="Michael Hutchinson"
+ created="2009/02/17"
+ lastModified="2009/02/17">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC View Content</_Name>
+ <Icon>md-html-file-icon</Icon>
+ <_Category>ASP.NET MVC</_Category>
+ <LanguageName>*</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <_Description>Creates an ASP.NET MVC View Content page.</_Description>
+ </TemplateConfiguration>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <AspNetMasterContentFile name="${Name}.aspx" DefaultExtension=".aspx">
+ <FileText>
+ <![CDATA[<%@ Page Title="" Language="${AspNetLanguage}" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="${AspNetMaster}" %>
+${AspNetMasterContent}
+]]>
+ </FileText>
+ </AspNetMasterContentFile>
+ </TemplateFiles>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewMasterPage.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewMasterPage.xft.xml
new file mode 100644
index 0000000000..f7d32398c9
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewMasterPage.xft.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<Template originator="Michael Hutchinson"
+ created="2009/02/17"
+ lastModified="2009/02/17">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC Master Page</_Name>
+ <Icon>md-html-file-icon</Icon>
+ <_Category>ASP.NET MVC</_Category>
+ <LanguageName>*</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <_Description>Creates an ASP.NET MVC Master Page.</_Description>
+ </TemplateConfiguration>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <AspNetFile name="${Name}.master">
+ <FileText>
+ <![CDATA[<%@ Master Language="${AspNetLanguage}" Inherits="System.Web.Mvc.ViewMasterPage" %>
+${Doctype}
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <asp:ContentPlaceHolder ID="head" runat="server">
+ <title></title>
+ </asp:ContentPlaceHolder>
+</head>
+<body>
+ <asp:ContentPlaceHolder ID="MainContent" runat="server">
+
+ </asp:ContentPlaceHolder>
+</body>
+</html>
+]]>
+ </FileText>
+ </AspNetFile>
+ </TemplateFiles>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewPage.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewPage.xft.xml
new file mode 100644
index 0000000000..e3bcd05446
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/ViewPage.xft.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<Template originator="Michael Hutchinson"
+ created="2009/02/17"
+ lastModified="2009/02/17">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC View Page</_Name>
+ <Icon>md-html-file-icon</Icon>
+ <_Category>ASP.NET MVC</_Category>
+ <LanguageName>*</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <_Description>Creates an MVC View page.</_Description>
+ </TemplateConfiguration>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <AspNetFile name="${Name}.aspx">
+ <FileText>
+ <![CDATA[<%@ Page Language="${AspNetLanguage}" Inherits="System.Web.Mvc.ViewPage" %>
+${Doctype}
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <div>
+
+ <div>
+</body>
+</html>]]>
+ </FileText>
+ </AspNetFile>
+ </TemplateFiles>
+</Template>
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigApp.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigApp.xft.xml
new file mode 100644
index 0000000000..4f7e5afc94
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigApp.xft.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0"?>
+<Template
+ Originator="Michael Hutchinson"
+ Created="2009/02/20"
+ LastModified="2009/02/20">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC Application Configuration</_Name>
+ <_Category>ASP.NET MVC</_Category>
+ <Icon>md-html-file-icon</Icon>
+ <LanguageName>*</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <DefaultFilename IsFixed="True">Web.config</DefaultFilename>
+ <_Description>Creates an ASP.NET MVC Web.config file for an application.</_Description>
+ </TemplateConfiguration>
+
+ <Conditions>
+ <ParentProject PermittedCreationPaths="" ExcludedFiles="Web.config" RequireProject="True"/>
+ </Conditions>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <AspNetFile name="Web.config">
+ <FileText>
+<![CDATA[<?xml version="1.0" ?>
+<!--
+Web.config file for ${ProjectName}.
+
+The settings that can be used in this file are documented at
+http://www.mono-project.com/Config_system.web and
+http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
+-->
+<configuration>
+ <configSections>
+ <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
+ <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
+ <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
+ </sectionGroup>
+ </sectionGroup>
+ </sectionGroup>
+ </configSections>
+
+ <system.web>
+ <!--
+ Set compilation debug="true" to insert debugging
+ symbols into the compiled page. Because this
+ affects performance, set this value to true only
+ during development.
+ -->
+ <compilation defaultLanguage="${AspNetLanguage}" debug="false">
+ <assemblies>
+ <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
+ <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
+ </assemblies>
+ </compilation>
+
+ <customErrors mode="RemoteOnly">
+ </customErrors>
+
+ <pages>
+ <controls>
+ <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </controls>
+
+ <namespaces>
+ <add namespace="System.Web.Mvc"/>
+ <add namespace="System.Web.Mvc.Ajax"/>
+ <add namespace="System.Web.Mvc.Html"/>
+ <add namespace="System.Web.Routing"/>
+ <add namespace="System.Linq"/>
+ <add namespace="System.Collections.Generic"/>
+ </namespaces>
+ </pages>
+
+ <authorization>
+ <allow users="*" />
+ </authorization>
+
+ <httpHandlers>
+ <remove verb="*" path="*.asmx"/>
+ <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
+ <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ </httpHandlers>
+
+ <httpModules>
+ <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
+ <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+ </httpModules>
+
+ <trace
+ enabled="false"
+ localOnly="true"
+ pageOutput="false"
+ requestLimit="10"
+ traceMode="SortByTime"
+ />
+
+ <globalization
+ requestEncoding="utf-8"
+ responseEncoding="utf-8"
+ />
+
+ </system.web>
+
+ <system.codedom>
+ <compilers>
+ <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
+ type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <providerOption name="CompilerVersion" value="v3.5"/>
+ <providerOption name="WarnAsError" value="false"/>
+ </compiler>
+ <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
+ type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <providerOption name="CompilerVersion" value="v3.5"/>
+ <providerOption name="OptionInfer" value="true"/>
+ <providerOption name="WarnAsError" value="false"/>
+ </compiler>
+ </compilers>
+ </system.codedom>
+
+ <system.web.extensions/>
+
+</configuration>]]>
+ </FileText>
+ </AspNetFile>
+ </TemplateFiles>
+</Template>
+
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigViews.xft.xml b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigViews.xft.xml
new file mode 100644
index 0000000000..989f68853d
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/Templates/WebConfigViews.xft.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<Template
+ Originator="Michael Hutchinson"
+ Created="2009/02/20"
+ LastModified="2009/02/20">
+
+ <!-- Template Header -->
+ <TemplateConfiguration>
+ <_Name>ASP.NET MVC Views Configuration</_Name>
+ <_Category>ASP.NET MVC</_Category>
+ <Icon>md-html-file-icon</Icon>
+ <LanguageName>*</LanguageName>
+ <ProjectType>AspNetMvc</ProjectType>
+ <DefaultFilename IsFixed="True">Web.config</DefaultFilename>
+ <_Description>Creates an ASP.NET MVC Web.config file for the Views directory.</_Description>
+ </TemplateConfiguration>
+
+ <Conditions>
+ <ParentProject PermittedCreationPaths="/Views" ExcludedFiles="Web.config" />
+ </Conditions>
+
+ <!-- Template Content -->
+ <TemplateFiles>
+ <File name="Web.config">
+<![CDATA[<?xml version="1.0"?>
+<configuration>
+ <system.web>
+ <httpHandlers>
+ <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
+ </httpHandlers>
+
+ <!--
+ Enabling request validation in view pages would cause validation to occur
+ after the input has already been processed by the controller. By default
+ MVC performs request validation before a controller processes the input.
+ To change this behavior apply the ValidateInputAttribute to a
+ controller or action.
+ -->
+ <pages validateRequest="false"
+ pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <controls>
+ <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
+ </controls>
+ </pages>
+ </system.web>
+
+ <system.webServer>
+ <validation validateIntegratedModeConfiguration="false"/>
+ <handlers>
+ <remove name="BlockViewHandler"/>
+ <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
+ </handlers>
+ </system.webServer>
+</configuration>]]>
+ </File>
+ </TemplateFiles>
+</Template> \ No newline at end of file
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/TextTemplating/MvcTextTemplateHost.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/TextTemplating/MvcTextTemplateHost.cs
new file mode 100644
index 0000000000..7ed5cd43d8
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/TextTemplating/MvcTextTemplateHost.cs
@@ -0,0 +1,84 @@
+//
+// MvcTextTemplateHost.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+
+namespace MonoDevelop.AspNet.Mvc.TextTemplating
+{
+
+ public class MvcTextTemplateHost : Mono.TextTemplating.TemplateGenerator
+ {
+
+ public MvcTextTemplateHost ()
+ {
+ Imports.Add ("MonoDevelop.AspNet.Mvc.TextTemplating");
+ Refs.Add (typeof (MvcTextTemplateHost).Assembly.Location);
+ }
+
+ public static MvcTextTemplateHost Create (AppDomain domain)
+ {
+ if (domain == null)
+ return new MvcTextTemplateHost ();
+
+ return (MvcTextTemplateHost) domain.CreateInstanceAndUnwrap (
+ typeof (MvcTextTemplateHost).Assembly.FullName,
+ typeof (MvcTextTemplateHost).FullName);
+ }
+
+ public string ItemName { get; set; }
+ public string NameSpace { get; set; }
+
+ #region Controller
+
+ public string ExtraActionMethods { get; set; }
+ public bool ControllerRootName { get; set; }
+
+ #endregion
+
+ #region View
+
+ public bool IsViewUserControl { get; set; }
+
+ public bool IsViewContentPage { get; set; }
+
+ public bool IsViewPage { get; set; }
+
+ public string MasterPage { get; set; }
+
+ public string ContentPlaceholder { get; set; }
+
+ public List<System.String> ContentPlaceHolders { get; set; }
+
+ public string LanguageExtension { get; set; }
+
+ public string ViewDataTypeGenericString { get; set; }
+
+ public Type ViewDataType { get; set; }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs
new file mode 100644
index 0000000000..5a1187c812
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.cs
@@ -0,0 +1,370 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+//
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace MonoDevelop.AspNet.Mvc.Gui {
+
+
+ public partial class AddViewDialog {
+
+ private Gtk.VBox vbox2;
+
+ private Gtk.Table table1;
+
+ private Gtk.Label label1;
+
+ private Gtk.Label label4;
+
+ private Gtk.Entry nameEntry;
+
+ private Gtk.ComboBox templateCombo;
+
+ private Gtk.Frame frame1;
+
+ private Gtk.Alignment alignment1;
+
+ private Gtk.VBox vbox4;
+
+ private Gtk.CheckButton partialCheck;
+
+ private Gtk.CheckButton stronglyTypedCheck;
+
+ private Gtk.Alignment typePanel;
+
+ private Gtk.HBox hbox1;
+
+ private Gtk.Label label3;
+
+ private Gtk.Alignment dataClassAlignment;
+
+ private Gtk.CheckButton masterCheck;
+
+ private Gtk.Alignment masterPanel;
+
+ private Gtk.VBox vbox3;
+
+ private Gtk.HBox hbox4;
+
+ private Gtk.Label label5;
+
+ private Gtk.Entry masterEntry;
+
+ private Gtk.Button masterButton;
+
+ private Gtk.HBox hbox3;
+
+ private Gtk.Label label2;
+
+ private Gtk.ComboBoxEntry primaryPlaceholderCombo;
+
+ private Gtk.Label GtkLabel6;
+
+ private Gtk.Button buttonCancel;
+
+ private Gtk.Button buttonOk;
+
+ protected virtual void Build() {
+ Stetic.Gui.Initialize(this);
+ // Widget MonoDevelop.AspNet.Mvc.Gui.AddViewDialog
+ this.Name = "MonoDevelop.AspNet.Mvc.Gui.AddViewDialog";
+ this.Title = Mono.Unix.Catalog.GetString("Add View");
+ this.WindowPosition = ((Gtk.WindowPosition)(4));
+ this.BorderWidth = ((uint)(6));
+ this.Resizable = false;
+ this.AllowGrow = false;
+ // Internal child MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.VBox
+ Gtk.VBox w1 = this.VBox;
+ w1.Name = "dialog1_VBox";
+ w1.BorderWidth = ((uint)(2));
+ // Container child dialog1_VBox.Gtk.Box+BoxChild
+ this.vbox2 = new Gtk.VBox();
+ this.vbox2.Name = "vbox2";
+ this.vbox2.Spacing = 6;
+ // Container child vbox2.Gtk.Box+BoxChild
+ this.table1 = new Gtk.Table(((uint)(2)), ((uint)(2)), false);
+ this.table1.Name = "table1";
+ this.table1.RowSpacing = ((uint)(6));
+ this.table1.ColumnSpacing = ((uint)(6));
+ // Container child table1.Gtk.Table+TableChild
+ this.label1 = new Gtk.Label();
+ this.label1.Name = "label1";
+ this.label1.Xalign = 0F;
+ this.label1.LabelProp = Mono.Unix.Catalog.GetString("_Name:");
+ this.label1.UseUnderline = true;
+ this.table1.Add(this.label1);
+ Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.label1]));
+ w2.XOptions = ((Gtk.AttachOptions)(4));
+ w2.YOptions = ((Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.label4 = new Gtk.Label();
+ this.label4.Name = "label4";
+ this.label4.Xalign = 0F;
+ this.label4.LabelProp = Mono.Unix.Catalog.GetString("_Template:");
+ this.label4.UseUnderline = true;
+ this.table1.Add(this.label4);
+ Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.label4]));
+ w3.TopAttach = ((uint)(1));
+ w3.BottomAttach = ((uint)(2));
+ w3.XOptions = ((Gtk.AttachOptions)(4));
+ w3.YOptions = ((Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.nameEntry = new Gtk.Entry();
+ this.nameEntry.CanFocus = true;
+ this.nameEntry.Name = "nameEntry";
+ this.nameEntry.IsEditable = true;
+ this.nameEntry.InvisibleChar = '●';
+ this.table1.Add(this.nameEntry);
+ Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.nameEntry]));
+ w4.LeftAttach = ((uint)(1));
+ w4.RightAttach = ((uint)(2));
+ w4.YOptions = ((Gtk.AttachOptions)(4));
+ // Container child table1.Gtk.Table+TableChild
+ this.templateCombo = Gtk.ComboBox.NewText();
+ this.templateCombo.Name = "templateCombo";
+ this.table1.Add(this.templateCombo);
+ Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table1[this.templateCombo]));
+ w5.TopAttach = ((uint)(1));
+ w5.BottomAttach = ((uint)(2));
+ w5.LeftAttach = ((uint)(1));
+ w5.RightAttach = ((uint)(2));
+ w5.XOptions = ((Gtk.AttachOptions)(4));
+ w5.YOptions = ((Gtk.AttachOptions)(4));
+ this.vbox2.Add(this.table1);
+ Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1]));
+ w6.Position = 0;
+ w6.Expand = false;
+ w6.Fill = false;
+ // Container child vbox2.Gtk.Box+BoxChild
+ this.frame1 = new Gtk.Frame();
+ this.frame1.Name = "frame1";
+ this.frame1.ShadowType = ((Gtk.ShadowType)(1));
+ this.frame1.BorderWidth = ((uint)(2));
+ // Container child frame1.Gtk.Container+ContainerChild
+ this.alignment1 = new Gtk.Alignment(0.5F, 0.5F, 1F, 1F);
+ this.alignment1.Name = "alignment1";
+ this.alignment1.LeftPadding = ((uint)(4));
+ this.alignment1.TopPadding = ((uint)(4));
+ this.alignment1.RightPadding = ((uint)(4));
+ this.alignment1.BottomPadding = ((uint)(4));
+ // Container child alignment1.Gtk.Container+ContainerChild
+ this.vbox4 = new Gtk.VBox();
+ this.vbox4.Name = "vbox4";
+ this.vbox4.Spacing = 6;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.partialCheck = new Gtk.CheckButton();
+ this.partialCheck.CanFocus = true;
+ this.partialCheck.Name = "partialCheck";
+ this.partialCheck.Label = Mono.Unix.Catalog.GetString("_Partial view (ascx)");
+ this.partialCheck.DrawIndicator = true;
+ this.partialCheck.UseUnderline = true;
+ this.vbox4.Add(this.partialCheck);
+ Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox4[this.partialCheck]));
+ w7.Position = 0;
+ w7.Expand = false;
+ w7.Fill = false;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.stronglyTypedCheck = new Gtk.CheckButton();
+ this.stronglyTypedCheck.CanFocus = true;
+ this.stronglyTypedCheck.Name = "stronglyTypedCheck";
+ this.stronglyTypedCheck.Label = Mono.Unix.Catalog.GetString("_Strongly typed");
+ this.stronglyTypedCheck.DrawIndicator = true;
+ this.stronglyTypedCheck.UseUnderline = true;
+ this.vbox4.Add(this.stronglyTypedCheck);
+ Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.vbox4[this.stronglyTypedCheck]));
+ w8.Position = 1;
+ w8.Expand = false;
+ w8.Fill = false;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.typePanel = new Gtk.Alignment(0F, 0F, 1F, 1F);
+ this.typePanel.Name = "typePanel";
+ this.typePanel.LeftPadding = ((uint)(24));
+ // Container child typePanel.Gtk.Container+ContainerChild
+ this.hbox1 = new Gtk.HBox();
+ this.hbox1.Name = "hbox1";
+ this.hbox1.Spacing = 6;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.label3 = new Gtk.Label();
+ this.label3.Name = "label3";
+ this.label3.Xalign = 0F;
+ this.label3.LabelProp = Mono.Unix.Catalog.GetString("_Data class:");
+ this.label3.UseUnderline = true;
+ this.hbox1.Add(this.label3);
+ Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox1[this.label3]));
+ w9.Position = 0;
+ w9.Expand = false;
+ w9.Fill = false;
+ // Container child hbox1.Gtk.Box+BoxChild
+ this.dataClassAlignment = new Gtk.Alignment(0.5F, 0.5F, 1F, 1F);
+ this.dataClassAlignment.Name = "dataClassAlignment";
+ this.hbox1.Add(this.dataClassAlignment);
+ Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.hbox1[this.dataClassAlignment]));
+ w10.Position = 1;
+ this.typePanel.Add(this.hbox1);
+ this.vbox4.Add(this.typePanel);
+ Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox4[this.typePanel]));
+ w12.Position = 2;
+ w12.Fill = false;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.masterCheck = new Gtk.CheckButton();
+ this.masterCheck.CanFocus = true;
+ this.masterCheck.Name = "masterCheck";
+ this.masterCheck.Label = Mono.Unix.Catalog.GetString("Has _master page:");
+ this.masterCheck.DrawIndicator = true;
+ this.masterCheck.UseUnderline = true;
+ this.vbox4.Add(this.masterCheck);
+ Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox4[this.masterCheck]));
+ w13.Position = 3;
+ w13.Expand = false;
+ w13.Fill = false;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.masterPanel = new Gtk.Alignment(0F, 0F, 1F, 1F);
+ this.masterPanel.Name = "masterPanel";
+ this.masterPanel.LeftPadding = ((uint)(24));
+ // Container child masterPanel.Gtk.Container+ContainerChild
+ this.vbox3 = new Gtk.VBox();
+ this.vbox3.Name = "vbox3";
+ this.vbox3.Spacing = 6;
+ // Container child vbox3.Gtk.Box+BoxChild
+ this.hbox4 = new Gtk.HBox();
+ this.hbox4.Name = "hbox4";
+ this.hbox4.Spacing = 6;
+ // Container child hbox4.Gtk.Box+BoxChild
+ this.label5 = new Gtk.Label();
+ this.label5.Name = "label5";
+ this.label5.LabelProp = Mono.Unix.Catalog.GetString("_File:");
+ this.label5.UseUnderline = true;
+ this.hbox4.Add(this.label5);
+ Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.hbox4[this.label5]));
+ w14.Position = 0;
+ w14.Expand = false;
+ w14.Fill = false;
+ // Container child hbox4.Gtk.Box+BoxChild
+ this.masterEntry = new Gtk.Entry();
+ this.masterEntry.CanFocus = true;
+ this.masterEntry.Name = "masterEntry";
+ this.masterEntry.IsEditable = true;
+ this.masterEntry.InvisibleChar = '●';
+ this.hbox4.Add(this.masterEntry);
+ Gtk.Box.BoxChild w15 = ((Gtk.Box.BoxChild)(this.hbox4[this.masterEntry]));
+ w15.Position = 1;
+ // Container child hbox4.Gtk.Box+BoxChild
+ this.masterButton = new Gtk.Button();
+ this.masterButton.CanFocus = true;
+ this.masterButton.Name = "masterButton";
+ this.masterButton.UseUnderline = true;
+ this.masterButton.Label = Mono.Unix.Catalog.GetString("...");
+ this.hbox4.Add(this.masterButton);
+ Gtk.Box.BoxChild w16 = ((Gtk.Box.BoxChild)(this.hbox4[this.masterButton]));
+ w16.Position = 2;
+ w16.Expand = false;
+ w16.Fill = false;
+ this.vbox3.Add(this.hbox4);
+ Gtk.Box.BoxChild w17 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox4]));
+ w17.Position = 0;
+ w17.Expand = false;
+ w17.Fill = false;
+ // Container child vbox3.Gtk.Box+BoxChild
+ this.hbox3 = new Gtk.HBox();
+ this.hbox3.Name = "hbox3";
+ this.hbox3.Spacing = 6;
+ // Container child hbox3.Gtk.Box+BoxChild
+ this.label2 = new Gtk.Label();
+ this.label2.Name = "label2";
+ this.label2.LabelProp = Mono.Unix.Catalog.GetString("P_rimary placeholder: ");
+ this.label2.UseUnderline = true;
+ this.hbox3.Add(this.label2);
+ Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.hbox3[this.label2]));
+ w18.Position = 0;
+ w18.Expand = false;
+ w18.Fill = false;
+ // Container child hbox3.Gtk.Box+BoxChild
+ this.primaryPlaceholderCombo = Gtk.ComboBoxEntry.NewText();
+ this.primaryPlaceholderCombo.WidthRequest = 250;
+ this.primaryPlaceholderCombo.Name = "primaryPlaceholderCombo";
+ this.hbox3.Add(this.primaryPlaceholderCombo);
+ Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.hbox3[this.primaryPlaceholderCombo]));
+ w19.Position = 1;
+ this.vbox3.Add(this.hbox3);
+ Gtk.Box.BoxChild w20 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox3]));
+ w20.Position = 1;
+ w20.Expand = false;
+ w20.Fill = false;
+ this.masterPanel.Add(this.vbox3);
+ this.vbox4.Add(this.masterPanel);
+ Gtk.Box.BoxChild w22 = ((Gtk.Box.BoxChild)(this.vbox4[this.masterPanel]));
+ w22.Position = 4;
+ w22.Expand = false;
+ w22.Fill = false;
+ this.alignment1.Add(this.vbox4);
+ this.frame1.Add(this.alignment1);
+ this.GtkLabel6 = new Gtk.Label();
+ this.GtkLabel6.Name = "GtkLabel6";
+ this.GtkLabel6.LabelProp = Mono.Unix.Catalog.GetString("Options");
+ this.frame1.LabelWidget = this.GtkLabel6;
+ this.vbox2.Add(this.frame1);
+ Gtk.Box.BoxChild w25 = ((Gtk.Box.BoxChild)(this.vbox2[this.frame1]));
+ w25.Position = 1;
+ w25.Expand = false;
+ w25.Fill = false;
+ w1.Add(this.vbox2);
+ Gtk.Box.BoxChild w26 = ((Gtk.Box.BoxChild)(w1[this.vbox2]));
+ w26.Position = 0;
+ w26.Expand = false;
+ w26.Fill = false;
+ // Internal child MonoDevelop.AspNet.Mvc.Gui.AddViewDialog.ActionArea
+ Gtk.HButtonBox w27 = this.ActionArea;
+ w27.Name = "dialog1_ActionArea";
+ w27.Spacing = 6;
+ w27.BorderWidth = ((uint)(5));
+ w27.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
+ // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+ this.buttonCancel = new Gtk.Button();
+ this.buttonCancel.CanDefault = true;
+ this.buttonCancel.CanFocus = true;
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.UseStock = true;
+ this.buttonCancel.UseUnderline = true;
+ this.buttonCancel.Label = "gtk-cancel";
+ this.AddActionWidget(this.buttonCancel, -6);
+ Gtk.ButtonBox.ButtonBoxChild w28 = ((Gtk.ButtonBox.ButtonBoxChild)(w27[this.buttonCancel]));
+ w28.Expand = false;
+ w28.Fill = false;
+ // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+ this.buttonOk = new Gtk.Button();
+ this.buttonOk.CanDefault = true;
+ this.buttonOk.CanFocus = true;
+ this.buttonOk.Name = "buttonOk";
+ this.buttonOk.UseStock = true;
+ this.buttonOk.UseUnderline = true;
+ this.buttonOk.Label = "gtk-ok";
+ this.AddActionWidget(this.buttonOk, -5);
+ Gtk.ButtonBox.ButtonBoxChild w29 = ((Gtk.ButtonBox.ButtonBoxChild)(w27[this.buttonOk]));
+ w29.Position = 1;
+ w29.Expand = false;
+ w29.Fill = false;
+ if ((this.Child != null)) {
+ this.Child.ShowAll();
+ }
+ this.DefaultWidth = 470;
+ this.DefaultHeight = 387;
+ this.label1.MnemonicWidget = this.nameEntry;
+ this.label4.MnemonicWidget = this.templateCombo;
+ this.label5.MnemonicWidget = this.masterEntry;
+ this.Show();
+ this.templateCombo.Changed += new System.EventHandler(this.Validate);
+ this.nameEntry.Changed += new System.EventHandler(this.Validate);
+ this.partialCheck.Toggled += new System.EventHandler(this.UpdateMasterPanelSensitivity);
+ this.stronglyTypedCheck.Toggled += new System.EventHandler(this.UpdateTypePanelSensitivity);
+ this.masterCheck.Toggled += new System.EventHandler(this.UpdateMasterPanelSensitivity);
+ this.masterEntry.Changed += new System.EventHandler(this.MasterChanged);
+ this.masterButton.Clicked += new System.EventHandler(this.ShowMasterSelectionDialog);
+ this.primaryPlaceholderCombo.Changed += new System.EventHandler(this.Validate);
+ }
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/generated.cs b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/generated.cs
new file mode 100644
index 0000000000..8b467a5a2f
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/generated.cs
@@ -0,0 +1,35 @@
+// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+//
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace Stetic {
+
+
+ internal class Gui {
+
+ private static bool initialized;
+
+ internal static void Initialize(Gtk.Widget iconRenderer) {
+ if ((Stetic.Gui.initialized == false)) {
+ Stetic.Gui.initialized = true;
+ }
+ }
+ }
+
+ internal class ActionGroups {
+
+ public static Gtk.ActionGroup GetActionGroup(System.Type type) {
+ return Stetic.ActionGroups.GetActionGroup(type.FullName);
+ }
+
+ public static Gtk.ActionGroup GetActionGroup(string name) {
+ return null;
+ }
+ }
+}
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/gui.stetic b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/gui.stetic
new file mode 100644
index 0000000000..8acac0629d
--- /dev/null
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.Mvc/gtk-gui/gui.stetic
@@ -0,0 +1,436 @@
+<?xml version="1.0" encoding="utf-8"?>
+<stetic-interface>
+ <configuration>
+ <images-root-path>..</images-root-path>
+ <target-gtk-version>2.12</target-gtk-version>
+ </configuration>
+ <import>
+ <widget-library name="MonoDevelop.AspNet, Version=2.0.0.0, Culture=neutral" />
+ <widget-library name="MonoDevelop.XmlEditor, Version=2.0.0.0, Culture=neutral" />
+ <widget-library name="MonoDevelop.Projects.Gui, Version=2.0.0.0, Culture=neutral" />
+ <widget-library name="MonoDevelop.Ide, Version=2.0.0.0, Culture=neutral" />
+ <widget-library name="MonoDevelop.Components, Version=2.0.0.0, Culture=neutral" />
+ <widget-library name="MonoDevelop.Core.Gui, Version=2.0.0.0, Culture=neutral" />
+ <widget-library name="MonoDevelop.SourceEditor2, Version=2.0.0.0, Culture=neutral" />
+ <widget-library name="../../build/MonoDevelop.TextTemplating.dll" />
+ <widget-library name="../../build/MonoDevelop.AspNet.Mvc.dll" internal="true" />
+ </import>
+ <widget class="Gtk.Dialog" id="MonoDevelop.AspNet.Mvc.Gui.AddViewDialog" design-size="470 387">
+ <property name="MemberName" />
+ <property name="Title" translatable="yes">Add View</property>
+ <property name="WindowPosition">CenterOnParent</property>
+ <property name="BorderWidth">6</property>
+ <property name="Resizable">False</property>
+ <property name="AllowGrow">False</property>
+ <property name="Buttons">2</property>
+ <property name="HelpButton">False</property>
+ <child internal-child="VBox">
+ <widget class="Gtk.VBox" id="dialog1_VBox">
+ <property name="MemberName" />
+ <property name="BorderWidth">2</property>
+ <child>
+ <widget class="Gtk.VBox" id="vbox2">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Table" id="table1">
+ <property name="MemberName" />
+ <property name="NRows">2</property>
+ <property name="NColumns">2</property>
+ <property name="RowSpacing">6</property>
+ <property name="ColumnSpacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label1">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="LabelProp" translatable="yes">_Name:</property>
+ <property name="UseUnderline">True</property>
+ <property name="MnemonicWidget">nameEntry</property>
+ </widget>
+ <packing>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="label4">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="LabelProp" translatable="yes">_Template:</property>
+ <property name="UseUnderline">True</property>
+ <property name="MnemonicWidget">templateCombo</property>
+ </widget>
+ <packing>
+ <property name="TopAttach">1</property>
+ <property name="BottomAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="nameEntry">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">●</property>
+ <signal name="Changed" handler="Validate" />
+ </widget>
+ <packing>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">False</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">True</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.ComboBox" id="templateCombo">
+ <property name="MemberName" />
+ <property name="IsTextCombo">True</property>
+ <property name="Items" translatable="yes" />
+ <signal name="Changed" handler="Validate" />
+ </widget>
+ <packing>
+ <property name="TopAttach">1</property>
+ <property name="BottomAttach">2</property>
+ <property name="LeftAttach">1</property>
+ <property name="RightAttach">2</property>
+ <property name="AutoSize">True</property>
+ <property name="XOptions">Fill</property>
+ <property name="YOptions">Fill</property>
+ <property name="XExpand">False</property>
+ <property name="XFill">True</property>
+ <property name="XShrink">False</property>
+ <property name="YExpand">False</property>
+ <property name="YFill">True</property>
+ <property name="YShrink">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Frame" id="frame1">
+ <property name="MemberName" />
+ <property name="ShadowType">In</property>
+ <property name="BorderWidth">2</property>
+ <child>
+ <widget class="Gtk.Alignment" id="alignment1">
+ <property name="MemberName" />
+ <property name="LeftPadding">4</property>
+ <property name="TopPadding">4</property>
+ <property name="RightPadding">4</property>
+ <property name="BottomPadding">4</property>
+ <child>
+ <widget class="Gtk.VBox" id="vbox4">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.CheckButton" id="partialCheck">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">_Partial view (ascx)</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ <signal name="Toggled" handler="UpdateMasterPanelSensitivity" />
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.CheckButton" id="stronglyTypedCheck">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">_Strongly typed</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ <signal name="Toggled" handler="UpdateTypePanelSensitivity" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Alignment" id="typePanel">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="Yalign">0</property>
+ <property name="LeftPadding">24</property>
+ <child>
+ <widget class="Gtk.HBox" id="hbox1">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label3">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="LabelProp" translatable="yes">_Data class:</property>
+ <property name="UseUnderline">True</property>
+ <property name="MnemonicWidget">dataClassCombo</property>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Alignment" id="dataClassAlignment">
+ <property name="MemberName" />
+ <child>
+ <placeholder />
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.CheckButton" id="masterCheck">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">Has _master page:</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ <signal name="Toggled" handler="UpdateMasterPanelSensitivity" />
+ </widget>
+ <packing>
+ <property name="Position">3</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Alignment" id="masterPanel">
+ <property name="MemberName" />
+ <property name="Xalign">0</property>
+ <property name="Yalign">0</property>
+ <property name="LeftPadding">24</property>
+ <child>
+ <widget class="Gtk.VBox" id="vbox3">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.HBox" id="hbox4">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label5">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">_File:</property>
+ <property name="UseUnderline">True</property>
+ <property name="MnemonicWidget">masterEntry</property>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Entry" id="masterEntry">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">●</property>
+ <signal name="Changed" handler="MasterChanged" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="masterButton">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Type">TextOnly</property>
+ <property name="Label" translatable="yes">...</property>
+ <property name="UseUnderline">True</property>
+ <signal name="Clicked" handler="ShowMasterSelectionDialog" />
+ </widget>
+ <packing>
+ <property name="Position">2</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.HBox" id="hbox3">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <child>
+ <widget class="Gtk.Label" id="label2">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">P_rimary placeholder: </property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.ComboBoxEntry" id="primaryPlaceholderCombo">
+ <property name="MemberName" />
+ <property name="WidthRequest">250</property>
+ <property name="IsTextCombo">True</property>
+ <property name="Items" translatable="yes" />
+ <signal name="Changed" handler="Validate" />
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">4</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="Gtk.Label" id="GtkLabel6">
+ <property name="MemberName" />
+ <property name="LabelProp" translatable="yes">Options</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="Position">0</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child internal-child="ActionArea">
+ <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
+ <property name="MemberName" />
+ <property name="Spacing">6</property>
+ <property name="BorderWidth">5</property>
+ <property name="Size">2</property>
+ <property name="LayoutStyle">End</property>
+ <child>
+ <widget class="Gtk.Button" id="buttonCancel">
+ <property name="MemberName" />
+ <property name="CanDefault">True</property>
+ <property name="CanFocus">True</property>
+ <property name="UseStock">True</property>
+ <property name="Type">StockItem</property>
+ <property name="StockId">gtk-cancel</property>
+ <property name="ResponseId">-6</property>
+ <property name="label">gtk-cancel</property>
+ </widget>
+ <packing>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="Gtk.Button" id="buttonOk">
+ <property name="MemberName" />
+ <property name="CanDefault">True</property>
+ <property name="CanFocus">True</property>
+ <property name="UseStock">True</property>
+ <property name="Type">StockItem</property>
+ <property name="StockId">gtk-ok</property>
+ <property name="ResponseId">-5</property>
+ <property name="label">gtk-ok</property>
+ </widget>
+ <packing>
+ <property name="Position">1</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</stetic-interface> \ No newline at end of file
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/ChangeLog b/main/src/addins/AspNet/MonoDevelop.AspNet/ChangeLog
index 50c941a1e0..4d3db7d5fb 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/ChangeLog
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.AspNet.csproj: Include the ASP.NET MVC and
+ TextTemplating addins in the main solution and build.
+
2009-08-10 Lluis Sanchez Gual <lluis@novell.com>
* AspNetAddIn.csproj: Don't local-copy project references.
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj
index 2f50fa4539..f4328885c6 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj
@@ -14,7 +14,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
- <OutputPath>..\..\..\build\AddIns\MonoDevelop.AspNet</OutputPath>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.AspNet</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
@@ -25,7 +25,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
- <OutputPath>..\..\..\build\AddIns\MonoDevelop.AspNet</OutputPath>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.AspNet</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
diff --git a/main/src/addins/ChangeLog b/main/src/addins/ChangeLog
index bc20d56401..23ff6f26cc 100644
--- a/main/src/addins/ChangeLog
+++ b/main/src/addins/ChangeLog
@@ -1,5 +1,11 @@
2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+ * Makefile.am:
+ * TextTemplating: Include the ASP.NET MVC and TextTemplating
+ addins in the main solution and build.
+
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
* Makefile.am, AspNetAddin, AspNet: Move ASP.NET into a
subdirectory and rename, in preparation for adding the MVC addin.
diff --git a/main/src/addins/Makefile.am b/main/src/addins/Makefile.am
index 46880e36ca..3a380232b3 100644
--- a/main/src/addins/Makefile.am
+++ b/main/src/addins/Makefile.am
@@ -21,7 +21,8 @@ SUBDIRS = \
MonoDevelop.GtkCore \
ChangeLogAddIn \
MonoDevelop.XmlEditor \
- AspNet/MonoDevelop.AspNet \
+ TextTemplating \
+ AspNet \
MonoDevelop.WebReferences \
MonoDevelop.RegexToolkit \
CBinding \
diff --git a/main/src/addins/MonoDevelop.Moonlight/ChangeLog b/main/src/addins/MonoDevelop.Moonlight/ChangeLog
index 869461ec47..9da360ee59 100644
--- a/main/src/addins/MonoDevelop.Moonlight/ChangeLog
+++ b/main/src/addins/MonoDevelop.Moonlight/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.Moonlight.csproj: Fix build.
+
2009-08-03 Lluis Sanchez Gual <lluis@novell.com>
* MonoDevelop.Moonlight/SilverlightFrameworkBackend.cs: Track
diff --git a/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight.csproj b/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight.csproj
index 2841763fd7..47563257fd 100644
--- a/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight.csproj
+++ b/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight.csproj
@@ -95,16 +95,15 @@
<Name>MonoDevelop.XmlEditor</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\AspNetAddIn\AspNetAddIn.csproj">
- <Project>{1CF94D07-5480-4D10-A3CD-2EBD5E87B02E}</Project>
- <Name>AspNetAddIn</Name>
- <Private>False</Private>
- </ProjectReference>
<ProjectReference Include="..\..\core\MonoDevelop.Components\MonoDevelop.Components.csproj">
<Project>{3344D566-484B-4AEC-BBCF-86BC484D14B0}</Project>
<Name>MonoDevelop.Components</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\AspNet\MonoDevelop.AspNet\MonoDevelop.AspNet.csproj">
+ <Project>{1CF94D07-5480-4D10-A3CD-2EBD5E87B02E}</Project>
+ <Name>MonoDevelop.AspNet</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic">
diff --git a/main/src/addins/TextTemplating/ChangeLog b/main/src/addins/TextTemplating/ChangeLog
new file mode 100644
index 0000000000..b50bf1355a
--- /dev/null
+++ b/main/src/addins/TextTemplating/ChangeLog
@@ -0,0 +1,9 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Makefile.am:
+ * TextTransform:
+ * Mono.TextTemplating:
+ * Mono.TextTemplating.Tests:
+ * MonoDevelop.TextTemplating: Include the ASP.NET MVC and
+ TextTemplating addins in the main solution and build.
+
diff --git a/main/src/addins/TextTemplating/Makefile.am b/main/src/addins/TextTemplating/Makefile.am
new file mode 100644
index 0000000000..f0cb7546d7
--- /dev/null
+++ b/main/src/addins/TextTemplating/Makefile.am
@@ -0,0 +1,4 @@
+SUBDIRS = \
+ Mono.TextTemplating \
+ TextTransform \
+ MonoDevelop.TextTemplating
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ChangeLog b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ChangeLog
new file mode 100644
index 0000000000..4c30eed09a
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ChangeLog
@@ -0,0 +1,42 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.Tests.csproj: Include the ASP.NET MVC
+ and TextTemplating addins in the main solution and build.
+
+2009-04-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * GenerationTests.cs: Add tests for Windows/Mac newlines.
+
+2009-04-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.Tests.csproj: Updated.
+
+ * GenerationTests.cs: Add test for C# output.
+
+ * ParsingTests.cs: Track dummy host name change.
+
+ * DummyHost.cs: Add more functionality to dummy host.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.Tests.csproj: Move output dir from
+ ../bin to ../build.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.Tests.csproj: Fix output directory.
+
+2009-03-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.Tests.csproj: Updated.
+
+ * ParsingTests.cs: Add parser test.
+
+ * DummyHost.cs: Dummy templating host.
+
+2009-03-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.Tests.csproj: Add tests.
+
+ * ParsingTests.cs: Tokeniser state/value/location test.
+
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs
new file mode 100644
index 0000000000..d69d4c8ecf
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/DummyHost.cs
@@ -0,0 +1,112 @@
+//
+// IncludeFileProviderHost.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.CodeDom.Compiler;
+using Microsoft.VisualStudio.TextTemplating;
+
+namespace Mono.TextTemplating.Tests
+{
+
+ public class DummyHost : ITextTemplatingEngineHost
+ {
+ public readonly Dictionary<string, string> Locations = new Dictionary<string, string> ();
+ public readonly Dictionary<string, string> Contents = new Dictionary<string, string> ();
+ public readonly Dictionary<string, object> HostOptions = new Dictionary<string, object> ();
+ List<string> standardAssemblyReferences = new List<string> ();
+ List<string> standardImports = new List<string> ();
+ public readonly CompilerErrorCollection Errors = new CompilerErrorCollection ();
+ public readonly Dictionary<string, Type> DirectiveProcessors = new Dictionary<string, Type> ();
+
+ public virtual object GetHostOption (string optionName)
+ {
+ object o;
+ HostOptions.TryGetValue (optionName, out o);
+ return o;
+ }
+
+ public virtual bool LoadIncludeText (string requestFileName, out string content, out string location)
+ {
+ return Locations.TryGetValue (requestFileName, out location)
+ && Contents.TryGetValue (requestFileName, out content);
+ }
+
+ public virtual void LogErrors (CompilerErrorCollection errors)
+ {
+ Errors.AddRange (errors);
+ }
+
+ public virtual AppDomain ProvideTemplatingAppDomain (string content)
+ {
+ return null;
+ }
+
+ public virtual string ResolveAssemblyReference (string assemblyReference)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public virtual Type ResolveDirectiveProcessor (string processorName)
+ {
+ Type t;
+ DirectiveProcessors.TryGetValue (processorName, out t);
+ return t;
+ }
+
+ public virtual string ResolveParameterValue (string directiveId, string processorName, string parameterName)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public virtual string ResolvePath (string path)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public virtual void SetFileExtension (string extension)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public virtual void SetOutputEncoding (System.Text.Encoding encoding, bool fromOutputDirective)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public virtual IList<string> StandardAssemblyReferences {
+ get { return standardAssemblyReferences; }
+ }
+
+ public virtual IList<string> StandardImports {
+ get { return standardImports; }
+ }
+
+ public virtual string TemplateFile {
+ get; set;
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs
new file mode 100644
index 0000000000..58a0add2ad
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/GenerationTests.cs
@@ -0,0 +1,174 @@
+//
+// GenerationTests.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using Microsoft.VisualStudio.TextTemplating;
+
+namespace Mono.TextTemplating.Tests
+{
+
+
+ [TestFixture]
+ public class GenerationTests
+ {
+ [Test]
+ public void Generate ()
+ {
+ string Input = ParsingTests.ParseSample1;
+ string Output = OutputSample1;
+ Generate (Input, Output, "\n");
+ }
+
+ [Test]
+ public void GenerateMacNewlines ()
+ {
+ string MacInput = ParsingTests.ParseSample1.Replace ("\n", "\r");
+ string MacOutput = OutputSample1.Replace ("\\n", "\\r").Replace ("\n", "\r");;
+ Generate (MacInput, MacOutput, "\r");
+ }
+
+ [Test]
+ public void GenerateWindowsNewlines ()
+ {
+ string WinInput = ParsingTests.ParseSample1.Replace ("\n", "\r\n");
+ string WinOutput = OutputSample1.Replace ("\\n", "\\r\\n").Replace ("\n", "\r\n");
+ Generate (WinInput, WinOutput, "\r\n");
+ }
+
+ //NOTE: we set the newline property on the code generator so that the whole files has matching newlines,
+ // in order to match the newlines in the verbatim code blocks
+ void Generate (string input, string expectedOutput, string newline)
+ {
+ DummyHost host = new DummyHost ();
+ string className = "GeneratedTextTransformation4f504ca0";
+ string code = GenerateCode (host, input, className, newline);
+ Assert.AreEqual (0, host.Errors.Count);
+ Assert.AreEqual (expectedOutput, code);
+ }
+
+ #region Helpers
+
+ string GenerateCode (ITextTemplatingEngineHost host, string content, string name, string generatorNewline)
+ {
+ ParsedTemplate pt = ParsedTemplate.FromText (content, host);
+ if (pt.Errors.HasErrors) {
+ host.LogErrors (pt.Errors);
+ return null;
+ }
+
+ TemplateSettings settings = TemplatingEngine.GetSettings (host, pt);
+ if (name != null)
+ settings.Name = name;
+ if (pt.Errors.HasErrors) {
+ host.LogErrors (pt.Errors);
+ return null;
+ }
+
+ var ccu = TemplatingEngine.GenerateCompileUnit (host, pt, settings);
+ if (pt.Errors.HasErrors) {
+ host.LogErrors (pt.Errors);
+ return null;
+ }
+
+ var opts = new System.CodeDom.Compiler.CodeGeneratorOptions ();
+ using (var writer = new System.IO.StringWriter ()) {
+ writer.NewLine = generatorNewline;
+ settings.Provider.GenerateCodeFromCompileUnit (ccu, writer, opts);
+ return writer.ToString ();
+ }
+ }
+
+ #endregion
+
+ #region Expected output strings
+
+ public static string OutputSample1 =
+@"// ------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+// Mono Runtime Version: 2.0.50727.1433
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace Microsoft.VisualStudio.TextTemplating {
+
+
+ public class GeneratedTextTransformation4f504ca0 : Microsoft.VisualStudio.TextTemplating.TextTransformation {
+
+
+ #line 9 """"
+
+baz \#>
+
+ #line default
+ #line hidden
+
+ public override string TransformText() {
+
+ #line 2 """"
+ this.Write(""Line One\nLine Two\n"");
+
+ #line default
+ #line hidden
+
+ #line 4 """"
+
+foo
+
+
+ #line default
+ #line hidden
+
+ #line 7 """"
+ this.Write(""Line Three "");
+
+ #line default
+ #line hidden
+
+ #line 7 """"
+ this.Write(Microsoft.VisualStudio.TextTemplating.ToStringHelper.ToStringWithCulture( bar ));
+
+ #line default
+ #line hidden
+
+ #line 7 """"
+ this.Write(""\nLine Four\n"");
+
+ #line default
+ #line hidden
+ return this.GenerationEnvironment.ToString();
+ }
+ }
+}
+";
+ #endregion
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj
new file mode 100644
index 0000000000..a35da9ec39
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/Mono.TextTemplating.Tests.csproj
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{CB590106-8331-4CBE-8131-B154E7BF79E1}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AssemblyName>Mono.TextTemplating.Tests</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="nunit.core, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
+ <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ParsingTests.cs" />
+ <Compile Include="DummyHost.cs" />
+ <Compile Include="GenerationTests.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Mono.TextTemplating\Mono.TextTemplating.csproj">
+ <Project>{A2364D6A-00EF-417C-80A6-815726C70032}</Project>
+ <Name>Mono.TextTemplating</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs
new file mode 100644
index 0000000000..5e2475091d
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating.Tests/ParsingTests.cs
@@ -0,0 +1,191 @@
+//
+// Test.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+
+namespace Mono.TextTemplating.Tests
+{
+
+
+ [TestFixture]
+ public class ParsingTests
+ {
+ public static string ParseSample1 =
+@"<#@ template language=""C#v3.5"" #>
+Line One
+Line Two
+<#
+foo
+#>
+Line Three <#= bar #>
+Line Four
+<#+
+baz \#>
+#>
+";
+
+ [Test]
+ public void TokenTest ()
+ {
+ string tf = "test.input";
+ Tokeniser tk = new Tokeniser (tf, ParseSample1);
+
+ //line 1
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 1, 1), tk.Location);
+ Assert.AreEqual (State.Content, tk.State);
+ Assert.AreEqual ("", tk.Value);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (State.Directive, tk.State);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 1, 5), tk.Location);
+ Assert.AreEqual (State.DirectiveName, tk.State);
+ Assert.AreEqual ("template", tk.Value);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (State.Directive, tk.State);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 1, 14), tk.Location);
+ Assert.AreEqual (State.DirectiveName, tk.State);
+ Assert.AreEqual ("language", tk.Value);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (State.Directive, tk.State);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (State.DirectiveValue, tk.State);
+ Assert.AreEqual (new Location (tf, 1, 23), tk.Location);
+ Assert.AreEqual ("C#v3.5", tk.Value);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (State.Directive, tk.State);
+
+ //line 2, 3
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 2, 1), tk.Location);
+ Assert.AreEqual (State.Content, tk.State);
+ Assert.AreEqual ("Line One\nLine Two\n", tk.Value);
+
+ //line 4, 5, 6
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 4, 1), tk.TagStartLocation);
+ Assert.AreEqual (new Location (tf, 4, 3), tk.Location);
+ Assert.AreEqual (new Location (tf, 6, 3), tk.TagEndLocation);
+ Assert.AreEqual (State.Block, tk.State);
+ Assert.AreEqual ("\nfoo\n", tk.Value);
+
+ //line 7
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 7, 1), tk.Location);
+ Assert.AreEqual (State.Content, tk.State);
+ Assert.AreEqual ("Line Three ", tk.Value);
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 7, 12), tk.TagStartLocation);
+ Assert.AreEqual (new Location (tf, 7, 15), tk.Location);
+ Assert.AreEqual (new Location (tf, 7, 22), tk.TagEndLocation);
+ Assert.AreEqual (State.Expression, tk.State);
+ Assert.AreEqual (" bar ", tk.Value);
+
+ //line 8
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 7, 22), tk.Location);
+ Assert.AreEqual (State.Content, tk.State);
+ Assert.AreEqual ("\nLine Four\n", tk.Value);
+
+ //line 9, 10, 11
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 9, 1), tk.TagStartLocation);
+ Assert.AreEqual (new Location (tf, 9, 4), tk.Location);
+ Assert.AreEqual (new Location (tf, 11, 3), tk.TagEndLocation);
+ Assert.AreEqual (State.Helper, tk.State);
+ Assert.AreEqual (" \nbaz \\#>\n", tk.Value);
+
+ //line 12
+ Assert.IsTrue (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 12, 1), tk.Location);
+ Assert.AreEqual (State.Content, tk.State);
+ Assert.AreEqual ("", tk.Value);
+
+ //EOF
+ Assert.IsFalse (tk.Advance ());
+ Assert.AreEqual (new Location (tf, 12, 1), tk.Location);
+ Assert.AreEqual (State.EOF, tk.State);
+ }
+
+ [Test]
+ public void ParseTest ()
+ {
+ string tf = "test.input";
+
+ ParsedTemplate pt = new ParsedTemplate ("test.input");
+ Tokeniser tk = new Tokeniser (tf, ParseSample1);
+ DummyHost host = new DummyHost ();
+ pt.Parse (host, tk);
+
+ Assert.AreEqual (0, pt.Errors.Count);
+ var content = new List<TemplateSegment> (pt.Content);
+ var dirs = new List<Directive> (pt.Directives);
+
+ Assert.AreEqual (1, dirs.Count);
+ Assert.AreEqual (6, content.Count);
+
+ Assert.AreEqual ("template", dirs[0].Name);
+ Assert.AreEqual (1, dirs[0].Attributes.Count);
+ Assert.AreEqual ("C#v3.5", dirs[0].Attributes["language"]);
+ Assert.AreEqual (new Location (tf, 1, 1), dirs[0].TagStartLocation);
+ Assert.AreEqual (new Location (tf, 1, 34), dirs[0].EndLocation);
+
+ Assert.AreEqual ("Line One\nLine Two\n", content[0].Text);
+ Assert.AreEqual ("\nfoo\n", content[1].Text);
+ Assert.AreEqual ("Line Three ", content[2].Text);
+ Assert.AreEqual (" bar ", content[3].Text);
+ Assert.AreEqual ("\nLine Four\n", content[4].Text);
+ Assert.AreEqual (" \nbaz \\#>\n", content[5].Text);
+
+ Assert.AreEqual (SegmentType.Content, content[0].Type);
+ Assert.AreEqual (SegmentType.Block, content[1].Type);
+ Assert.AreEqual (SegmentType.Content, content[2].Type);
+ Assert.AreEqual (SegmentType.Expression, content[3].Type);
+ Assert.AreEqual (SegmentType.Content, content[4].Type);
+ Assert.AreEqual (SegmentType.Helper, content[5].Type);
+
+ Assert.AreEqual (new Location (tf, 4, 1), content[1].TagStartLocation);
+ Assert.AreEqual (new Location (tf, 7, 12), content[3].TagStartLocation);
+ Assert.AreEqual (new Location (tf, 9, 1), content[5].TagStartLocation);
+
+ Assert.AreEqual (new Location (tf, 2, 1), content[0].StartLocation);
+ Assert.AreEqual (new Location (tf, 4, 3), content[1].StartLocation);
+ Assert.AreEqual (new Location (tf, 7, 1), content[2].StartLocation);
+ Assert.AreEqual (new Location (tf, 7, 15), content[3].StartLocation);
+ Assert.AreEqual (new Location (tf, 7, 22), content[4].StartLocation);
+ Assert.AreEqual (new Location (tf, 9, 4), content[5].StartLocation);
+
+ Assert.AreEqual (new Location (tf, 6, 3), content[1].EndLocation);
+ Assert.AreEqual (new Location (tf, 7, 22), content[3].EndLocation);
+ Assert.AreEqual (new Location (tf, 11, 3), content[5].EndLocation);
+ }
+
+
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs
new file mode 100644
index 0000000000..b85bc1b3e3
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle("Mono.TextTemplating")]
+[assembly: AssemblyDescription("An implementation of Visual Studio's T4 text templating")]
+[assembly: AssemblyCompany("The Mono Project")]
+[assembly: AssemblyProduct("MonoDevelop")]
+[assembly: AssemblyCopyright("MIT/X11")]
+
+//[assembly: AssemblyVersion("1.0.*")]
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/ChangeLog b/main/src/addins/TextTemplating/Mono.TextTemplating/ChangeLog
new file mode 100644
index 0000000000..0f02f7cee2
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/ChangeLog
@@ -0,0 +1,177 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Makefile.am:
+ * Mono.TextTemplating.csproj: Include the ASP.NET MVC and
+ TextTemplating addins in the main solution and build.
+
+2009-08-11 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.csproj:
+ * Mono.TextTemplating/ParsedTemplate.cs:
+ * Mono.TextTemplating/CompiledTemplate.cs:
+ * Mono.TextTemplating/TemplatingEngine.cs:
+ * Mono.TextTemplating/TemplateGenerator.cs:
+ * Mono.TextTemplating/IExtendedTextTemplatingEngineHost.cs:
+ Add support for caching compiled templates, and a couple of
+ bugfixes. Patch from Nathan Baulch
+ (nathan.baulch@gmail.com).
+
+2009-06-25 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/TemplatingEngine.cs: Handle expressions
+ and content in helpers, based on patch from Nathan Baulch.
+ Liberally add C# 3 sugar to neaten up CodeDOM usage.
+
+2009-06-25 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/TemplateGenerator.cs: Added overload for
+ Process template that uses input/output strings directly,
+ avoiding file read/write. Expose engine to subclasses.
+
+ * Mono.TextTemplating/Tokeniser.cs: Remove outdated TODO.
+
+2009-04-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs: Use
+ IConvertible.ToString (formatProvider) when possible.
+
+ Thanks to Stuart Carnie for this patch.
+
+2009-04-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/Tokeniser.cs: Add support for Mac and
+ Windows newlines.
+
+ * Mono.TextTemplating/TemplatingEngine.cs: Keep temp files
+ when in debug mode, so that the generated code can be
+ debugged.
+
+ * Mono.TextTemplating/ParsedTemplate.cs: Fixes for csc
+ compilation.
+
+ Thanks to Stuart Carnie for this patch.
+
+2009-04-03 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.csproj:
+ * Mono.TextTemplating/TemplatingEngine.cs:
+ * Mono.TextTemplating/TemplateSettings.cs:
+ * Microsoft.VisualStudio.TextTemplating/Engine.cs: Move the
+ real engine into the Mono.TextTemplating namespace and
+ expose helper methods so that they can be tested.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.csproj: Move output dir from ../bin to
+ ../build.
+
+2009-03-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/Tokeniser.cs: Tweaked location of next
+ state after directive.
+
+2009-03-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/Tokeniser.cs: Location tweaks within
+ directives.
+
+ * Mono.TextTemplating/ParsedTemplate.cs: Make Location
+ equatable.
+
+2009-03-10 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/Tokeniser.cs:
+ * Mono.TextTemplating/ParsedTemplate.cs: Fix end location
+ capture after newline handling changes.
+
+2009-03-10 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/Tokeniser.cs:
+ * Microsoft.VisualStudio.TextTemplating/Engine.cs: Match T4's
+ newline handling.
+
+2009-03-10 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/ParsedTemplate.cs: Fix logic that
+ prevented adding directives.
+
+2009-03-09 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/Tokeniser.cs:
+ * Mono.TextTemplating/ParsedTemplate.cs: More accurate
+ location captures. Capture start of tags as well as start of
+ content.
+
+2009-03-09 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/TemplateGenerator.cs: Report exceptions
+ in errors.
+
+ * Mono.TextTemplating/Tokeniser.cs: Make API public.
+
+ * Mono.TextTemplating/ParsedTemplate.cs: Unify segment types.
+ Track end locations. Make API public. Allow parsing without
+ includes.
+
+ * Microsoft.VisualStudio.TextTemplating/Engine.cs: Track
+ location API.
+
+2009-03-06 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/TemplateGenerator.cs: Fix
+ SetFileExtension.
+
+ * Microsoft.VisualStudio.TextTemplating/Engine.cs: Capture
+ hostspecific attribute from template directive.
+
+2009-03-05 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating/TemplateGenerator.cs: Fix output
+ extension changing.
+
+ * Mono.TextTemplating/Tokeniser.cs: Fix helper regions.
+
+2009-03-05 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Mono.TextTemplating.csproj: Updated.
+
+ * Mono.TextTemplating/TemplateGenerator.cs: Simple template
+ host implementation. Doesn't handle everything yet.
+
+ * Mono.TextTemplating/Tokeniser.cs: Fix a number of offset
+ issues that broke most captures. Only allow EOF in content
+ regions, and in this case capture the last content. Track
+ current column, for error reporting.
+
+ * Mono.TextTemplating/ParsedTemplate.cs: Overhaul location
+ tracking for error reporting. Don't record empty segments.
+
+ * Microsoft.VisualStudio.TextTemplating/Engine.cs: Use run
+ method instead of runner, since the whole thing's done in
+ the appdomain now. Catch errors from the runner. Use host's
+ default assemblies and imports. Track ParsedTemplate error
+ reporting changes. Filter out content regions with only a
+ single newline.
+
+ * Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs:
+ Don't cache delegates; this won't work for instances. Maybe
+ IL generation is called for.
+
+2009-03-04 Michael Hutchinson <mhutchinson@novell.com>
+
+ * AssemblyInfo.cs:
+ * Mono.TextTemplating:
+ * Mono.TextTemplating.csproj:
+ * Mono.TextTemplating/Tokeniser.cs:
+ * Microsoft.VisualStudio.TextTemplating:
+ * Mono.TextTemplating/ParsedTemplate.cs:
+ * Microsoft.VisualStudio.TextTemplating/Engine.cs:
+ * Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs:
+ * Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs:
+ * Microsoft.VisualStudio.TextTemplating/TextTransformation.cs:
+ * Microsoft.VisualStudio.TextTemplating/ITextTemplatingEngineHost.cs:
+ * Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs:
+ * Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs:
+ Move T4 implementation to its own assembly. Tweak some
+ appdomain stuff.
+
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Makefile.am b/main/src/addins/TextTemplating/Mono.TextTemplating/Makefile.am
new file mode 100644
index 0000000000..4f9eeb681b
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Makefile.am
@@ -0,0 +1,51 @@
+ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating
+ASSEMBLY = $(ADDIN_BUILD)/Mono.TextTemplating.dll
+
+DEPS =
+
+REFS = \
+ -r:System \
+ -r:System.Core
+
+FILES = \
+ AssemblyInfo.cs \
+ Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs \
+ Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs \
+ Microsoft.VisualStudio.TextTemplating/Engine.cs \
+ Microsoft.VisualStudio.TextTemplating/ITextTemplatingEngineHost.cs \
+ Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs \
+ Microsoft.VisualStudio.TextTemplating/TextTransformation.cs \
+ Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs \
+ Mono.TextTemplating/CompiledTemplate.cs \
+ Mono.TextTemplating/IExtendedTextTemplatingEngineHost.cs \
+ Mono.TextTemplating/ParsedTemplate.cs \
+ Mono.TextTemplating/TemplateGenerator.cs \
+ Mono.TextTemplating/TemplateSettings.cs \
+ Mono.TextTemplating/TemplatingEngine.cs \
+ Mono.TextTemplating/Tokeniser.cs
+
+RES =
+
+all: $(ASSEMBLY) $(ASSEMBLY).mdb $(DATA_FILE_BUILD)
+
+$(ASSEMBLY): $(build_sources) $(build_resources) $(DEPS)
+ mkdir -p $(ADDIN_BUILD)
+ $(CSC) $(CSC_FLAGS) -debug -out:$@ -target:library $(REFS) $(build_deps) \
+ $(build_resources:%=/resource:%) $(build_sources)
+
+$(ASSEMBLY).mdb: $(ASSEMBLY)
+
+$(DATA_FILE_BUILD): $(srcdir)$(subst $(ADDIN_BUILD),, $@)
+ mkdir -p $(ADDIN_BUILD)/Schemas
+ cp $(srcdir)/$(subst $(ADDIN_BUILD),,$@) $@
+
+check: all
+
+assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.TextTemplating
+assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
+EXTRA_DIST = $(FILES) $(RES)
+
+include $(top_srcdir)/Makefile.include
+
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs
new file mode 100644
index 0000000000..3a7943c3f3
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessor.cs
@@ -0,0 +1,69 @@
+//
+// DirectiveProcessor.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.CodeDom.Compiler;
+
+namespace Microsoft.VisualStudio.TextTemplating
+{
+
+
+ public abstract class DirectiveProcessor
+ {
+
+ protected DirectiveProcessor ()
+ {
+ }
+
+ public virtual void Initialize (ITextTemplatingEngineHost host)
+ {
+ if (host == null)
+ throw new ArgumentException ();
+ }
+
+ public virtual void StartProcessingRun (CodeDomProvider languageProvider, string templateContents, CompilerErrorCollection errors)
+ {
+ if (languageProvider == null)
+ throw new ArgumentNullException ("languageProvider");
+ }
+
+ public abstract void FinishProcessingRun ();
+ public abstract string GetClassCodeForProcessingRun ();
+ public abstract string[] GetImportsForProcessingRun ();
+ public abstract string GetPostInitializationCodeForProcessingRun ();
+ public abstract string GetPreInitializationCodeForProcessingRun ();
+ public abstract string[] GetReferencesForProcessingRun ();
+ public abstract bool IsDirectiveSupported (string directiveName);
+ public abstract void ProcessDirective (string directiveName, IDictionary<string, string> arguments);
+
+ protected CompilerErrorCollection Errors {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs
new file mode 100644
index 0000000000..1d95facae1
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/DirectiveProcessorException.cs
@@ -0,0 +1,56 @@
+//
+// DirectiveProcessorException.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Microsoft.VisualStudio.TextTemplating
+{
+
+ [Serializable]
+ public class DirectiveProcessorException : Exception
+ {
+
+ public DirectiveProcessorException ()
+ {
+ }
+
+ public DirectiveProcessorException (string message)
+ : base (message)
+ {
+ }
+
+ public DirectiveProcessorException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public DirectiveProcessorException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs
new file mode 100644
index 0000000000..6608ce2814
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/Engine.cs
@@ -0,0 +1,66 @@
+//
+// Engine.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections.Generic;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using Mono.TextTemplating;
+
+namespace Microsoft.VisualStudio.TextTemplating
+{
+
+
+ public class Engine : ITextTemplatingEngine
+ {
+
+ public Engine ()
+ {
+ }
+
+ public string ProcessTemplate (string content, ITextTemplatingEngineHost host)
+ {
+ AppDomain appdomain = host.ProvideTemplatingAppDomain (content);
+ ITextTemplatingEngine engine;
+ if (appdomain != null) {
+ engine = (ITextTemplatingEngine)
+ appdomain.CreateInstanceAndUnwrap (typeof (TemplatingEngine).Assembly.FullName,
+ typeof (TemplatingEngine).FullName);
+ } else {
+ engine = new TemplatingEngine ();
+ }
+
+ return engine.ProcessTemplate (content, host);
+ }
+ }
+
+ public interface ITextTemplatingEngine
+ {
+ string ProcessTemplate (string content, ITextTemplatingEngineHost host);
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ITextTemplatingEngineHost.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ITextTemplatingEngineHost.cs
new file mode 100644
index 0000000000..1ac88f7833
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ITextTemplatingEngineHost.cs
@@ -0,0 +1,52 @@
+//
+// ITextTemplatingEngineHost.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Text;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+
+namespace Microsoft.VisualStudio.TextTemplating
+{
+
+
+ public interface ITextTemplatingEngineHost
+ {
+ object GetHostOption (string optionName);
+ bool LoadIncludeText (string requestFileName, out string content, out string location);
+ void LogErrors (CompilerErrorCollection errors);
+ AppDomain ProvideTemplatingAppDomain (string content);
+ string ResolveAssemblyReference (string assemblyReference);
+ Type ResolveDirectiveProcessor (string processorName);
+ string ResolveParameterValue (string directiveId, string processorName, string parameterName);
+ string ResolvePath (string path);
+ void SetFileExtension (string extension);
+ void SetOutputEncoding (Encoding encoding, bool fromOutputDirective);
+ IList<string> StandardAssemblyReferences { get; }
+ IList<string> StandardImports { get; }
+ string TemplateFile { get; }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs
new file mode 100644
index 0000000000..e9e35c1c5c
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/RequiresProvidesDirectiveProcessor.cs
@@ -0,0 +1,134 @@
+//
+// RequiresProvidesDirectiveProcessor.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.CodeDom.Compiler;
+using System.Text;
+
+namespace Microsoft.VisualStudio.TextTemplating
+{
+
+
+ public abstract class RequiresProvidesDirectiveProcessor : DirectiveProcessor
+ {
+ bool isInProcessingRun;
+ ITextTemplatingEngineHost host;
+
+ protected RequiresProvidesDirectiveProcessor ()
+ {
+ }
+
+ public override void Initialize (ITextTemplatingEngineHost host)
+ {
+ base.Initialize (host);
+ this.host = host;
+ throw new NotImplementedException ();
+ }
+
+ protected abstract void InitializeProvidesDictionary (string directiveName, IDictionary<string, string> providesDictionary);
+ protected abstract void InitializeRequiresDictionary (string directiveName, IDictionary<string, string> requiresDictionary);
+ protected abstract string FriendlyName { get; }
+
+ protected abstract void GenerateTransformCode (string directiveName, StringBuilder codeBuffer,
+ CodeDomProvider languageProvider,
+ IDictionary<string, string> requiresArguments,
+ IDictionary<string, string> providesArguments);
+
+ public override string GetClassCodeForProcessingRun ()
+ {
+ throw new System.NotImplementedException ();
+ }
+
+ public override string[] GetImportsForProcessingRun ()
+ {
+ throw new System.NotImplementedException ();
+ }
+
+ public override string GetPostInitializationCodeForProcessingRun ()
+ {
+ throw new System.NotImplementedException ();
+ }
+
+ public override string GetPreInitializationCodeForProcessingRun ()
+ {
+ throw new System.NotImplementedException ();
+ }
+ public override string[] GetReferencesForProcessingRun ()
+ {
+ throw new System.NotImplementedException ();
+ }
+
+ protected virtual void PostProcessArguments (string directiveName, IDictionary<string, string> requiresArguments,
+ IDictionary<string, string> providesArguments)
+ {
+ }
+
+ public override void StartProcessingRun (System.CodeDom.Compiler.CodeDomProvider languageProvider,
+ string templateContents,
+ System.CodeDom.Compiler.CompilerErrorCollection errors)
+ {
+ AssertNotProcessing ();
+ isInProcessingRun = true;
+ base.StartProcessingRun (languageProvider, templateContents, errors);
+
+ throw new NotImplementedException ();
+ }
+
+ public override void FinishProcessingRun ()
+ {
+ isInProcessingRun = false;
+ throw new NotImplementedException (); //reset the state machine
+ }
+
+ void AssertNotProcessing ()
+ {
+ if (isInProcessingRun)
+ throw new InvalidOperationException ();
+ }
+
+ public override void ProcessDirective (string directiveName, IDictionary<string, string> arguments)
+ {
+ if (directiveName == null)
+ throw new ArgumentNullException ("directiveName");
+ if (arguments == null)
+ throw new ArgumentNullException ("arguments");
+
+ throw new NotImplementedException ();
+ }
+
+ protected virtual string ProvideUniqueId (string directiveName, IDictionary<string, string> arguments,
+ IDictionary<string, string> requiresArguments,
+ IDictionary<string, string> providesArguments)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected ITextTemplatingEngineHost Host {
+ get { return host; }
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs
new file mode 100644
index 0000000000..5f56b54587
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/TextTransformation.cs
@@ -0,0 +1,166 @@
+//
+// TextTransformation.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.VisualStudio.TextTemplating
+{
+
+
+ public abstract class TextTransformation : IDisposable
+ {
+ Stack<int> indents = new Stack<int> ();
+ string currentIndent = "";
+ CompilerErrorCollection errors = new CompilerErrorCollection ();
+ StringBuilder builder = new StringBuilder ();
+
+ public TextTransformation ()
+ {
+ }
+
+ protected internal virtual void Initialize ()
+ {
+ }
+
+ public abstract string TransformText ();
+
+ #region Errors
+
+ public void Error (string message)
+ {
+ AddError (message);
+ }
+
+ public void Warning (string message)
+ {
+ AddError (message).IsWarning = true;
+ }
+
+ CompilerError AddError (string message)
+ {
+ CompilerError err = new CompilerError ();
+ err.Column = err.Line = -1;
+ err.ErrorText = message;
+ errors.Add (err);
+ return err;
+ }
+
+ protected internal CompilerErrorCollection Errors {
+ get { return errors; }
+ }
+
+ #endregion
+
+ #region Indents
+
+ public string PopIndent ()
+ {
+ if (indents.Count == 0)
+ return "";
+ int lastPos = currentIndent.Length - indents.Pop ();
+ string last = currentIndent.Substring (lastPos);
+ currentIndent = currentIndent.Substring (0, lastPos);
+ return last;
+ }
+
+ public void PushIndent (string indent)
+ {
+ indents.Push (indent.Length);
+ currentIndent += indent;
+ }
+
+ public void ClearIndent ()
+ {
+ currentIndent = "";
+ indents.Clear ();
+ }
+
+ public string CurrentIndent {
+ get { return currentIndent; }
+ }
+
+ #endregion
+
+ #region Writing
+
+ protected StringBuilder GenerationEnvironment {
+ get { return builder; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ builder = value;
+ }
+ }
+
+ public void Write (string textToAppend)
+ {
+ GenerationEnvironment.Append (textToAppend);
+ }
+
+ public void Write (string format, params object[] args)
+ {
+ GenerationEnvironment.AppendFormat (format, args);
+ }
+
+ public void WriteLine (string textToAppend)
+ {
+ GenerationEnvironment.Append (CurrentIndent);
+ GenerationEnvironment.AppendLine (textToAppend);
+ }
+
+ public void WriteLine (string format, params object[] args)
+ {
+ GenerationEnvironment.Append (CurrentIndent);
+ GenerationEnvironment.AppendFormat (format, args);
+ GenerationEnvironment.AppendLine ();
+ }
+
+ #endregion
+
+ #region Dispose
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ }
+
+ ~TextTransformation ()
+ {
+ Dispose (false);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs
new file mode 100644
index 0000000000..376b636462
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Microsoft.VisualStudio.TextTemplating/ToStringHelper.cs
@@ -0,0 +1,65 @@
+//
+// ToStringHelper.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace Microsoft.VisualStudio.TextTemplating
+{
+
+
+ public static class ToStringHelper
+ {
+ static object [] formatProviderAsParameterArray;
+ static IFormatProvider formatProvider = System.Globalization.CultureInfo.InvariantCulture;
+
+ static ToStringHelper ()
+ {
+ formatProviderAsParameterArray = new object[] { formatProvider };
+ }
+
+ public static string ToStringWithCulture (object objectToConvert)
+ {
+ if (objectToConvert == null)
+ return null;
+
+ IConvertible conv = objectToConvert as IConvertible;
+ if (conv != null)
+ return conv.ToString (formatProvider);
+
+ MethodInfo mi = objectToConvert.GetType ().GetMethod ("ToString", new Type[] { typeof (IFormatProvider) });
+ if (mi != null && mi.ReturnType == typeof (String))
+ return (string) mi.Invoke (objectToConvert, formatProviderAsParameterArray);
+ return objectToConvert.ToString ();
+ }
+
+ public static IFormatProvider FormatProvider {
+ get { return (IFormatProvider)formatProviderAsParameterArray[0]; }
+ set { formatProviderAsParameterArray[0] = formatProvider = value; }
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj
new file mode 100644
index 0000000000..e153bf792b
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating.csproj
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A2364D6A-00EF-417C-80A6-815726C70032}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Mono.TextTemplating</RootNamespace>
+ <AssemblyName>Mono.TextTemplating</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Microsoft.VisualStudio.TextTemplating\DirectiveProcessor.cs" />
+ <Compile Include="Microsoft.VisualStudio.TextTemplating\DirectiveProcessorException.cs" />
+ <Compile Include="Microsoft.VisualStudio.TextTemplating\Engine.cs" />
+ <Compile Include="Microsoft.VisualStudio.TextTemplating\ITextTemplatingEngineHost.cs" />
+ <Compile Include="Microsoft.VisualStudio.TextTemplating\RequiresProvidesDirectiveProcessor.cs" />
+ <Compile Include="Microsoft.VisualStudio.TextTemplating\TextTransformation.cs" />
+ <Compile Include="Microsoft.VisualStudio.TextTemplating\ToStringHelper.cs" />
+ <Compile Include="Mono.TextTemplating\CompiledTemplate.cs" />
+ <Compile Include="Mono.TextTemplating\IExtendedTextTemplatingEngineHost.cs" />
+ <Compile Include="Mono.TextTemplating\ParsedTemplate.cs" />
+ <Compile Include="Mono.TextTemplating\Tokeniser.cs" />
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="Mono.TextTemplating\TemplateGenerator.cs" />
+ <Compile Include="Mono.TextTemplating\TemplatingEngine.cs" />
+ <Compile Include="Mono.TextTemplating\TemplateSettings.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <Folder Include="Microsoft.VisualStudio.TextTemplating\" />
+ <Folder Include="Mono.TextTemplating\" />
+ </ItemGroup>
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <Policies>
+ <DotNetNamingPolicy DirectoryNamespaceAssociation="Flat" ResourceNamePolicy="FileName" />
+ </Policies>
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="true" IsAutotoolsProject="true" RelativeConfigureInPath="../../../..">
+ <BuildFilesVar Sync="true" Name="FILES" />
+ <DeployFilesVar />
+ <ResourcesVar Sync="true" Name="RES" />
+ <OthersVar />
+ <GacRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <AsmRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <ProjectRefVar Sync="true" Name="DEPS" />
+ </MonoDevelop.Autotools.MakefileInfo>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs
new file mode 100644
index 0000000000..e63caa644b
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs
@@ -0,0 +1,62 @@
+//
+// CompiledTemplate.cs
+//
+// Author:
+// Nathan Baulch <nathan.baulch@gmail.com>
+//
+// Copyright (c) 2009 Nathan Baulch
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Reflection;
+using Microsoft.VisualStudio.TextTemplating;
+
+namespace Mono.TextTemplating
+{
+ public class CompiledTemplate : MarshalByRefObject
+ {
+ readonly ITextTemplatingEngineHost host;
+ readonly Assembly assembly;
+ readonly TemplateSettings settings;
+ readonly ParsedTemplate parsedTemplate;
+
+ public CompiledTemplate (ParsedTemplate parsedTemplate, ITextTemplatingEngineHost host, Assembly assembly, TemplateSettings settings)
+ {
+ this.host = host;
+ this.assembly = assembly;
+ this.settings = settings;
+ this.parsedTemplate = parsedTemplate;
+ }
+
+ public string Process ()
+ {
+ string output = "";
+
+ try {
+ output = TemplatingEngine.Run (assembly, settings.Namespace + "." + settings.Name, host, settings.Culture);
+ } catch (Exception ex) {
+ parsedTemplate.LogError ("Error running transform: " + ex);
+ }
+
+ host.LogErrors (parsedTemplate.Errors);
+ return output;
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/IExtendedTextTemplatingEngineHost.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/IExtendedTextTemplatingEngineHost.cs
new file mode 100644
index 0000000000..de8692d188
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/IExtendedTextTemplatingEngineHost.cs
@@ -0,0 +1,36 @@
+//
+// IExtendedTextTemplatingEngineHost.cs
+//
+// Author:
+// Nathan Baulch <nathan.baulch@gmail.com>
+//
+// Copyright (c) 2009 Nathan Baulch
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using Microsoft.VisualStudio.TextTemplating;
+
+namespace Mono.TextTemplating
+{
+ public interface IExtendedTextTemplatingEngineHost : ITextTemplatingEngineHost
+ {
+ TextTransformation CreateInstance (Type type);
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs
new file mode 100644
index 0000000000..36140cfe50
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/ParsedTemplate.cs
@@ -0,0 +1,317 @@
+//
+// Template.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.IO;
+using Microsoft.VisualStudio.TextTemplating;
+
+namespace Mono.TextTemplating
+{
+
+
+ public class ParsedTemplate
+ {
+ List<ISegment> segments = new List<ISegment> ();
+ CompilerErrorCollection errors = new CompilerErrorCollection ();
+ string rootFileName;
+
+ public ParsedTemplate (string rootFileName)
+ {
+ this.rootFileName = rootFileName;
+ }
+
+ public List<ISegment> RawSegments {
+ get { return segments; }
+ }
+
+ public IEnumerable<Directive> Directives {
+ get {
+ foreach (ISegment seg in segments) {
+ Directive dir = seg as Directive;
+ if (dir != null)
+ yield return dir;
+ }
+ }
+ }
+
+ public IEnumerable<TemplateSegment> Content {
+ get {
+ foreach (ISegment seg in segments) {
+ TemplateSegment ts = seg as TemplateSegment;
+ if (ts != null)
+ yield return ts;
+ }
+ }
+ }
+
+ public CompilerErrorCollection Errors {
+ get { return errors; }
+ }
+
+ public static ParsedTemplate FromText (string content, ITextTemplatingEngineHost host)
+ {
+ ParsedTemplate template = new ParsedTemplate (host.TemplateFile);
+ try {
+ template.Parse (host, new Tokeniser (host.TemplateFile, content));
+ } catch (ParserException ex) {
+ template.LogError (ex.Message, ex.Location);
+ }
+ return template;
+ }
+
+ public void Parse (ITextTemplatingEngineHost host, Tokeniser tokeniser)
+ {
+ Parse (host, tokeniser, true);
+ }
+
+ public void ParseWithoutIncludes (Tokeniser tokeniser)
+ {
+ Parse (null, tokeniser, false);
+ }
+
+ void Parse (ITextTemplatingEngineHost host, Tokeniser tokeniser, bool parseIncludes)
+ {
+ bool skip = false;
+ while ((skip || tokeniser.Advance ()) && tokeniser.State != State.EOF) {
+ skip = false;
+ ISegment seg = null;
+ switch (tokeniser.State) {
+ case State.Block:
+ if (!String.IsNullOrEmpty (tokeniser.Value))
+ seg = new TemplateSegment (SegmentType.Block, tokeniser.Value, tokeniser.Location);
+ break;
+ case State.Content:
+ if (!String.IsNullOrEmpty (tokeniser.Value))
+ seg = new TemplateSegment (SegmentType.Content, tokeniser.Value, tokeniser.Location);
+ break;
+ case State.Expression:
+ if (!String.IsNullOrEmpty (tokeniser.Value))
+ seg = new TemplateSegment (SegmentType.Expression, tokeniser.Value, tokeniser.Location);
+ break;
+ case State.Helper:
+ if (!String.IsNullOrEmpty (tokeniser.Value))
+ seg = new TemplateSegment (SegmentType.Helper, tokeniser.Value, tokeniser.Location);
+ break;
+ case State.Directive:
+ Directive directive = null;
+ string attName = null;
+ while (!skip && tokeniser.Advance ()) {
+ switch (tokeniser.State) {
+ case State.DirectiveName:
+ if (directive == null) {
+ directive = new Directive (tokeniser.Value.ToLower (), tokeniser.Location);
+ directive.TagStartLocation = tokeniser.TagStartLocation;
+ if (!parseIncludes || directive.Name != "include")
+ segments.Add (directive);
+ } else
+ attName = tokeniser.Value;
+ break;
+ case State.DirectiveValue:
+ if (attName != null && directive != null)
+ directive.Attributes[attName.ToLower ()] = tokeniser.Value;
+ else
+ LogError ("Directive value without name", tokeniser.Location);
+ attName = null;
+ break;
+ case State.Directive:
+ if (directive != null)
+ directive.EndLocation = tokeniser.TagEndLocation;
+ break;
+ default:
+ skip = true;
+ break;
+ }
+ }
+ if (parseIncludes && directive.Name == "include")
+ Import (host, directive);
+ break;
+ default:
+ throw new InvalidOperationException ();
+ }
+ if (seg != null) {
+ seg.TagStartLocation = tokeniser.TagStartLocation;
+ seg.EndLocation = tokeniser.TagEndLocation;
+ segments.Add (seg);
+ }
+ }
+ }
+
+ void Import (ITextTemplatingEngineHost host, Directive includeDirective)
+ {
+ string fileName;
+ if (includeDirective.Attributes.Count > 1 || !includeDirective.Attributes.TryGetValue ("file", out fileName)) {
+ LogError ("Unexpected attributes in include directive", includeDirective.StartLocation);
+ return;
+ }
+ if (!File.Exists (fileName)) {
+ LogError ("Included file '" + fileName + "' does not exist.", includeDirective.StartLocation);
+ return;
+ }
+
+ string content, resolvedName;
+ if (host.LoadIncludeText (fileName, out content, out resolvedName))
+ Parse (host, new Tokeniser (resolvedName, content), true);
+ else
+ LogError ("Could not resolve include file '" + fileName + "'.", includeDirective.StartLocation);
+ }
+
+ void LogError (string message, Location location, bool isWarning)
+ {
+ CompilerError err = new CompilerError ();
+ err.ErrorText = message;
+ if (location.FileName != null) {
+ err.Line = location.Line;
+ err.Column = location.Column;
+ err.FileName = location.FileName ?? string.Empty;
+ } else {
+ err.FileName = rootFileName ?? string.Empty;
+ }
+ err.IsWarning = isWarning;
+ errors.Add (err);
+ }
+
+ public void LogError (string message)
+ {
+ LogError (message, Location.Empty, false);
+ }
+
+ public void LogWarning (string message)
+ {
+ LogError (message, Location.Empty, true);
+ }
+
+ public void LogError (string message, Location location)
+ {
+ LogError (message, Location.Empty, false);
+ }
+
+ public void LogWarning (string message, Location location)
+ {
+ LogError (message, location, true);
+ }
+ }
+
+ public interface ISegment
+ {
+ Location StartLocation { get; }
+ Location EndLocation { get; set; }
+ Location TagStartLocation {get; set; }
+ }
+
+ public class TemplateSegment : ISegment
+ {
+ public TemplateSegment (SegmentType type, string text, Location start)
+ {
+ this.Type = type;
+ this.StartLocation = start;
+ this.Text = text;
+ }
+
+ public SegmentType Type { get; private set; }
+ public string Text { get; private set; }
+ public Location TagStartLocation { get; set; }
+ public Location StartLocation { get; private set; }
+ public Location EndLocation { get; set; }
+ }
+
+ public class Directive : ISegment
+ {
+ public Directive (string name, Location start)
+ {
+ this.Name = name;
+ this.Attributes = new Dictionary<string, string> ();
+ this.StartLocation = start;
+ }
+
+ public string Name { get; private set; }
+ public Dictionary<string,string> Attributes { get; private set; }
+ public Location TagStartLocation { get; set; }
+ public Location StartLocation { get; private set; }
+ public Location EndLocation { get; set; }
+
+ public string Extract (string key)
+ {
+ string value;
+ if (!Attributes.TryGetValue (key, out value))
+ return null;
+ Attributes.Remove (key);
+ return value;
+ }
+ }
+
+ public enum SegmentType
+ {
+ Block,
+ Expression,
+ Content,
+ Helper
+ }
+
+ public struct Location : IEquatable<Location>
+ {
+ public Location (string fileName, int line, int column) : this()
+ {
+ FileName = fileName;
+ Column = column;
+ Line = line;
+ }
+
+ public int Line { get; private set; }
+ public int Column { get; private set; }
+ public string FileName { get; private set; }
+
+ public static Location Empty {
+ get { return new Location (null, -1, -1); }
+ }
+
+ public Location AddLine ()
+ {
+ return new Location (this.FileName, this.Line + 1, 1);
+ }
+
+ public Location AddCol ()
+ {
+ return AddCols (1);
+ }
+
+ public Location AddCols (int number)
+ {
+ return new Location (this.FileName, this.Line, this.Column + number);
+ }
+
+ public override string ToString ()
+ {
+ return string.Format("[{0} ({1},{2})]", FileName, Line, Column);
+ }
+
+ public bool Equals (Location other)
+ {
+ return other.Line == Line && other.Column == Column && other.FileName == FileName;
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs
new file mode 100644
index 0000000000..ff490a0f38
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs
@@ -0,0 +1,254 @@
+//
+// TemplatingHost.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Text;
+using Microsoft.VisualStudio.TextTemplating;
+
+namespace Mono.TextTemplating
+{
+
+
+ public class TemplateGenerator : MarshalByRefObject, ITextTemplatingEngineHost
+ {
+ //re-usable
+ Engine engine;
+
+ //per-run variables
+ string inputFile, outputFile;
+ Encoding encoding;
+
+ //host fields
+ CompilerErrorCollection errors = new CompilerErrorCollection ();
+ List<string> refs = new List<string> ();
+ List<string> imports = new List<string> ();
+ List<string> includePaths = new List<string> ();
+ List<string> referencePaths = new List<string> ();
+ List<string> directiveProcessors = new List<string> ();
+ Dictionary<string, string> processorValues = new Dictionary<string, string> ();
+
+ //host properties for consumers to access
+ public CompilerErrorCollection Errors { get { return errors; } }
+ public List<string> Refs { get { return refs; } }
+ public List<string> Imports { get { return imports; } }
+ public List<string> IncludePaths { get { return includePaths; } }
+ public List<string> ReferencePaths { get { return referencePaths; } }
+ public List<string> DirectiveProcessors { get { return directiveProcessors; } }
+ public IDictionary<string, string> ProcessorValues { get { return processorValues; } }
+
+ public TemplateGenerator ()
+ {
+ Refs.Add (typeof (TextTransformation).Assembly.Location);
+ }
+
+ public CompiledTemplate CompileTemplate (string content)
+ {
+ if (String.IsNullOrEmpty (content))
+ throw new ArgumentNullException ("content");
+
+ errors.Clear ();
+ encoding = Encoding.UTF8;
+
+ AppDomain appdomain = ProvideTemplatingAppDomain (content);
+ TemplatingEngine engine;
+ if (appdomain != null) {
+ engine = (TemplatingEngine)
+ appdomain.CreateInstanceAndUnwrap (typeof (TemplatingEngine).Assembly.FullName,
+ typeof (TemplatingEngine).FullName);
+ } else {
+ engine = new TemplatingEngine ();
+ }
+
+ return engine.CompileTemplate (content, this);
+ }
+
+ protected Engine Engine {
+ get {
+ if (engine == null)
+ engine = new Engine ();
+ return engine;
+ }
+ }
+
+ public bool ProcessTemplate (string inputFile, string outputFile)
+ {
+ if (String.IsNullOrEmpty (inputFile))
+ throw new ArgumentNullException ("inputFile");
+ if (String.IsNullOrEmpty (outputFile))
+ throw new ArgumentNullException ("outputFile");
+
+ string content;
+ try {
+ content = File.ReadAllText (inputFile);
+ } catch (IOException ex) {
+ errors.Clear ();
+ AddError ("Could not read input file '" + inputFile + "':\n" + ex.ToString ());
+ return false;
+ }
+
+ string output;
+ ProcessTemplate (inputFile, content, ref outputFile, out output);
+
+ try {
+ if (!errors.HasErrors)
+ File.WriteAllText (outputFile, output, encoding);
+ } catch (IOException ex) {
+ AddError ("Could not read input file '" + inputFile + "':\n" + ex.ToString ());
+ }
+
+ return !errors.HasErrors;
+ }
+
+ public bool ProcessTemplate (string inputFileName, string inputContent, ref string outputFileName, out string outputContent)
+ {
+ errors.Clear ();
+ encoding = Encoding.UTF8;
+
+ this.outputFile = outputFileName;
+ this.inputFile = inputFileName;
+ outputContent = Engine.ProcessTemplate (inputContent, this);
+ outputFileName = this.outputFile;
+
+ return !errors.HasErrors;
+ }
+
+ CompilerError AddError (string error)
+ {
+ CompilerError err = new CompilerError ();
+ err.ErrorText = error;
+ Errors.Add (err);
+ return err;
+ }
+
+ #region Virtual members
+
+ public virtual object GetHostOption (string optionName)
+ {
+ return null;
+ }
+
+ public virtual AppDomain ProvideTemplatingAppDomain (string content)
+ {
+ return null;
+ }
+
+ protected virtual string ResolveAssemblyReference (string assemblyReference)
+ {
+ //FIXME: implement
+ return assemblyReference;
+ }
+
+ #endregion
+
+ #region Explicit ITextTemplatingEngineHost implementation
+
+ bool ITextTemplatingEngineHost.LoadIncludeText (string requestFileName, out string content, out string location)
+ {
+ content = "";
+ location = null;
+
+ if (Path.IsPathRooted (requestFileName)) {
+ location = requestFileName;
+ } else {
+ foreach (string path in includePaths) {
+ string f = Path.Combine (path, requestFileName);
+ if (File.Exists (f)) {
+ location = f;
+ break;
+ }
+ }
+ }
+
+ if (location == null)
+ return false;
+
+ try {
+ content = System.IO.File.ReadAllText (location);
+ return true;
+ } catch (IOException ex) {
+ AddError ("Could not read included file '" + location + "':\n" + ex.ToString ());
+ }
+ return false;
+ }
+
+ void ITextTemplatingEngineHost.LogErrors (CompilerErrorCollection errors)
+ {
+ this.errors.AddRange (errors);
+ }
+
+ string ITextTemplatingEngineHost.ResolveAssemblyReference (string assemblyReference)
+ {
+ return ResolveAssemblyReference (assemblyReference);
+ }
+
+ Type ITextTemplatingEngineHost.ResolveDirectiveProcessor (string processorName)
+ {
+ throw new NotImplementedException();
+ }
+
+ string ITextTemplatingEngineHost.ResolveParameterValue (string directiveId, string processorName, string parameterName)
+ {
+ throw new NotImplementedException();
+ }
+
+ string ITextTemplatingEngineHost.ResolvePath (string path)
+ {
+ throw new NotImplementedException();
+ }
+
+ void ITextTemplatingEngineHost.SetFileExtension (string extension)
+ {
+ extension = extension.TrimStart ('.');
+ if (Path.HasExtension (outputFile)) {
+ outputFile = Path.ChangeExtension (outputFile, extension);
+ } else {
+ outputFile = outputFile + "." + extension;
+ }
+ }
+
+ void ITextTemplatingEngineHost.SetOutputEncoding (System.Text.Encoding encoding, bool fromOutputDirective)
+ {
+ this.encoding = encoding;
+ }
+
+ IList<string> ITextTemplatingEngineHost.StandardAssemblyReferences {
+ get { return refs; }
+ }
+
+ IList<string> ITextTemplatingEngineHost.StandardImports {
+ get { return imports; }
+ }
+
+ string ITextTemplatingEngineHost.TemplateFile {
+ get { return inputFile; }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs
new file mode 100644
index 0000000000..0894782712
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplateSettings.cs
@@ -0,0 +1,54 @@
+//
+// TemplateSettings.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Text;
+using System.Collections.Generic;
+
+namespace Mono.TextTemplating
+{
+
+ public class TemplateSettings
+ {
+ public TemplateSettings ()
+ {
+ Imports = new List<string> ();
+ Assemblies = new List<string> ();
+ }
+
+ public bool HostSpecific { get; set; }
+ public bool Debug { get; set; }
+ public string Inherits { get; set; }
+ public string Name { get; set; }
+ public string Namespace { get; set; }
+ public List<string> Imports { get; private set; }
+ public List<string> Assemblies { get; private set; }
+ public System.CodeDom.Compiler.CodeDomProvider Provider { get; set; }
+ public Encoding Encoding { get; set; }
+ public string Extension { get; set; }
+ public System.Globalization.CultureInfo Culture { get; set; }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs
new file mode 100644
index 0000000000..11447d2685
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs
@@ -0,0 +1,369 @@
+//
+// Engine.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections.Generic;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using Microsoft.CSharp;
+using Microsoft.VisualStudio.TextTemplating;
+
+namespace Mono.TextTemplating
+{
+
+ public class TemplatingEngine : MarshalByRefObject, Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngine
+ {
+
+ public string ProcessTemplate (string content, ITextTemplatingEngineHost host)
+ {
+ return CompileTemplate (content, host).Process ();
+ }
+
+ public CompiledTemplate CompileTemplate (string content, ITextTemplatingEngineHost host)
+ {
+ ParsedTemplate pt = ParsedTemplate.FromText (content, host);
+ if (pt.Errors.HasErrors) {
+ host.LogErrors (pt.Errors);
+ return null;
+ }
+
+ TemplateSettings settings = GetSettings (host, pt);
+ if (pt.Errors.HasErrors) {
+ host.LogErrors (pt.Errors);
+ return null;
+ }
+
+ CodeCompileUnit ccu = GenerateCompileUnit (host, pt, settings);
+ if (pt.Errors.HasErrors) {
+ host.LogErrors (pt.Errors);
+ return null;
+ }
+
+ System.Reflection.Assembly results = GenerateCode (host, pt, settings, ccu);
+ if (pt.Errors.HasErrors) {
+ host.LogErrors (pt.Errors);
+ return null;
+ }
+
+ if (!String.IsNullOrEmpty (settings.Extension)) {
+ host.SetFileExtension (settings.Extension);
+ }
+ if (settings.Encoding != null) {
+ //FIXME: when is this called with false?
+ host.SetOutputEncoding (settings.Encoding, true);
+ }
+
+ return new CompiledTemplate (pt, host, results, settings);
+ }
+
+ public static System.Reflection.Assembly GenerateCode (ITextTemplatingEngineHost host, ParsedTemplate pt,
+ TemplateSettings settings, CodeCompileUnit ccu)
+ {
+ CompilerParameters pars = new CompilerParameters ();
+ pars.GenerateExecutable = false;
+
+ if (settings.Debug) {
+ pars.GenerateInMemory = false;
+ pars.IncludeDebugInformation = true;
+ pars.TempFiles.KeepFiles = true;
+ } else {
+ pars.GenerateInMemory = true;
+ pars.IncludeDebugInformation = false;
+ }
+
+ //resolve and add assembly references
+ HashSet<string> assemblies = new HashSet<string> ();
+ assemblies.UnionWith (settings.Assemblies);
+ assemblies.UnionWith (host.StandardAssemblyReferences);
+ foreach (string assem in assemblies) {
+ string resolvedAssem = host.ResolveAssemblyReference (assem);
+ if (!String.IsNullOrEmpty (resolvedAssem)) {
+ pars.ReferencedAssemblies.Add (resolvedAssem);
+ } else {
+ pt.LogError ("Could not resolve assembly reference '" + assem + "'");
+ return null;
+ }
+ }
+ CompilerResults results = settings.Provider.CompileAssemblyFromDom (pars, ccu);
+ pt.Errors.AddRange (results.Errors);
+ if (pt.Errors.HasErrors)
+ return null;
+ return results.CompiledAssembly;
+ }
+
+ public static TemplateSettings GetSettings (ITextTemplatingEngineHost host, ParsedTemplate pt)
+ {
+ string language = null;
+
+ TemplateSettings settings = new TemplateSettings ();
+ foreach (Directive dt in pt.Directives) {
+ switch (dt.Name) {
+ case "template":
+ string val = dt.Extract ("language");
+ if (val != null)
+ language = val;
+ val = dt.Extract ("debug");
+ if (val != null)
+ settings.Debug = string.Compare (val, "true", StringComparison.OrdinalIgnoreCase) == 0;
+ val = dt.Extract ("inherits");
+ if (val != null)
+ settings.Inherits = val;
+ val = dt.Extract ("culture");
+ if (val != null) {
+ System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.GetCultureInfo (val);
+ if (culture == null)
+ pt.LogWarning ("Could not find culture '" + val + "'", dt.StartLocation);
+ else
+ settings.Culture = culture;
+ }
+ val = dt.Extract ("hostspecific");
+ if (val != null) {
+ settings.HostSpecific = string.Compare (val, "true", StringComparison.OrdinalIgnoreCase) == 0;
+ }
+ break;
+
+ case "assembly":
+ string name = dt.Extract ("name");
+ if (name == null)
+ pt.LogError ("Missing name attribute in assembly directive", dt.StartLocation);
+ else
+ settings.Assemblies.Add (name);
+ break;
+
+ case "import":
+ string namespac = dt.Extract ("namespace");
+ if (namespac == null)
+ pt.LogError ("Missing namespace attribute in import directive", dt.StartLocation);
+ else
+ settings.Imports.Add (namespac);
+ break;
+
+ case "output":
+ settings.Extension = dt.Extract ("extension");
+ string encoding = dt.Extract ("encoding");
+ if (encoding != null)
+ settings.Encoding = Encoding.GetEncoding ("encoding");
+ break;
+
+ case "include":
+ throw new InvalidOperationException ("Include is handled in the parser");
+
+ default:
+ throw new NotImplementedException ("Custom directives are not supported yet");
+ }
+ ComplainExcessAttributes (dt, pt);
+ }
+
+ if (settings.Name == null)
+ settings.Name = string.Format ("GeneratedTextTransformation{0:x}", new System.Random ().Next ());
+ if (settings.Namespace == null)
+ settings.Namespace = typeof (TextTransformation).Namespace;
+
+ //resolve the CodeDOM provider
+ if (String.IsNullOrEmpty (language)) {
+ pt.LogError ("No language was specified for the template");
+ return settings;
+ }
+
+ if (language == "C#v3.5") {
+ Dictionary<string, string> providerOptions = new Dictionary<string, string> ();
+ providerOptions.Add ("CompilerVersion", "v3.5");
+ settings.Provider = new CSharpCodeProvider (providerOptions);
+ }
+ else {
+ settings.Provider = CodeDomProvider.CreateProvider (language);
+ }
+
+ if (settings.Provider == null) {
+ pt.LogError ("A provider could not be found for the language '" + language + "'");
+ return settings;
+ }
+
+ return settings;
+ }
+
+ static bool ComplainExcessAttributes (Directive dt, ParsedTemplate pt)
+ {
+ if (dt.Attributes.Count == 0)
+ return false;
+ StringBuilder sb = new StringBuilder ("Unknown attributes ");
+ bool first = true;
+ foreach (string key in dt.Attributes.Keys) {
+ if (!first) {
+ sb.Append (", ");
+ } else {
+ first = false;
+ }
+ sb.Append (key);
+ }
+ sb.Append (" found in ");
+ sb.Append (dt.Name);
+ sb.Append (" directive.");
+ pt.LogWarning (sb.ToString (), dt.StartLocation);
+ return false;
+ }
+
+ public static CodeCompileUnit GenerateCompileUnit (ITextTemplatingEngineHost host, ParsedTemplate pt,
+ TemplateSettings settings)
+ {
+ //prep the compile unit
+ var ccu = new CodeCompileUnit ();
+ var namespac = new CodeNamespace (settings.Namespace);
+ ccu.Namespaces.Add (namespac);
+
+ var imports = new HashSet<string> ();
+ imports.UnionWith (settings.Imports);
+ imports.UnionWith (host.StandardImports);
+ foreach (string ns in imports)
+ namespac.Imports.Add (new CodeNamespaceImport (ns));
+
+ //prep the type
+ var type = new CodeTypeDeclaration (settings.Name);
+ if (!String.IsNullOrEmpty (settings.Inherits))
+ type.BaseTypes.Add (new CodeTypeReference (settings.Inherits));
+ else
+ type.BaseTypes.Add (new CodeTypeReference (typeof (TextTransformation)));
+ namespac.Types.Add (type);
+
+ //prep the transform method
+ var transformMeth = new CodeMemberMethod () {
+ Name = "TransformText",
+ ReturnType = new CodeTypeReference (typeof (String)),
+ Attributes = MemberAttributes.Public | MemberAttributes.Override
+ };
+
+ //method references that will need to be used multiple times
+ var writeMeth = new CodeMethodReferenceExpression (new CodeThisReferenceExpression (), "Write");
+ var toStringMeth = new CodeMethodReferenceExpression (new CodeTypeReferenceExpression (typeof (ToStringHelper)), "ToStringWithCulture");
+ bool helperMode = false;
+
+ //build the code from the segments
+ foreach (TemplateSegment seg in pt.Content) {
+ CodeStatement st = null;
+ var location = new CodeLinePragma (seg.StartLocation.FileName ?? host.TemplateFile, seg.StartLocation.Line);
+ switch (seg.Type) {
+ case SegmentType.Block:
+ if (helperMode)
+ //TODO: are blocks permitted after helpers?
+ throw new ParserException ("Blocks are not permitted after helpers", seg.StartLocation);
+ st = new CodeSnippetStatement (seg.Text);
+ break;
+ case SegmentType.Expression:
+ st = new CodeExpressionStatement (
+ new CodeMethodInvokeExpression (writeMeth,
+ new CodeMethodInvokeExpression (toStringMeth, new CodeSnippetExpression (seg.Text))));
+ break;
+ case SegmentType.Content:
+ st = new CodeExpressionStatement (new CodeMethodInvokeExpression (writeMeth, new CodePrimitiveExpression (seg.Text)));
+ break;
+ case SegmentType.Helper:
+ type.Members.Add (new CodeSnippetTypeMember (seg.Text) { LinePragma = location });
+ helperMode = true;
+ break;
+ default:
+ throw new InvalidOperationException ();
+ }
+ if (st != null) {
+ if (helperMode) {
+ //convert the statement into a snippet member and attach it to the top level type
+ //TODO: is there a way to do this for languages that use indentation for blocks, e.g. python?
+ using (var writer = new StringWriter ()) {
+ settings.Provider.GenerateCodeFromStatement (st, writer, null);
+ type.Members.Add (new CodeSnippetTypeMember (writer.ToString ()) { LinePragma = location });
+ }
+ } else {
+ st.LinePragma = location;
+ transformMeth.Statements.Add (st);
+ continue;
+ }
+ }
+ }
+
+ //complete the transform method
+ transformMeth.Statements.Add (new CodeMethodReturnStatement (
+ new CodeMethodInvokeExpression (
+ new CodePropertyReferenceExpression (
+ new CodeThisReferenceExpression (),
+ "GenerationEnvironment"),
+ "ToString")));
+ type.Members.Add (transformMeth);
+
+ //generate the Host property if needed
+ if (settings.HostSpecific) {
+ var hostField = new CodeMemberField (new CodeTypeReference (typeof (ITextTemplatingEngineHost)), "hostValue");
+ hostField.Attributes = (hostField.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Private;
+ type.Members.Add (hostField);
+
+ var hostProp = new CodeMemberProperty () {
+ Name = "Host",
+ Attributes = MemberAttributes.Public,
+ HasGet = true,
+ HasSet = true,
+ Type = hostField.Type
+ };
+ var hostFieldRef = new CodeFieldReferenceExpression (new CodeThisReferenceExpression (), "hostValue");
+ hostProp.SetStatements.Add (new CodeAssignStatement (hostFieldRef, new CodePropertySetValueReferenceExpression ()));
+ hostProp.GetStatements.Add (new CodeMethodReturnStatement (hostFieldRef));
+ type.Members.Add (hostProp);
+ }
+
+ return ccu;
+ }
+
+ public static string Run (System.Reflection.Assembly assem, string type, ITextTemplatingEngineHost host, System.Globalization.CultureInfo culture)
+ {
+ Type transformType = assem.GetType (type);
+ TextTransformation tt;
+
+ IExtendedTextTemplatingEngineHost extendedHost = host as IExtendedTextTemplatingEngineHost;
+ if (extendedHost != null) {
+ tt = extendedHost.CreateInstance (transformType);
+ }
+ else {
+ tt = (TextTransformation) Activator.CreateInstance (transformType);
+ }
+
+ //set the host property if it exists
+ System.Reflection.PropertyInfo hostProp = transformType.GetProperty ("Host", typeof (ITextTemplatingEngineHost));
+ if (hostProp != null && hostProp.CanWrite)
+ hostProp.SetValue (tt, host, null);
+
+ //set the culture
+ if (culture != null)
+ ToStringHelper.FormatProvider = culture;
+ else
+ ToStringHelper.FormatProvider = System.Globalization.CultureInfo.InvariantCulture;
+
+ tt.Initialize ();
+ string output = tt.TransformText ();
+ host.LogErrors (tt.Errors);
+ ToStringHelper.FormatProvider = System.Globalization.CultureInfo.InvariantCulture;
+ return output;
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs
new file mode 100644
index 0000000000..9da2d4cd63
--- /dev/null
+++ b/main/src/addins/TextTemplating/Mono.TextTemplating/Mono.TextTemplating/Tokeniser.cs
@@ -0,0 +1,295 @@
+//
+// Tokeniser.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Diagnostics;
+
+namespace Mono.TextTemplating
+{
+
+ public class Tokeniser
+ {
+ string content;
+ int position = 0;
+ string value;
+ State nextState = State.Content;
+ Location nextStateLocation;
+ Location nextStateTagStartLocation;
+
+ public Tokeniser (string fileName, string content)
+ {
+ State = State.Content;
+ this.content = content;
+ this.Location = this.nextStateLocation = this.nextStateTagStartLocation = new Location (fileName, 1, 1);
+ }
+
+ public bool Advance ()
+ {
+ value = null;
+ State = nextState;
+ Location = nextStateLocation;
+ TagStartLocation = nextStateTagStartLocation;
+ if (nextState == State.EOF)
+ return false;
+ nextState = GetNextStateAndCurrentValue ();
+ return true;
+ }
+
+ State GetNextStateAndCurrentValue ()
+ {
+ switch (State) {
+ case State.Block:
+ case State.Expression:
+ case State.Helper:
+ return GetBlockEnd ();
+
+ case State.Directive:
+ return NextStateInDirective ();
+
+ case State.Content:
+ return NextStateInContent ();
+
+ case State.DirectiveName:
+ return GetDirectiveName ();
+
+ case State.DirectiveValue:
+ return GetDirectiveValue ();
+
+ default:
+ throw new InvalidOperationException ("Unexpected state '" + State.ToString () + "'");
+ }
+ }
+
+ State GetBlockEnd ()
+ {
+ int start = position;
+ for (; position < content.Length; position++) {
+ char c = content[position];
+ nextStateTagStartLocation = nextStateLocation;
+ nextStateLocation = nextStateLocation.AddCol ();
+ if (c == '\r') {
+ if (position + 1 < content.Length && content[position + 1] == '\n')
+ position++;
+ nextStateLocation = nextStateLocation.AddLine();
+ } else if (c == '\n') {
+ nextStateLocation = nextStateLocation.AddLine();
+ } else if (c =='>' && content[position-1] == '#' && content[position-2] != '\\') {
+ value = content.Substring (start, position - start - 1);
+ position++;
+ TagEndLocation = nextStateLocation;
+
+ //skip newlines directly after blocks, unless they're expressions
+ if (State != State.Expression && (position += IsNewLine()) > 0) {
+ nextStateLocation = nextStateLocation.AddLine ();
+ }
+ return State.Content;
+ }
+ }
+ throw new ParserException ("Unexpected end of file.", nextStateLocation);
+ }
+
+ State GetDirectiveName ()
+ {
+ int start = position;
+ for (; position < content.Length; position++) {
+ char c = content[position];
+ if (!Char.IsLetterOrDigit (c)) {
+ value = content.Substring (start, position - start);
+ return State.Directive;
+ } else {
+ nextStateLocation = nextStateLocation.AddCol ();
+ }
+ }
+ throw new ParserException ("Unexpected end of file.", nextStateLocation);
+ }
+
+ State GetDirectiveValue ()
+ {
+ int start = position;
+ int delimiter = '\0';
+ for (; position < content.Length; position++) {
+ char c = content[position];
+ nextStateLocation = nextStateLocation.AddCol ();
+ if (c == '\r') {
+ if (position + 1 < content.Length && content[position + 1] == '\n')
+ position++;
+ nextStateLocation = nextStateLocation.AddLine();
+ } else if (c == '\n')
+ nextStateLocation = nextStateLocation.AddLine();
+ if (delimiter == '\0') {
+ if (c == '\'' || c == '"') {
+ start = position;
+ delimiter = c;
+ } else if (!Char.IsWhiteSpace (c)) {
+ throw new ParserException ("Unexpected character '" + c + "'. Expecting attribute value.", nextStateLocation);
+ }
+ continue;
+ }
+ if (c == delimiter) {
+ value = content.Substring (start + 1, position - start - 1);
+ position++;
+ return State.Directive;
+ }
+ }
+ throw new ParserException ("Unexpected end of file.", nextStateLocation);;
+ }
+
+ State NextStateInContent ()
+ {
+ int start = position;
+ for (; position < content.Length; position++) {
+ char c = content[position];
+ nextStateTagStartLocation = nextStateLocation;
+ nextStateLocation = nextStateLocation.AddCol ();
+ if (c == '\r') {
+ if (position + 1 < content.Length && content[position + 1] == '\n')
+ position++;
+ nextStateLocation = nextStateLocation.AddLine();
+ } else if (c == '\n') {
+ nextStateLocation = nextStateLocation.AddLine();
+ } else if (c =='<' && position + 2 < content.Length && content[position+1] == '#') {
+ TagEndLocation = nextStateLocation;
+ char type = content[position+2];
+ if (type == '@') {
+ nextStateLocation = nextStateLocation.AddCols (2);
+ value = content.Substring (start, position - start);
+ position += 3;
+ return State.Directive;
+ } else if (type == '=') {
+ nextStateLocation = nextStateLocation.AddCols (2);
+ value = content.Substring (start, position - start);
+ position += 3;
+ return State.Expression;
+ } else if (type == '+') {
+ nextStateLocation = nextStateLocation.AddCols (2);
+ value = content.Substring (start, position - start);
+ position += 3;
+ return State.Helper;
+ } else {
+ value = content.Substring (start, position - start);
+ nextStateLocation = nextStateLocation.AddCol ();
+ position += 2;
+ return State.Block;
+ }
+ }
+ }
+ //EOF is only valid when we're in content
+ value = content.Substring (start);
+ return State.EOF;
+ }
+
+ int IsNewLine() {
+ int found = 0;
+
+ if (position < content.Length && content[position] == '\r') {
+ found++;
+ }
+ if (position+found < content.Length && content[position+found] == '\n') {
+ found++;
+ }
+ return found;
+ }
+
+ State NextStateInDirective () {
+ for (; position < content.Length; position++) {
+ char c = content[position];
+ if (c == '\r') {
+ if (position + 1 < content.Length && content[position + 1] == '\n')
+ position++;
+ nextStateLocation = nextStateLocation.AddLine();
+ } else if (c == '\n') {
+ nextStateLocation = nextStateLocation.AddLine();
+ } else if (Char.IsLetter (c)) {
+ return State.DirectiveName;
+ } else if (c == '=') {
+ nextStateLocation = nextStateLocation.AddCol ();
+ position++;
+ return State.DirectiveValue;
+ } else if (c == '#' && position + 1 < content.Length && content[position+1] == '>') {
+ position+=2;
+ TagEndLocation = nextStateLocation.AddCols (2);
+ nextStateLocation = nextStateLocation.AddCols (3);
+
+ //skip newlines directly after directives
+ if ((position += IsNewLine()) > 0) {
+ nextStateLocation = nextStateLocation.AddLine();
+ }
+
+ return State.Content;
+ } else if (!Char.IsWhiteSpace (c)) {
+ throw new ParserException ("Directive ended unexpectedly with character '" + c + "'", nextStateLocation);
+ } else {
+ nextStateLocation = nextStateLocation.AddCol ();
+ }
+ }
+ throw new ParserException ("Unexpected end of file.", nextStateLocation);
+ }
+
+ public State State {
+ get; private set;
+ }
+
+ public int Position {
+ get { return position; }
+ }
+
+ public string Content {
+ get { return content; }
+ }
+
+ public string Value {
+ get { return value; }
+ }
+
+ public Location Location { get; private set; }
+ public Location TagStartLocation { get; private set; }
+ public Location TagEndLocation { get; private set; }
+ }
+
+ public enum State
+ {
+ Content = 0,
+ Directive,
+ Expression,
+ Block,
+ Helper,
+ DirectiveName,
+ DirectiveValue,
+ Name,
+ EOF
+ }
+
+ public class ParserException : Exception
+ {
+ public ParserException (string message, Location location) : base (message)
+ {
+ Location = location;
+ }
+
+ public Location Location { get; private set; }
+ }
+}
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/AssemblyInfo.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/AssemblyInfo.cs
new file mode 100644
index 0000000000..f1cb20dc05
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/AssemblyInfo.cs
@@ -0,0 +1,51 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("MonoDevelop.TextTemplating")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/ChangeLog b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/ChangeLog
new file mode 100644
index 0000000000..a19086d34d
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/ChangeLog
@@ -0,0 +1,60 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Makefile.am:
+ * MonoDevelop.TextTemplating.csproj: Include the ASP.NET MVC
+ and TextTemplating addins in the main solution and build.
+
+2009-08-11 Michael Hutchinson <mhutchinson@novell.com>
+
+ * TextTemplatingService.cs: Track task service API.
+
+2009-04-15 Lluis Sanchez Gual <lluis@novell.com>
+
+ * MonoDevelop.TextTemplating.addin.xml: Bump MD version.
+
+2009-04-09 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Parser/T4Parser.cs: Track parser API.
+
+2009-04-02 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.TextTemplating.addin.xml: Fix refs.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * MonoDevelop.TextTemplating.csproj: Move output dir from
+ ../bin to ../build.
+
+2009-03-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui/T4EditorExtension.cs: Fix warning.
+
+ * TextTemplatingService.cs:
+ * MonoDevelop.TextTemplating.csproj: Added new
+ TextTemplatingService.
+
+2009-03-10 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Gui:
+ * Gui/T4EditorExtension.cs:
+ * MonoDevelop.TextTemplating.csproj:
+ * MonoDevelop.TextTemplating.addin.xml: Add T4 editor
+ extension with outlining.
+
+2009-03-09 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Parser/T4ParsedDocument.cs: More concise fold markers. Use
+ new tag start position info.
+
+2009-03-09 Michael Hutchinson <mhutchinson@novell.com>
+
+ * .:
+ * Parser:
+ * AssemblyInfo.cs:
+ * T4SyntaxMode.xml:
+ * Parser/T4Parser.cs:
+ * Parser/T4ParsedDocument.cs:
+ * MonoDevelop.TextTemplating.csproj:
+ * MonoDevelop.TextTemplating.addin.xml: Added new
+ TextTemplating addin.
+
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs
new file mode 100644
index 0000000000..3d0d93926c
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Gui/T4EditorExtension.cs
@@ -0,0 +1,293 @@
+//
+// T4EditorExtension.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Projects.Gui.Completion;
+using MonoDevelop.Projects.Dom;
+using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.DesignerSupport;
+using MonoDevelop.TextTemplating.Parser;
+
+namespace MonoDevelop.TextTemplating.Gui
+{
+
+
+ public class T4EditorExtension : CompletionTextEditorExtension, IOutlinedDocument
+ {
+ bool disposed;
+ T4ParsedDocument parsedDoc;
+
+ public T4EditorExtension ()
+ {
+ }
+
+ public override bool ExtendsEditor (MonoDevelop.Ide.Gui.Document doc, MonoDevelop.Ide.Gui.Content.IEditableTextBuffer editor)
+ {
+ return doc.Name.EndsWith (".tt");
+ }
+
+ public override void Initialize ()
+ {
+ base.Initialize ();
+ MonoDevelop.Projects.Dom.Parser.ProjectDomService.ParsedDocumentUpdated += OnParseInformationChanged;
+ parsedDoc = (T4ParsedDocument)Document.ParsedDocument;
+ if (parsedDoc != null) {
+ RefreshOutline ();
+ }
+ }
+
+ public override void Dispose ()
+ {
+ if (disposed)
+ return;
+ disposed = true;
+ MonoDevelop.Projects.Dom.Parser.ProjectDomService.ParsedDocumentUpdated
+ -= OnParseInformationChanged;
+ base.Dispose ();
+ }
+
+ void OnParseInformationChanged (object sender, MonoDevelop.Projects.Dom.ParsedDocumentEventArgs args)
+ {
+ if (FileName == args.FileName && args.ParsedDocument != null) {
+ parsedDoc = (T4ParsedDocument)args.ParsedDocument;
+ RefreshOutline ();
+ }
+ }
+
+ #region Convenience accessors, from BaseXmlEditorExtension
+
+ protected T4ParsedDocument ParsedDoc {
+ get { return parsedDoc; }
+ }
+
+ protected ITextBuffer Buffer {
+ get {
+ if (Document == null)
+ throw new InvalidOperationException ("Editor extension not yet initialized");
+ return Document.GetContent<ITextBuffer> ();
+ }
+ }
+
+ protected IEditableTextBuffer EditableBuffer {
+ get {
+ if (Document == null)
+ throw new InvalidOperationException ("Editor extension not yet initialized");
+ return Document.GetContent<IEditableTextBuffer> ();
+ }
+ }
+
+ protected string GetBufferText (DomRegion region)
+ {
+ MonoDevelop.Ide.Gui.Content.ITextBuffer buf = Buffer;
+ int start = buf.GetPositionFromLineColumn (region.Start.Line, region.Start.Column);
+ int end = buf.GetPositionFromLineColumn (region.End.Line, region.End.Column);
+ if (end > start && start >= 0)
+ return buf.GetText (start, end);
+ else
+ return null;
+ }
+
+ #endregion
+
+ #region Code completion
+
+ public override ICompletionDataList CodeCompletionCommand (ICodeCompletionContext completionContext)
+ {
+ int pos = completionContext.TriggerOffset;
+ string txt = Editor.GetText (pos - 1, pos);
+ int triggerWordLength = 0;
+ if (txt.Length > 0) {
+ return HandleCodeCompletion ((CodeCompletionContext) completionContext, true, ref triggerWordLength);
+ }
+ return null;
+ }
+
+ public override ICompletionDataList HandleCodeCompletion (
+ ICodeCompletionContext completionContext, char completionChar, ref int triggerWordLength)
+ {
+ int pos = completionContext.TriggerOffset;
+ if (pos > 0 && Editor.GetCharAt (pos - 1) == completionChar) {
+ return HandleCodeCompletion ((CodeCompletionContext) completionContext,
+ false, ref triggerWordLength);
+ }
+ return null;
+ }
+
+ protected virtual ICompletionDataList HandleCodeCompletion (
+ CodeCompletionContext completionContext, bool forced, ref int triggerWordLength)
+ {
+ //IEditableTextBuffer buf = this.EditableBuffer;
+ return null;
+ }
+
+ #endregion
+
+ #region Outline
+
+ bool refreshingOutline = false;
+ MonoDevelop.Ide.Gui.Components.PadTreeView outlineTreeView;
+ Gtk.TreeStore outlineTreeStore;
+
+ Gtk.Widget IOutlinedDocument.GetOutlineWidget ()
+ {
+ if (outlineTreeView != null)
+ return outlineTreeView;
+
+ outlineTreeStore = new Gtk.TreeStore (typeof(string), typeof (Gdk.Color), typeof (Mono.TextTemplating.ISegment));
+ outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineTreeStore);
+ outlineTreeView.Realized += delegate { RefillOutlineStore (); };
+
+ outlineTreeView.TextRenderer.Xpad = 0;
+ outlineTreeView.TextRenderer.Ypad = 0;
+ outlineTreeView.AppendColumn ("Node", outlineTreeView.TextRenderer, "text", 0, "foreground-gdk", 1);
+
+ outlineTreeView.HeadersVisible = false;
+
+ outlineTreeView.Selection.Changed += delegate {
+ Gtk.TreeIter iter;
+ if (!outlineTreeView.Selection.GetSelected (out iter))
+ return;
+ SelectSegment ((Mono.TextTemplating.ISegment )outlineTreeStore.GetValue (iter, 2));
+ };
+
+ RefillOutlineStore ();
+
+ Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
+ sw.Add (outlineTreeView);
+ sw.ShowAll ();
+ return sw;
+ }
+
+ void RefreshOutline ()
+ {
+ if (refreshingOutline || outlineTreeView == null )
+ return;
+ refreshingOutline = true;
+ GLib.Timeout.Add (3000, refillOutlineStoreIdleHandler);
+ }
+
+ bool refillOutlineStoreIdleHandler ()
+ {
+ refreshingOutline = false;
+ RefillOutlineStore ();
+ return false;
+ }
+
+ void RefillOutlineStore (T4ParsedDocument doc, Gtk.TreeStore store)
+ {
+ if (doc == null)
+ return;
+
+ Gdk.Color normal = new Gdk.Color (0x00, 0x00, 0x00);
+ Gdk.Color blue = new Gdk.Color (0x10, 0x40, 0xE0);
+ Gdk.Color green = new Gdk.Color (0x08, 0xC0, 0x30);
+ Gdk.Color orange = new Gdk.Color (0xFF, 0xA0, 0x00);
+ Gdk.Color red = new Gdk.Color (0xC0, 0x00, 0x20);
+
+ Gtk.TreeIter parent = Gtk.TreeIter.Zero;
+ foreach (Mono.TextTemplating.ISegment segment in doc.TemplateSegments) {
+ Mono.TextTemplating.Directive dir = segment as Mono.TextTemplating.Directive;
+ if (dir != null) {
+ parent = Gtk.TreeIter.Zero;
+ store.AppendValues ("<#@ " + dir.Name + " #>", red, segment);
+ continue;
+ }
+ Mono.TextTemplating.TemplateSegment ts = segment as Mono.TextTemplating.TemplateSegment;
+ if (ts != null) {
+ string name;
+ if (ts.Text.Length > 40) {
+ name = ts.Text.Substring (0, 40) + "...";
+ } else {
+ name = ts.Text;
+ }
+ name = name.Replace ('\n', ' ').Trim ();
+ if (name.Length == 0)
+ continue;
+
+ if (ts.Type == Mono.TextTemplating.SegmentType.Expression) {
+ store.AppendValues (parent, "<#= " + name + " #>", orange, segment);
+ } else {
+ if (ts.Type == Mono.TextTemplating.SegmentType.Block) {
+ name = "<#" + name + " #>";
+ store.AppendValues (name, blue, segment);
+ parent = Gtk.TreeIter.Zero;
+ } else if (ts.Type == Mono.TextTemplating.SegmentType.Helper) {
+ name = "<#+" + name + " #>";
+ store.AppendValues (name, green, segment);
+ parent = Gtk.TreeIter.Zero;
+ } else if (ts.Type == Mono.TextTemplating.SegmentType.Content) {
+ parent = store.AppendValues (name, normal, segment);
+ }
+ }
+ }
+ }
+ }
+
+ void RefillOutlineStore ()
+ {
+ MonoDevelop.Core.Gui.DispatchService.AssertGuiThread ();
+ Gdk.Threads.Enter ();
+ refreshingOutline = false;
+ if (outlineTreeStore == null || !outlineTreeView.IsRealized)
+ return;
+ outlineTreeStore.Clear ();
+
+ if (ParsedDoc != null) {
+ DateTime start = DateTime.Now;
+ RefillOutlineStore (ParsedDoc, outlineTreeStore);
+ outlineTreeView.ExpandAll ();
+ outlineTreeView.ExpandAll ();
+ MonoDevelop.Core.LoggingService.LogDebug ("Built outline in {0}ms", (DateTime.Now - start).Milliseconds);
+ }
+
+ Gdk.Threads.Leave ();
+ }
+
+ void IOutlinedDocument.ReleaseOutlineWidget ()
+ {
+ if (outlineTreeView == null)
+ return;
+
+ Gtk.ScrolledWindow w = (Gtk.ScrolledWindow) outlineTreeView.Parent;
+ w.Destroy ();
+ outlineTreeView.Destroy ();
+ outlineTreeStore.Dispose ();
+ outlineTreeStore = null;
+ outlineTreeView = null;
+ }
+
+ void SelectSegment (Mono.TextTemplating.ISegment seg)
+ {
+ int s = Editor.GetPositionFromLineColumn (seg.TagStartLocation.Line, seg.TagStartLocation.Column);
+ if (s > -1) {
+ Editor.CursorPosition = s;
+ Editor.ShowPosition (s);
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am
new file mode 100644
index 0000000000..ac41941ef4
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am
@@ -0,0 +1,48 @@
+ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating
+ASSEMBLY = $(ADDIN_BUILD)/MonoDevelop.TextTemplating.dll
+
+DEPS = \
+ $(top_builddir)/build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll \
+ $(top_builddir)/build/AddIns/MonoDevelop.SourceEditor2.dll \
+ $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating/Mono.TextTemplating.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Core.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Ide.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Projects.dll \
+ $(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll
+
+REFS = \
+ $(GLIB_SHARP_LIBS) \
+ $(GTK_SHARP_LIBS) \
+ -r:System
+
+FILES = \
+ AssemblyInfo.cs \
+ Gui/T4EditorExtension.cs \
+ Parser/T4ParsedDocument.cs \
+ Parser/T4Parser.cs \
+ TextTemplatingService.cs
+
+RES = \
+ MonoDevelop.TextTemplating.addin.xml \
+ T4SyntaxMode.xml
+
+all: $(ASSEMBLY) $(ASSEMBLY).mdb $(DATA_FILE_BUILD)
+
+$(ASSEMBLY): $(build_sources) $(build_resources) $(DEPS)
+ mkdir -p $(ADDIN_BUILD)
+ $(CSC) $(CSC_FLAGS) -debug -out:$@ -target:library $(REFS) $(build_deps) \
+ $(build_resources:%=/resource:%) $(build_sources)
+
+$(ASSEMBLY).mdb: $(ASSEMBLY)
+
+check: all
+
+assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.TextTemplating
+assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
+EXTRA_DIST = $(FILES) $(RES)
+
+include $(top_srcdir)/Makefile.include
+
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.addin.xml b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.addin.xml
new file mode 100644
index 0000000000..0fb5c1f3fd
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.addin.xml
@@ -0,0 +1,48 @@
+<Addin id = "TextTemplating"
+ namespace = "MonoDevelop"
+ name = "Text Templating"
+ author = "Michael Hutchinson"
+ copyright = "MIT/X11"
+ url = "http://monodevelop.com"
+ description = "Support for editing and running T4 text templates."
+ category = "IDE extensions"
+ version = "2.1.0">
+
+ <Runtime>
+ <Import assembly="Mono.TextTemplating.dll" />
+ </Runtime>
+
+ <Dependencies>
+ <Addin id="Core" version="2.1.0"/>
+ <Addin id="Core.Gui" version="2.1.0"/>
+ <Addin id="Components" version="2.1.0"/>
+ <Addin id="Ide" version="2.1.0"/>
+ <Addin id="SourceEditor2" version="2.1.0"/>
+ <Addin id="Projects" version="2.1.0"/>
+ </Dependencies>
+
+ <Extension path = "/MonoDevelop/SourceEditor2/SyntaxModes">
+ <Templates resource="T4SyntaxMode.xml" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Core/MimeTypes">
+ <MimeType id="application/t4-template" _description="Text template" icon="md-template" isText="true">
+ <File pattern="*.tt" />
+ </MimeType>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/FileFilters">
+ <FileFilter id = "T4Templates"
+ insertbefore = "AllFiles"
+ _label = "T4 Templates"
+ extensions = "*.tt" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/ProjectModel/DomParser">
+ <Class class = "MonoDevelop.TextTemplating.Parser.T4Parser" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/TextEditorExtensions">
+ <Class class = "MonoDevelop.TextTemplating.Gui.T4EditorExtension" />
+ </Extension>
+</Addin>
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
new file mode 100644
index 0000000000..d7cf53eed9
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>MonoDevelop.TextTemplating</RootNamespace>
+ <AssemblyName>MonoDevelop.TextTemplating</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="MonoDevelop.TextTemplating.addin.xml">
+ <LogicalName>MonoDevelop.TextTemplating.addin.xml</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="T4SyntaxMode.xml">
+ <LogicalName>T4SyntaxMode.xml</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="Parser\T4Parser.cs" />
+ <Compile Include="Parser\T4ParsedDocument.cs" />
+ <Compile Include="Gui\T4EditorExtension.cs" />
+ <Compile Include="TextTemplatingService.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <SpecificVersion>False</SpecificVersion>
+ </Reference>
+ <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Parser\" />
+ <Folder Include="Gui\" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Mono.TextTemplating\Mono.TextTemplating.csproj">
+ <Project>{A2364D6A-00EF-417C-80A6-815726C70032}</Project>
+ <Name>Mono.TextTemplating</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
+ <Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
+ <Name>MonoDevelop.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Core.Gui\MonoDevelop.Core.Gui.csproj">
+ <Project>{659B0888-3956-4040-BDB1-B45F6D64E7FA}</Project>
+ <Name>MonoDevelop.Core.Gui</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.csproj">
+ <Project>{2C24D515-4A2C-445C-8419-C09231913CFA}</Project>
+ <Name>MonoDevelop.DesignerSupport</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
+ <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
+ <Name>MonoDevelop.Ide</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Projects\MonoDevelop.Projects.csproj">
+ <Project>{04BED15A-DDC5-48BC-A36C-3E360A0348C0}</Project>
+ <Name>MonoDevelop.Projects</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\core\MonoDevelop.Projects.Gui\MonoDevelop.Projects.Gui.csproj">
+ <Project>{00E87426-F1BD-4B55-9B3E-7267EE93E002}</Project>
+ <Name>MonoDevelop.Projects.Gui</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor.csproj">
+ <Project>{F8F92AA4-A376-4679-A9D4-60E7B7FBF477}</Project>
+ <Name>MonoDevelop.SourceEditor</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="true" IsAutotoolsProject="true" RelativeConfigureInPath="../../../..">
+ <BuildFilesVar Sync="true" Name="FILES" />
+ <DeployFilesVar />
+ <ResourcesVar Sync="true" Name="RES" />
+ <OthersVar />
+ <GacRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <AsmRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <ProjectRefVar Sync="true" Name="DEPS" />
+ </MonoDevelop.Autotools.MakefileInfo>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4ParsedDocument.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4ParsedDocument.cs
new file mode 100644
index 0000000000..bac6892853
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4ParsedDocument.cs
@@ -0,0 +1,97 @@
+//
+// T4ParsedDocument.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using MonoDevelop.Projects.Dom;
+using MonoDevelop.Projects.Dom.Parser;
+using Mono.TextTemplating;
+
+namespace MonoDevelop.TextTemplating.Parser
+{
+
+
+ public class T4ParsedDocument : ParsedDocument
+ {
+
+ public T4ParsedDocument (string fileName, List<ISegment> segments) : base (fileName)
+ {
+ TemplateSegments = segments;
+ }
+
+ public List<ISegment> TemplateSegments { get; private set; }
+
+ public IEnumerable<Directive> TemplateDirectives {
+ get {
+ foreach (ISegment seg in TemplateSegments) {
+ Directive dir = seg as Directive;
+ if (dir != null)
+ yield return dir;
+ }
+ }
+ }
+
+ public IEnumerable<TemplateSegment> TemplateContent {
+ get {
+ foreach (ISegment seg in TemplateSegments) {
+ TemplateSegment ts = seg as TemplateSegment;
+ if (ts != null)
+ yield return ts;
+ }
+ }
+ }
+
+ public override IEnumerable<FoldingRegion> GenerateFolds ()
+ {
+ foreach (ISegment seg in TemplateSegments) {
+ if (seg.EndLocation.Line - seg.TagStartLocation.Line < 1)
+ continue;
+
+ string name;
+ TemplateSegment ts = seg as TemplateSegment;
+ if (ts != null) {
+ if (ts.Type == SegmentType.Content) {
+ continue;
+ } else if (ts.Type == SegmentType.Expression) {
+ name = "<#=...#>";
+ } else if (ts.Type == SegmentType.Helper) {
+ name = "<#+...#>";
+ } else {
+ name = "<#...#>";
+ }
+ } else {
+ Directive dir = (Directive)seg;
+ name = "<#@" + dir.Name + "...#>";
+ }
+
+ DomRegion region = new DomRegion (seg.TagStartLocation.Line, seg.TagStartLocation.Column,
+ seg.EndLocation.Line, seg.EndLocation.Column);
+
+ yield return new FoldingRegion (name, region, false);
+ }
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4Parser.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4Parser.cs
new file mode 100644
index 0000000000..b4900a84f6
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Parser/T4Parser.cs
@@ -0,0 +1,68 @@
+//
+// T4Parser.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using MonoDevelop.Projects.Dom;
+using MonoDevelop.Projects.Dom.Parser;
+using Mono.TextTemplating;
+
+namespace MonoDevelop.TextTemplating.Parser
+{
+
+
+ public class T4Parser : AbstractParser
+ {
+
+ public T4Parser () : base (null, "application/t4-template")
+ {
+ }
+
+ public override bool CanParse (string fileName)
+ {
+ return fileName.EndsWith (".tt");
+ }
+
+ public override ParsedDocument Parse (ProjectDom dom, string fileName, string content)
+ {
+ ParsedTemplate template = new ParsedTemplate (fileName);
+ try {
+ Tokeniser tk = new Tokeniser (fileName, content);
+ template.ParseWithoutIncludes (tk);
+ } catch (ParserException ex) {
+ template.LogError (ex.Message, ex.Location);
+ }
+
+ T4ParsedDocument doc = new T4ParsedDocument (fileName, template.RawSegments);
+ doc.Flags |= ParsedDocumentFlags.NonSerializable;
+ foreach (System.CodeDom.Compiler.CompilerError err in template.Errors)
+ doc.Errors.Add (new Error (err.IsWarning? ErrorType.Warning : ErrorType.Error,
+ err.Line, err.Column, err.ErrorText));
+
+ return doc;
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/T4SyntaxMode.xml b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/T4SyntaxMode.xml
new file mode 100644
index 0000000000..61fb20f179
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/T4SyntaxMode.xml
@@ -0,0 +1,242 @@
+<!-- CSharpSyntaxMode.xml
+
+ Author:
+ Michael Hutchinson <mhutchinson@novell.com>
+
+ Copyright (c) 2009 Novell, Inc (http://www.novell.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. -->
+
+<SyntaxMode name = "T4" mimeTypes="application/t4-template">
+ <Span color="string" rule="t4">
+ <Begin>
+</Begin>
+ <End>qkl6ynrv7y234crtnq238rtxck3</End>
+ </Span>
+ <Span color = "text.markup" rule = "directive">
+ <Begin>&lt;#@</Begin>
+ <End>#&gt;</End>
+ </Span>
+
+ <Rule name="t4">
+ <!-- directives -->
+ <Span color = "text.markup" rule = "directive">
+ <Begin>&lt;#@</Begin>
+ <End>#&gt;</End>
+ </Span>
+
+ <!-- expressions -->
+ <Span tagColor = "keyword.declaration" color="text" rule = "csharp">
+ <Begin>&lt;#=</Begin>
+ <End>#&gt;</End>
+ </Span>
+
+ <Span tagColor = "keyword.declaration" color="text" rule = "csharp">
+ <Begin>&lt;#+</Begin>
+ <End>#&gt;</End>
+ </Span>
+
+ <Span tagColor = "keyword.declaration" color="text" rule = "csharp">
+ <Begin>&lt;#</Begin>
+ <End>#&gt;</End>
+ </Span>
+ </Rule>
+
+ <Rule name = "directive">
+ <Span color = "string" rule="InLiteral">
+ <Begin>&quot;</Begin>
+ <End>&quot;</End>
+ </Span>
+
+ <Span color = "string" rule="InLiteral">
+ <Begin>&apos;</Begin>
+ <End>&apos;</End>
+ </Span>
+
+ <!-- attributes -->
+ <Match color = "keyword.type">[A-Za-z0-9_]+(:[A-Za-z0-9_]+)?[\s\n\r]*=</Match>
+ </Rule>
+
+ <Rule name = "csharp">
+ <Span color = "comment.block" rule="Comment" tagColor="comment.tag.block">
+ <Begin>/*</Begin>
+ <End>*/</End>
+ </Span>
+
+ <Span color = "string.other" rule="String" stopateol = "false" escape='""'>
+ <Begin>@"</Begin>
+ <End>"</End>
+ </Span>
+
+ <Span color = "string.double" rule="String" stopateol = "true" escape='\"'>
+ <Begin>"</Begin>
+ <End>"</End>
+ </Span>
+
+ <Span color = "string.single" rule="String" stopateol = "true" escape="\'">
+ <Begin>&apos;</Begin>
+ <End>&apos;</End>
+ </Span>
+
+ <Match color = "constant.digit">CSharpNumber</Match>
+
+ <Keywords color = "keyword.access">
+ <Word>this</Word>
+ <Word>base</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.operator">
+ <Word>as</Word>
+ <Word>is</Word>
+ <Word>new</Word>
+ <Word>sizeof</Word>
+ <Word>typeof</Word>
+ <Word>stackalloc</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.selection">
+ <Word>else</Word>
+ <Word>if</Word>
+ <Word>switch</Word>
+ <Word>case</Word>
+ <Word>default</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.iteration">
+ <Word>do</Word>
+ <Word>for</Word>
+ <Word>foreach</Word>
+ <Word>in</Word>
+ <Word>while</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.jump">
+ <Word>break</Word>
+ <Word>continue</Word>
+ <Word>goto</Word>
+ <Word>return</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.context">
+ <Word>yield</Word>
+ <Word>partial</Word>
+ <Word>global</Word>
+ <Word>where</Word>
+ <Word>__arglist</Word>
+ <Word>__makeref</Word>
+ <Word>__reftype</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.exceptions">
+ <Word>try</Word>
+ <Word>throw</Word>
+ <Word>catch</Word>
+ <Word>finally</Word>
+ </Keywords>
+
+ <Keywords color = "constant.language">
+ <Word>true</Word>
+ <Word>false</Word>
+ <Word>null</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.modifier">
+ <Word>abstract</Word>
+ <Word>const</Word>
+ <Word>event</Word>
+ <Word>extern</Word>
+ <Word>override</Word>
+ <Word>readonly</Word>
+ <Word>sealed</Word>
+ <Word>static</Word>
+ <Word>virtual</Word>
+ <Word>volatile</Word>
+
+ <Word>public</Word>
+ <Word>protected</Word>
+ <Word>private</Word>
+ <Word>internal</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.type">
+ <Word>bool</Word>
+ <Word>byte</Word>
+ <Word>char</Word>
+ <Word>decimal</Word>
+ <Word>double</Word>
+ <Word>enum</Word>
+ <Word>float</Word>
+ <Word>int</Word>
+ <Word>long</Word>
+ <Word>sbyte</Word>
+ <Word>short</Word>
+ <Word>struct</Word>
+ <Word>uint</Word>
+ <Word>ushort</Word>
+ <Word>ulong</Word>
+ <Word>object</Word>
+ <Word>string</Word>
+ </Keywords>
+
+ <Keywords color = "constant.language.void">
+ <Word>void</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.namespace">
+ <Word>namespace</Word>
+ <Word>using</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.property">
+ <Word>get</Word>
+ <Word>set</Word>
+ <Word>add</Word>
+ <Word>remove</Word>
+ <Word>value</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.declaration">
+ <Word>class</Word>
+ <Word>interface</Word>
+ <Word>delegate</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.parameter">
+ <Word>params</Word>
+ <Word>ref</Word>
+ <Word>out</Word>
+ </Keywords>
+
+
+ <Keywords color = "keyword.operator.declaration">
+ <Word>explicit</Word>
+ <Word>implicit</Word>
+
+ <Word>operator</Word>
+ </Keywords>
+
+ <Keywords color = "keyword.misc">
+ <Word>checked</Word>
+ <Word>unchecked</Word>
+ <Word>fixed</Word>
+ <Word>unsafe</Word>
+ <Word>lock</Word>
+ </Keywords>
+ </Rule>
+</SyntaxMode> \ No newline at end of file
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs
new file mode 100644
index 0000000000..41220e4837
--- /dev/null
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/TextTemplatingService.cs
@@ -0,0 +1,55 @@
+//
+// TextTemplatingService.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using Mono.TextTemplating;
+using Microsoft.VisualStudio.TextTemplating;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Gui.Pads;
+using MonoDevelop.Ide.Tasks;
+
+namespace MonoDevelop.TextTemplating
+{
+
+
+ public static class TextTemplatingService
+ {
+
+ public static void ShowTemplateHostErrors (System.CodeDom.Compiler.CompilerErrorCollection errors)
+ {
+ if (errors.Count == 0)
+ return;
+
+ TaskService.Errors.Clear ();
+ foreach (System.CodeDom.Compiler.CompilerError err in errors) {
+ TaskService.Errors.Add (new Task (err.FileName, err.ErrorText, err.Column, err.Line,
+ err.IsWarning? TaskSeverity.Warning : TaskSeverity.Error));
+ }
+ TaskService.ShowErrors ();
+ }
+ }
+}
diff --git a/main/src/addins/TextTemplating/TextTransform/AssemblyInfo.cs b/main/src/addins/TextTemplating/TextTransform/AssemblyInfo.cs
new file mode 100644
index 0000000000..ca8befa5f2
--- /dev/null
+++ b/main/src/addins/TextTemplating/TextTransform/AssemblyInfo.cs
@@ -0,0 +1,39 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("TextTransform")]
+[assembly: AssemblyDescription("T4 text transformation tool")]
+[assembly: AssemblyCompany("The Mono Project")]
+[assembly: AssemblyProduct("MonoDevelop")]
+[assembly: AssemblyCopyright("MIT/X11")]
+
+//[assembly: AssemblyVersion("1.0.*")]
+
diff --git a/main/src/addins/TextTemplating/TextTransform/ChangeLog b/main/src/addins/TextTemplating/TextTransform/ChangeLog
new file mode 100644
index 0000000000..08db48eca0
--- /dev/null
+++ b/main/src/addins/TextTemplating/TextTransform/ChangeLog
@@ -0,0 +1,25 @@
+2009-08-12 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Makefile.am:
+ * TextTransform.csproj: Include the ASP.NET MVC and
+ TextTemplating addins in the main solution and build.
+
+2009-03-13 Michael Hutchinson <mhutchinson@novell.com>
+
+ * TextTransform.csproj: Move output dir from ../bin to
+ ../build.
+
+2009-03-05 Michael Hutchinson <mhutchinson@novell.com>
+
+ * TextTransform.csproj: Updated.
+
+ * TextTransform.cs: Complete the runner implementation.
+
+2009-03-04 Michael Hutchinson <mhutchinson@novell.com>
+
+ * Options.cs:
+ * AssemblyInfo.cs:
+ * TextTransform.cs:
+ * TextTransform.csproj: Stub out the command-line
+ TextTransform tool.
+
diff --git a/main/src/addins/TextTemplating/TextTransform/Makefile.am b/main/src/addins/TextTemplating/TextTransform/Makefile.am
new file mode 100644
index 0000000000..bd47225414
--- /dev/null
+++ b/main/src/addins/TextTemplating/TextTransform/Makefile.am
@@ -0,0 +1,35 @@
+ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating
+ASSEMBLY = $(ADDIN_BUILD)/TextTransform.exe
+
+DEPS = $(top_builddir)/build/AddIns/MonoDevelop.TextTemplating/Mono.TextTemplating.dll
+
+REFS = \
+ -r:System \
+ -r:System.Core
+
+FILES = \
+ AssemblyInfo.cs \
+ Options.cs \
+ TextTransform.cs
+
+RES =
+
+all: $(ASSEMBLY) $(ASSEMBLY).mdb $(DATA_FILE_BUILD)
+
+$(ASSEMBLY): $(build_sources) $(build_resources) $(DEPS)
+ mkdir -p $(ADDIN_BUILD)
+ $(CSC) $(CSC_FLAGS) -debug -out:$@ -target:exe $(REFS) $(build_deps) \
+ $(build_resources:%=/resource:%) $(build_sources)
+
+$(ASSEMBLY).mdb: $(ASSEMBLY)
+
+check: all
+
+assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.TextTemplating
+assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
+EXTRA_DIST = $(FILES) $(RES)
+
+include $(top_srcdir)/Makefile.include
+
diff --git a/main/src/addins/TextTemplating/TextTransform/Options.cs b/main/src/addins/TextTemplating/TextTransform/Options.cs
new file mode 100644
index 0000000000..a64ea4d4d0
--- /dev/null
+++ b/main/src/addins/TextTemplating/TextTransform/Options.cs
@@ -0,0 +1,1112 @@
+//
+// Options.cs
+//
+// Authors:
+// Jonathan Pryor <jpryor@novell.com>
+//
+// Copyright (C) 2008 Novell (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+// Compile With:
+// gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll
+// gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll
+//
+// The LINQ version just changes the implementation of
+// OptionSet.Parse(IEnumerable<string>), and confers no semantic changes.
+
+//
+// A Getopt::Long-inspired option parsing library for C#.
+//
+// NDesk.Options.OptionSet is built upon a key/value table, where the
+// key is a option format string and the value is a delegate that is
+// invoked when the format string is matched.
+//
+// Option format strings:
+// Regex-like BNF Grammar:
+// name: .+
+// type: [=:]
+// sep: ( [^{}]+ | '{' .+ '}' )?
+// aliases: ( name type sep ) ( '|' name type sep )*
+//
+// Each '|'-delimited name is an alias for the associated action. If the
+// format string ends in a '=', it has a required value. If the format
+// string ends in a ':', it has an optional value. If neither '=' or ':'
+// is present, no value is supported. `=' or `:' need only be defined on one
+// alias, but if they are provided on more than one they must be consistent.
+//
+// Each alias portion may also end with a "key/value separator", which is used
+// to split option values if the option accepts > 1 value. If not specified,
+// it defaults to '=' and ':'. If specified, it can be any character except
+// '{' and '}' OR the *string* between '{' and '}'. If no separator should be
+// used (i.e. the separate values should be distinct arguments), then "{}"
+// should be used as the separator.
+//
+// Options are extracted either from the current option by looking for
+// the option name followed by an '=' or ':', or is taken from the
+// following option IFF:
+// - The current option does not contain a '=' or a ':'
+// - The current option requires a value (i.e. not a Option type of ':')
+//
+// The `name' used in the option format string does NOT include any leading
+// option indicator, such as '-', '--', or '/'. All three of these are
+// permitted/required on any named option.
+//
+// Option bundling is permitted so long as:
+// - '-' is used to start the option group
+// - all of the bundled options are a single character
+// - at most one of the bundled options accepts a value, and the value
+// provided starts from the next character to the end of the string.
+//
+// This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value'
+// as '-Dname=value'.
+//
+// Option processing is disabled by specifying "--". All options after "--"
+// are returned by OptionSet.Parse() unchanged and unprocessed.
+//
+// Unprocessed options are returned from OptionSet.Parse().
+//
+// Examples:
+// int verbose = 0;
+// OptionSet p = new OptionSet ()
+// .Add ("v", v => ++verbose)
+// .Add ("name=|value=", v => Console.WriteLine (v));
+// p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"});
+//
+// The above would parse the argument string array, and would invoke the
+// lambda expression three times, setting `verbose' to 3 when complete.
+// It would also print out "A" and "B" to standard output.
+// The returned array would contain the string "extra".
+//
+// C# 3.0 collection initializers are supported and encouraged:
+// var p = new OptionSet () {
+// { "h|?|help", v => ShowHelp () },
+// };
+//
+// System.ComponentModel.TypeConverter is also supported, allowing the use of
+// custom data types in the callback type; TypeConverter.ConvertFromString()
+// is used to convert the value option to an instance of the specified
+// type:
+//
+// var p = new OptionSet () {
+// { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) },
+// };
+//
+// Random other tidbits:
+// - Boolean options (those w/o '=' or ':' in the option format string)
+// are explicitly enabled if they are followed with '+', and explicitly
+// disabled if they are followed with '-':
+// string a = null;
+// var p = new OptionSet () {
+// { "a", s => a = s },
+// };
+// p.Parse (new string[]{"-a"}); // sets v != null
+// p.Parse (new string[]{"-a+"}); // sets v != null
+// p.Parse (new string[]{"-a-"}); // sets v == null
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+using System.Text;
+using System.Text.RegularExpressions;
+
+#if LINQ
+using System.Linq;
+#endif
+
+#if TEST
+using NDesk.Options;
+#endif
+
+#if NDESK_OPTIONS
+namespace NDesk.Options
+#else
+namespace Mono.Options
+#endif
+{
+ public class OptionValueCollection : IList, IList<string> {
+
+ List<string> values = new List<string> ();
+ OptionContext c;
+
+ internal OptionValueCollection (OptionContext c)
+ {
+ this.c = c;
+ }
+
+ #region ICollection
+ void ICollection.CopyTo (Array array, int index) {(values as ICollection).CopyTo (array, index);}
+ bool ICollection.IsSynchronized {get {return (values as ICollection).IsSynchronized;}}
+ object ICollection.SyncRoot {get {return (values as ICollection).SyncRoot;}}
+ #endregion
+
+ #region ICollection<T>
+ public void Add (string item) {values.Add (item);}
+ public void Clear () {values.Clear ();}
+ public bool Contains (string item) {return values.Contains (item);}
+ public void CopyTo (string[] array, int arrayIndex) {values.CopyTo (array, arrayIndex);}
+ public bool Remove (string item) {return values.Remove (item);}
+ public int Count {get {return values.Count;}}
+ public bool IsReadOnly {get {return false;}}
+ #endregion
+
+ #region IEnumerable
+ IEnumerator IEnumerable.GetEnumerator () {return values.GetEnumerator ();}
+ #endregion
+
+ #region IEnumerable<T>
+ public IEnumerator<string> GetEnumerator () {return values.GetEnumerator ();}
+ #endregion
+
+ #region IList
+ int IList.Add (object value) {return (values as IList).Add (value);}
+ bool IList.Contains (object value) {return (values as IList).Contains (value);}
+ int IList.IndexOf (object value) {return (values as IList).IndexOf (value);}
+ void IList.Insert (int index, object value) {(values as IList).Insert (index, value);}
+ void IList.Remove (object value) {(values as IList).Remove (value);}
+ void IList.RemoveAt (int index) {(values as IList).RemoveAt (index);}
+ bool IList.IsFixedSize {get {return false;}}
+ object IList.this [int index] {get {return this [index];} set {(values as IList)[index] = value;}}
+ #endregion
+
+ #region IList<T>
+ public int IndexOf (string item) {return values.IndexOf (item);}
+ public void Insert (int index, string item) {values.Insert (index, item);}
+ public void RemoveAt (int index) {values.RemoveAt (index);}
+
+ private void AssertValid (int index)
+ {
+ if (c.Option == null)
+ throw new InvalidOperationException ("OptionContext.Option is null.");
+ if (index >= c.Option.MaxValueCount)
+ throw new ArgumentOutOfRangeException ("index");
+ if (c.Option.OptionValueType == OptionValueType.Required &&
+ index >= values.Count)
+ throw new OptionException (string.Format (
+ c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName),
+ c.OptionName);
+ }
+
+ public string this [int index] {
+ get {
+ AssertValid (index);
+ return index >= values.Count ? null : values [index];
+ }
+ set {
+ values [index] = value;
+ }
+ }
+ #endregion
+
+ public List<string> ToList ()
+ {
+ return new List<string> (values);
+ }
+
+ public string[] ToArray ()
+ {
+ return values.ToArray ();
+ }
+
+ public override string ToString ()
+ {
+ return string.Join (", ", values.ToArray ());
+ }
+ }
+
+ public class OptionContext {
+ private Option option;
+ private string name;
+ private int index;
+ private OptionSet set;
+ private OptionValueCollection c;
+
+ public OptionContext (OptionSet set)
+ {
+ this.set = set;
+ this.c = new OptionValueCollection (this);
+ }
+
+ public Option Option {
+ get {return option;}
+ set {option = value;}
+ }
+
+ public string OptionName {
+ get {return name;}
+ set {name = value;}
+ }
+
+ public int OptionIndex {
+ get {return index;}
+ set {index = value;}
+ }
+
+ public OptionSet OptionSet {
+ get {return set;}
+ }
+
+ public OptionValueCollection OptionValues {
+ get {return c;}
+ }
+ }
+
+ public enum OptionValueType {
+ None,
+ Optional,
+ Required,
+ }
+
+ public abstract class Option {
+ string prototype, description;
+ string[] names;
+ OptionValueType type;
+ int count;
+ string[] separators;
+
+ protected Option (string prototype, string description)
+ : this (prototype, description, 1)
+ {
+ }
+
+ protected Option (string prototype, string description, int maxValueCount)
+ {
+ if (prototype == null)
+ throw new ArgumentNullException ("prototype");
+ if (prototype.Length == 0)
+ throw new ArgumentException ("Cannot be the empty string.", "prototype");
+ if (maxValueCount < 0)
+ throw new ArgumentOutOfRangeException ("maxValueCount");
+
+ this.prototype = prototype;
+ this.names = prototype.Split ('|');
+ this.description = description;
+ this.count = maxValueCount;
+ this.type = ParsePrototype ();
+
+ if (this.count == 0 && type != OptionValueType.None)
+ throw new ArgumentException (
+ "Cannot provide maxValueCount of 0 for OptionValueType.Required or " +
+ "OptionValueType.Optional.",
+ "maxValueCount");
+ if (this.type == OptionValueType.None && maxValueCount > 1)
+ throw new ArgumentException (
+ string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount),
+ "maxValueCount");
+ if (Array.IndexOf (names, "<>") >= 0 &&
+ ((names.Length == 1 && this.type != OptionValueType.None) ||
+ (names.Length > 1 && this.MaxValueCount > 1)))
+ throw new ArgumentException (
+ "The default option handler '<>' cannot require values.",
+ "prototype");
+ }
+
+ public string Prototype {get {return prototype;}}
+ public string Description {get {return description;}}
+ public OptionValueType OptionValueType {get {return type;}}
+ public int MaxValueCount {get {return count;}}
+
+ public string[] GetNames ()
+ {
+ return (string[]) names.Clone ();
+ }
+
+ public string[] GetValueSeparators ()
+ {
+ if (separators == null)
+ return new string [0];
+ return (string[]) separators.Clone ();
+ }
+
+ protected static T Parse<T> (string value, OptionContext c)
+ {
+ Type tt = typeof (T);
+ bool nullable = tt.IsValueType && tt.IsGenericType &&
+ !tt.IsGenericTypeDefinition &&
+ tt.GetGenericTypeDefinition () == typeof (Nullable<>);
+ Type targetType = nullable ? tt.GetGenericArguments () [0] : typeof (T);
+ TypeConverter conv = TypeDescriptor.GetConverter (targetType);
+ T t = default (T);
+ try {
+ if (value != null)
+ t = (T) conv.ConvertFromString (value);
+ }
+ catch (Exception e) {
+ throw new OptionException (
+ string.Format (
+ c.OptionSet.MessageLocalizer ("Could not convert string `{0}' to type {1} for option `{2}'."),
+ value, targetType.Name, c.OptionName),
+ c.OptionName, e);
+ }
+ return t;
+ }
+
+ internal string[] Names {get {return names;}}
+ internal string[] ValueSeparators {get {return separators;}}
+
+ static readonly char[] NameTerminator = new char[]{'=', ':'};
+
+ private OptionValueType ParsePrototype ()
+ {
+ char type = '\0';
+ List<string> seps = new List<string> ();
+ for (int i = 0; i < names.Length; ++i) {
+ string name = names [i];
+ if (name.Length == 0)
+ throw new ArgumentException ("Empty option names are not supported.", "prototype");
+
+ int end = name.IndexOfAny (NameTerminator);
+ if (end == -1)
+ continue;
+ names [i] = name.Substring (0, end);
+ if (type == '\0' || type == name [end])
+ type = name [end];
+ else
+ throw new ArgumentException (
+ string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]),
+ "prototype");
+ AddSeparators (name, end, seps);
+ }
+
+ if (type == '\0')
+ return OptionValueType.None;
+
+ if (count <= 1 && seps.Count != 0)
+ throw new ArgumentException (
+ string.Format ("Cannot provide key/value separators for Options taking {0} value(s).", count),
+ "prototype");
+ if (count > 1) {
+ if (seps.Count == 0)
+ this.separators = new string[]{":", "="};
+ else if (seps.Count == 1 && seps [0].Length == 0)
+ this.separators = null;
+ else
+ this.separators = seps.ToArray ();
+ }
+
+ return type == '=' ? OptionValueType.Required : OptionValueType.Optional;
+ }
+
+ private static void AddSeparators (string name, int end, ICollection<string> seps)
+ {
+ int start = -1;
+ for (int i = end+1; i < name.Length; ++i) {
+ switch (name [i]) {
+ case '{':
+ if (start != -1)
+ throw new ArgumentException (
+ string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
+ "prototype");
+ start = i+1;
+ break;
+ case '}':
+ if (start == -1)
+ throw new ArgumentException (
+ string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
+ "prototype");
+ seps.Add (name.Substring (start, i-start));
+ start = -1;
+ break;
+ default:
+ if (start == -1)
+ seps.Add (name [i].ToString ());
+ break;
+ }
+ }
+ if (start != -1)
+ throw new ArgumentException (
+ string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
+ "prototype");
+ }
+
+ public void Invoke (OptionContext c)
+ {
+ OnParseComplete (c);
+ c.OptionName = null;
+ c.Option = null;
+ c.OptionValues.Clear ();
+ }
+
+ protected abstract void OnParseComplete (OptionContext c);
+
+ public override string ToString ()
+ {
+ return Prototype;
+ }
+ }
+
+ [Serializable]
+ public class OptionException : Exception {
+ private string option;
+
+ public OptionException ()
+ {
+ }
+
+ public OptionException (string message, string optionName)
+ : base (message)
+ {
+ this.option = optionName;
+ }
+
+ public OptionException (string message, string optionName, Exception innerException)
+ : base (message, innerException)
+ {
+ this.option = optionName;
+ }
+
+ protected OptionException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ this.option = info.GetString ("OptionName");
+ }
+
+ public string OptionName {
+ get {return this.option;}
+ }
+
+ [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("OptionName", option);
+ }
+ }
+
+ public delegate void OptionAction<TKey, TValue> (TKey key, TValue value);
+
+ public class OptionSet : KeyedCollection<string, Option>
+ {
+ public OptionSet ()
+ : this (delegate (string f) {return f;})
+ {
+ }
+
+ public OptionSet (Converter<string, string> localizer)
+ {
+ this.localizer = localizer;
+ }
+
+ Converter<string, string> localizer;
+
+ public Converter<string, string> MessageLocalizer {
+ get {return localizer;}
+ }
+
+ protected override string GetKeyForItem (Option item)
+ {
+ if (item == null)
+ throw new ArgumentNullException ("option");
+ if (item.Names != null && item.Names.Length > 0)
+ return item.Names [0];
+ // This should never happen, as it's invalid for Option to be
+ // constructed w/o any names.
+ throw new InvalidOperationException ("Option has no names!");
+ }
+
+ [Obsolete ("Use KeyedCollection.this[string]")]
+ protected Option GetOptionForName (string option)
+ {
+ if (option == null)
+ throw new ArgumentNullException ("option");
+ try {
+ return base [option];
+ }
+ catch (KeyNotFoundException) {
+ return null;
+ }
+ }
+
+ protected override void InsertItem (int index, Option item)
+ {
+ base.InsertItem (index, item);
+ AddImpl (item);
+ }
+
+ protected override void RemoveItem (int index)
+ {
+ base.RemoveItem (index);
+ Option p = Items [index];
+ // KeyedCollection.RemoveItem() handles the 0th item
+ for (int i = 1; i < p.Names.Length; ++i) {
+ Dictionary.Remove (p.Names [i]);
+ }
+ }
+
+ protected override void SetItem (int index, Option item)
+ {
+ base.SetItem (index, item);
+ RemoveItem (index);
+ AddImpl (item);
+ }
+
+ private void AddImpl (Option option)
+ {
+ if (option == null)
+ throw new ArgumentNullException ("option");
+ List<string> added = new List<string> (option.Names.Length);
+ try {
+ // KeyedCollection.InsertItem/SetItem handle the 0th name.
+ for (int i = 1; i < option.Names.Length; ++i) {
+ Dictionary.Add (option.Names [i], option);
+ added.Add (option.Names [i]);
+ }
+ }
+ catch (Exception) {
+ foreach (string name in added)
+ Dictionary.Remove (name);
+ throw;
+ }
+ }
+
+ public new OptionSet Add (Option option)
+ {
+ base.Add (option);
+ return this;
+ }
+
+ sealed class ActionOption : Option {
+ Action<OptionValueCollection> action;
+
+ public ActionOption (string prototype, string description, int count, Action<OptionValueCollection> action)
+ : base (prototype, description, count)
+ {
+ if (action == null)
+ throw new ArgumentNullException ("action");
+ this.action = action;
+ }
+
+ protected override void OnParseComplete (OptionContext c)
+ {
+ action (c.OptionValues);
+ }
+ }
+
+ public OptionSet Add (string prototype, Action<string> action)
+ {
+ return Add (prototype, null, action);
+ }
+
+ public OptionSet Add (string prototype, string description, Action<string> action)
+ {
+ if (action == null)
+ throw new ArgumentNullException ("action");
+ Option p = new ActionOption (prototype, description, 1,
+ delegate (OptionValueCollection v) { action (v [0]); });
+ base.Add (p);
+ return this;
+ }
+
+ public OptionSet Add (string prototype, OptionAction<string, string> action)
+ {
+ return Add (prototype, null, action);
+ }
+
+ public OptionSet Add (string prototype, string description, OptionAction<string, string> action)
+ {
+ if (action == null)
+ throw new ArgumentNullException ("action");
+ Option p = new ActionOption (prototype, description, 2,
+ delegate (OptionValueCollection v) {action (v [0], v [1]);});
+ base.Add (p);
+ return this;
+ }
+
+ sealed class ActionOption<T> : Option {
+ Action<T> action;
+
+ public ActionOption (string prototype, string description, Action<T> action)
+ : base (prototype, description, 1)
+ {
+ if (action == null)
+ throw new ArgumentNullException ("action");
+ this.action = action;
+ }
+
+ protected override void OnParseComplete (OptionContext c)
+ {
+ action (Parse<T> (c.OptionValues [0], c));
+ }
+ }
+
+ sealed class ActionOption<TKey, TValue> : Option {
+ OptionAction<TKey, TValue> action;
+
+ public ActionOption (string prototype, string description, OptionAction<TKey, TValue> action)
+ : base (prototype, description, 2)
+ {
+ if (action == null)
+ throw new ArgumentNullException ("action");
+ this.action = action;
+ }
+
+ protected override void OnParseComplete (OptionContext c)
+ {
+ action (
+ Parse<TKey> (c.OptionValues [0], c),
+ Parse<TValue> (c.OptionValues [1], c));
+ }
+ }
+
+ public OptionSet Add<T> (string prototype, Action<T> action)
+ {
+ return Add (prototype, null, action);
+ }
+
+ public OptionSet Add<T> (string prototype, string description, Action<T> action)
+ {
+ return Add (new ActionOption<T> (prototype, description, action));
+ }
+
+ public OptionSet Add<TKey, TValue> (string prototype, OptionAction<TKey, TValue> action)
+ {
+ return Add (prototype, null, action);
+ }
+
+ public OptionSet Add<TKey, TValue> (string prototype, string description, OptionAction<TKey, TValue> action)
+ {
+ return Add (new ActionOption<TKey, TValue> (prototype, description, action));
+ }
+
+ protected virtual OptionContext CreateOptionContext ()
+ {
+ return new OptionContext (this);
+ }
+
+#if LINQ
+ public List<string> Parse (IEnumerable<string> arguments)
+ {
+ bool process = true;
+ OptionContext c = CreateOptionContext ();
+ c.OptionIndex = -1;
+ var def = GetOptionForName ("<>");
+ var unprocessed =
+ from argument in arguments
+ where ++c.OptionIndex >= 0 && (process || def != null)
+ ? process
+ ? argument == "--"
+ ? (process = false)
+ : !Parse (argument, c)
+ ? def != null
+ ? Unprocessed (null, def, c, argument)
+ : true
+ : false
+ : def != null
+ ? Unprocessed (null, def, c, argument)
+ : true
+ : true
+ select argument;
+ List<string> r = unprocessed.ToList ();
+ if (c.Option != null)
+ c.Option.Invoke (c);
+ return r;
+ }
+#else
+ public List<string> Parse (IEnumerable<string> arguments)
+ {
+ OptionContext c = CreateOptionContext ();
+ c.OptionIndex = -1;
+ bool process = true;
+ List<string> unprocessed = new List<string> ();
+ Option def = Contains ("<>") ? this ["<>"] : null;
+ foreach (string argument in arguments) {
+ ++c.OptionIndex;
+ if (argument == "--") {
+ process = false;
+ continue;
+ }
+ if (!process) {
+ Unprocessed (unprocessed, def, c, argument);
+ continue;
+ }
+ if (!Parse (argument, c))
+ Unprocessed (unprocessed, def, c, argument);
+ }
+ if (c.Option != null)
+ c.Option.Invoke (c);
+ return unprocessed;
+ }
+#endif
+
+ private static bool Unprocessed (ICollection<string> extra, Option def, OptionContext c, string argument)
+ {
+ if (def == null) {
+ extra.Add (argument);
+ return false;
+ }
+ c.OptionValues.Add (argument);
+ c.Option = def;
+ c.Option.Invoke (c);
+ return false;
+ }
+
+ private readonly Regex ValueOption = new Regex (
+ @"^(?<flag>--|-|/)(?<name>[^:=]+)((?<sep>[:=])(?<value>.*))?$");
+
+ protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value)
+ {
+ if (argument == null)
+ throw new ArgumentNullException ("argument");
+
+ flag = name = sep = value = null;
+ Match m = ValueOption.Match (argument);
+ if (!m.Success) {
+ return false;
+ }
+ flag = m.Groups ["flag"].Value;
+ name = m.Groups ["name"].Value;
+ if (m.Groups ["sep"].Success && m.Groups ["value"].Success) {
+ sep = m.Groups ["sep"].Value;
+ value = m.Groups ["value"].Value;
+ }
+ return true;
+ }
+
+ protected virtual bool Parse (string argument, OptionContext c)
+ {
+ if (c.Option != null) {
+ ParseValue (argument, c);
+ return true;
+ }
+
+ string f, n, s, v;
+ if (!GetOptionParts (argument, out f, out n, out s, out v))
+ return false;
+
+ Option p;
+ if (Contains (n)) {
+ p = this [n];
+ c.OptionName = f + n;
+ c.Option = p;
+ switch (p.OptionValueType) {
+ case OptionValueType.None:
+ c.OptionValues.Add (n);
+ c.Option.Invoke (c);
+ break;
+ case OptionValueType.Optional:
+ case OptionValueType.Required:
+ ParseValue (v, c);
+ break;
+ }
+ return true;
+ }
+ // no match; is it a bool option?
+ if (ParseBool (argument, n, c))
+ return true;
+ // is it a bundled option?
+ if (ParseBundledValue (f, string.Concat (n + s + v), c))
+ return true;
+
+ return false;
+ }
+
+ private void ParseValue (string option, OptionContext c)
+ {
+ if (option != null)
+ foreach (string o in c.Option.ValueSeparators != null
+ ? option.Split (c.Option.ValueSeparators, StringSplitOptions.None)
+ : new string[]{option}) {
+ c.OptionValues.Add (o);
+ }
+ if (c.OptionValues.Count == c.Option.MaxValueCount ||
+ c.Option.OptionValueType == OptionValueType.Optional)
+ c.Option.Invoke (c);
+ else if (c.OptionValues.Count > c.Option.MaxValueCount) {
+ throw new OptionException (localizer (string.Format (
+ "Error: Found {0} option values when expecting {1}.",
+ c.OptionValues.Count, c.Option.MaxValueCount)),
+ c.OptionName);
+ }
+ }
+
+ private bool ParseBool (string option, string n, OptionContext c)
+ {
+ Option p;
+ string rn;
+ if (n.Length >= 1 && (n [n.Length-1] == '+' || n [n.Length-1] == '-') &&
+ Contains ((rn = n.Substring (0, n.Length-1)))) {
+ p = this [rn];
+ string v = n [n.Length-1] == '+' ? option : null;
+ c.OptionName = option;
+ c.Option = p;
+ c.OptionValues.Add (v);
+ p.Invoke (c);
+ return true;
+ }
+ return false;
+ }
+
+ private bool ParseBundledValue (string f, string n, OptionContext c)
+ {
+ if (f != "-")
+ return false;
+ for (int i = 0; i < n.Length; ++i) {
+ Option p;
+ string opt = f + n [i].ToString ();
+ string rn = n [i].ToString ();
+ if (!Contains (rn)) {
+ if (i == 0)
+ return false;
+ throw new OptionException (string.Format (localizer (
+ "Cannot bundle unregistered option '{0}'."), opt), opt);
+ }
+ p = this [rn];
+ switch (p.OptionValueType) {
+ case OptionValueType.None:
+ Invoke (c, opt, n, p);
+ break;
+ case OptionValueType.Optional:
+ case OptionValueType.Required: {
+ string v = n.Substring (i+1);
+ c.Option = p;
+ c.OptionName = opt;
+ ParseValue (v.Length != 0 ? v : null, c);
+ return true;
+ }
+ default:
+ throw new InvalidOperationException ("Unknown OptionValueType: " + p.OptionValueType);
+ }
+ }
+ return true;
+ }
+
+ private static void Invoke (OptionContext c, string name, string value, Option option)
+ {
+ c.OptionName = name;
+ c.Option = option;
+ c.OptionValues.Add (value);
+ option.Invoke (c);
+ }
+
+ private const int OptionWidth = 29;
+
+ public void WriteOptionDescriptions (TextWriter o)
+ {
+ foreach (Option p in this) {
+ int written = 0;
+ if (!WriteOptionPrototype (o, p, ref written))
+ continue;
+
+ if (written < OptionWidth)
+ o.Write (new string (' ', OptionWidth - written));
+ else {
+ o.WriteLine ();
+ o.Write (new string (' ', OptionWidth));
+ }
+
+ List<string> lines = GetLines (localizer (GetDescription (p.Description)));
+ o.WriteLine (lines [0]);
+ string prefix = new string (' ', OptionWidth+2);
+ for (int i = 1; i < lines.Count; ++i) {
+ o.Write (prefix);
+ o.WriteLine (lines [i]);
+ }
+ }
+ }
+
+ bool WriteOptionPrototype (TextWriter o, Option p, ref int written)
+ {
+ string[] names = p.Names;
+
+ int i = GetNextOptionIndex (names, 0);
+ if (i == names.Length)
+ return false;
+
+ if (names [i].Length == 1) {
+ Write (o, ref written, " -");
+ Write (o, ref written, names [0]);
+ }
+ else {
+ Write (o, ref written, " --");
+ Write (o, ref written, names [0]);
+ }
+
+ for ( i = GetNextOptionIndex (names, i+1);
+ i < names.Length; i = GetNextOptionIndex (names, i+1)) {
+ Write (o, ref written, ", ");
+ Write (o, ref written, names [i].Length == 1 ? "-" : "--");
+ Write (o, ref written, names [i]);
+ }
+
+ if (p.OptionValueType == OptionValueType.Optional ||
+ p.OptionValueType == OptionValueType.Required) {
+ if (p.OptionValueType == OptionValueType.Optional) {
+ Write (o, ref written, localizer ("["));
+ }
+ Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description)));
+ string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0
+ ? p.ValueSeparators [0]
+ : " ";
+ for (int c = 1; c < p.MaxValueCount; ++c) {
+ Write (o, ref written, localizer (sep + GetArgumentName (c, p.MaxValueCount, p.Description)));
+ }
+ if (p.OptionValueType == OptionValueType.Optional) {
+ Write (o, ref written, localizer ("]"));
+ }
+ }
+ return true;
+ }
+
+ static int GetNextOptionIndex (string[] names, int i)
+ {
+ while (i < names.Length && names [i] == "<>") {
+ ++i;
+ }
+ return i;
+ }
+
+ static void Write (TextWriter o, ref int n, string s)
+ {
+ n += s.Length;
+ o.Write (s);
+ }
+
+ private static string GetArgumentName (int index, int maxIndex, string description)
+ {
+ if (description == null)
+ return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1);
+ string[] nameStart;
+ if (maxIndex == 1)
+ nameStart = new string[]{"{0:", "{"};
+ else
+ nameStart = new string[]{"{" + index + ":"};
+ for (int i = 0; i < nameStart.Length; ++i) {
+ int start, j = 0;
+ do {
+ start = description.IndexOf (nameStart [i], j);
+ } while (start >= 0 && j != 0 ? description [j++ - 1] == '{' : false);
+ if (start == -1)
+ continue;
+ int end = description.IndexOf ("}", start);
+ if (end == -1)
+ continue;
+ return description.Substring (start + nameStart [i].Length, end - start - nameStart [i].Length);
+ }
+ return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1);
+ }
+
+ private static string GetDescription (string description)
+ {
+ if (description == null)
+ return string.Empty;
+ StringBuilder sb = new StringBuilder (description.Length);
+ int start = -1;
+ for (int i = 0; i < description.Length; ++i) {
+ switch (description [i]) {
+ case '{':
+ if (i == start) {
+ sb.Append ('{');
+ start = -1;
+ }
+ else if (start < 0)
+ start = i + 1;
+ break;
+ case '}':
+ if (start < 0) {
+ if ((i+1) == description.Length || description [i+1] != '}')
+ throw new InvalidOperationException ("Invalid option description: " + description);
+ ++i;
+ sb.Append ("}");
+ }
+ else {
+ sb.Append (description.Substring (start, i - start));
+ start = -1;
+ }
+ break;
+ case ':':
+ if (start < 0)
+ goto default;
+ start = i + 1;
+ break;
+ default:
+ if (start < 0)
+ sb.Append (description [i]);
+ break;
+ }
+ }
+ return sb.ToString ();
+ }
+
+ private static List<string> GetLines (string description)
+ {
+ List<string> lines = new List<string> ();
+ if (string.IsNullOrEmpty (description)) {
+ lines.Add (string.Empty);
+ return lines;
+ }
+ int length = 80 - OptionWidth - 2;
+ int start = 0, end;
+ do {
+ end = GetLineEnd (start, length, description);
+ bool cont = false;
+ if (end < description.Length) {
+ char c = description [end];
+ if (c == '-' || (char.IsWhiteSpace (c) && c != '\n'))
+ ++end;
+ else if (c != '\n') {
+ cont = true;
+ --end;
+ }
+ }
+ lines.Add (description.Substring (start, end - start));
+ if (cont) {
+ lines [lines.Count-1] += "-";
+ }
+ start = end;
+ if (start < description.Length && description [start] == '\n')
+ ++start;
+ } while (end < description.Length);
+ return lines;
+ }
+
+ private static int GetLineEnd (int start, int length, string description)
+ {
+ int end = System.Math.Min (start + length, description.Length);
+ int sep = -1;
+ for (int i = start; i < end; ++i) {
+ switch (description [i]) {
+ case ' ':
+ case '\t':
+ case '\v':
+ case '-':
+ case ',':
+ case '.':
+ case ';':
+ sep = i;
+ break;
+ case '\n':
+ return i;
+ }
+ }
+ if (sep == -1 || end == description.Length)
+ return end;
+ return sep;
+ }
+ }
+}
+
diff --git a/main/src/addins/TextTemplating/TextTransform/TextTransform.cs b/main/src/addins/TextTemplating/TextTransform/TextTransform.cs
new file mode 100644
index 0000000000..a3baa243ea
--- /dev/null
+++ b/main/src/addins/TextTemplating/TextTransform/TextTransform.cs
@@ -0,0 +1,107 @@
+//
+// Main.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using Mono.Options;
+
+namespace Mono.TextTemplating
+{
+ class TextTransform
+ {
+ static OptionSet optionSet;
+ const string name ="TextTransform.exe";
+
+ public static int Main (string[] args)
+ {
+ if (args.Length == 0) {
+ ShowHelp (true);
+ }
+
+ TemplateGenerator generator = new TemplateGenerator ();
+ string outputFile = null, inputFile = null;
+
+ optionSet = new OptionSet () {
+ { "o=|out=", "The name of the output {file}", s => outputFile = s },
+ { "r=", "Assemblies to reference", s => generator.Refs.Add (s) },
+ { "u=", "Namespaces to import <{0:namespace}>", s => generator.Imports.Add (s) },
+ { "I=", "Paths to search for included files", s => generator.IncludePaths.Add (s) },
+ { "P=", "Paths to search for referenced assemblies", s => generator.ReferencePaths.Add (s) },
+ { "dp=", "Directive processor name!class!assembly", s => generator.DirectiveProcessors.Add (s) },
+ { "a=", "Key value pairs for directive processors", (s, p) => generator.ProcessorValues[s] = p },
+ { "h|?|help", "Show help", s => ShowHelp (false) }
+ };
+
+ List<string> remainingArgs = optionSet.Parse (args);
+
+ if (String.IsNullOrEmpty (outputFile)) {
+ Console.WriteLine ("No output file specified.");
+ return -1;
+ }
+
+ if (remainingArgs.Count != 1) {
+ Console.WriteLine ("No input file specified.");
+ return -1;
+ }
+ inputFile = remainingArgs [0];
+
+ if (!File.Exists (inputFile)) {
+ Console.WriteLine ("Input file '{0}' does not exist.");
+ return -1;
+ }
+
+ System.Console.Write("Processing '{0}'... ", inputFile);
+ generator.ProcessTemplate (inputFile, outputFile);
+
+ if (generator.Errors.HasErrors) {
+ System.Console.WriteLine("failed.");
+ } else {
+ System.Console.WriteLine("completed successfully.");
+ }
+
+ foreach (System.CodeDom.Compiler.CompilerError err in generator.Errors)
+ Console.WriteLine ("{0}({1},{2}): {3} {4}", err.FileName, err.Line, err.Column,
+ err.IsWarning? "WARNING" : "ERROR", err.ErrorText);
+
+ return generator.Errors.HasErrors? -1 : 0;
+ }
+
+ static void ShowHelp (bool concise)
+ {
+ Console.WriteLine ("TextTransform command line T4 processor");
+ Console.WriteLine ("Usage: {0} [options] input-file", name);
+ if (concise) {
+ Console.WriteLine ("Use --help to display options.");
+ } else {
+ Console.WriteLine ("Options:");
+ optionSet.WriteOptionDescriptions (System.Console.Out);
+ }
+ Console.WriteLine ();
+ Environment.Exit (0);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/TextTemplating/TextTransform/TextTransform.csproj b/main/src/addins/TextTemplating/TextTransform/TextTransform.csproj
new file mode 100644
index 0000000000..dc544e2e98
--- /dev/null
+++ b/main/src/addins/TextTemplating/TextTransform/TextTransform.csproj
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{D1D35409-C814-47F6-B038-B9B5BF0FE490}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AssemblyName>TextTransform</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <RootNamespace>Mono.TextTemplating</RootNamespace>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <Commandlineparameters>-o:out.txt in.tt</Commandlineparameters>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="TextTransform.cs" />
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="Options.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Mono.TextTemplating\Mono.TextTemplating.csproj">
+ <Project>{A2364D6A-00EF-417C-80A6-815726C70032}</Project>
+ <Name>Mono.TextTemplating</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ProjectExtensions>
+ <MonoDevelop>
+ <Properties>
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="true" IsAutotoolsProject="true" RelativeConfigureInPath="../../../..">
+ <BuildFilesVar Sync="true" Name="FILES" />
+ <DeployFilesVar />
+ <ResourcesVar Sync="true" Name="RES" />
+ <OthersVar />
+ <GacRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <AsmRefVar Sync="true" Name="REFS" Prefix="-r:" />
+ <ProjectRefVar Sync="true" Name="DEPS" />
+ </MonoDevelop.Autotools.MakefileInfo>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project> \ No newline at end of file
diff --git a/profiles/all b/profiles/all
index 0f2f493e83..99b52bbe81 100644
--- a/profiles/all
+++ b/profiles/all
@@ -12,6 +12,5 @@ extras/MonoDevelop.CodeAnalysis
extras/MonoDevelop.Debugger.Mdb
extras/MonoDevelop.Debugger.Gdb
extras/PyBinding
-extras/MonoDevelop.AspNet.Mvc
extras/MonoDevelop.IPhone