Author: mhutch
Date: 2007-09-11 12:03:02 -0400 (Tue, 11 Sep 2007)
New Revision: 85644

Added:
   trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetCommands.cs
   
trunk/monodevelop/Extras/AspNetAddIn/Project/ProjectFolderNodeBuilderExtension.cs
Modified:
   trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.addin.xml
   trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.mdp
   trunk/monodevelop/Extras/AspNetAddIn/ChangeLog
   trunk/monodevelop/Extras/AspNetAddIn/Makefile.am
   trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetAppProject.cs
   trunk/monodevelop/Extras/AspNetAddIn/Project/VerifyCodeBehindBuildStep.cs
Log:
* Project/ProjectFolderNodeBuilderExtension.cs,
  Project/AspNetCommands.cs, AspNetAddIn.addin.xml, AspNetAddIn.mdp,
  Makefile.am: Add a command/menu for creating ASP.NET special
  directories.
* Project/AspNetAppProject.cs: Add more WebSubtypes. Use GettextCatalog
  for MessageService call. Add method for discovering non-existent
  special ASP.NET directories.
* Project/VerifyCodeBehindBuildStep.cs: Don't prevent compilation if
  documents can't be parsed.

Modified: trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.addin.xml
===================================================================
--- trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.addin.xml  2007-09-11 
16:01:53 UTC (rev 85643)
+++ trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.addin.xml  2007-09-11 
16:03:02 UTC (rev 85644)
@@ -121,4 +121,26 @@
                <Class class = "AspNetAddIn.VerifyCodeBehindBuildStep" />
        </Extension>
        
+       <Extension path = "/MonoDevelop/Ide/Commands">
+               <Category _name = "ASP.NET" id = "AspNet">
+               <Command id = "AspNetAddIn.AspNetCommands.AddAspNetDirectory"
+                               _label = "ASP.NET Directory"
+                               type="array" />
+               </Category>
+       </Extension>
+       
+       <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Project/Add">
+               <Condition id="activeproject" value="AspNetApp">
+                       <ItemSet id = "AspNetDirectories" _label = "ASP.NET 
Directory" insertafter = "MonoDevelop.Ide.Commands.ProjectCommands.NewFolder" 
autohide="True">
+                               <CommandItem
+                                       id = 
"AspNetAddIn.AspNetCommands.AddAspNetDirectory"
+                                       />
+                               </ItemSet>
+               </Condition>
+       </Extension>
+       
+       <Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
+               <NodeBuilder id="AspNetAddIn.ProjectFolderNodeBuilderExtension" 
class = "AspNetAddIn.ProjectFolderNodeBuilderExtension"/>
+       </Extension>
+       
 </Addin>

Modified: trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.mdp
===================================================================
--- trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.mdp        2007-09-11 
16:01:53 UTC (rev 85643)
+++ trunk/monodevelop/Extras/AspNetAddIn/AspNetAddIn.mdp        2007-09-11 
16:03:02 UTC (rev 85644)
@@ -76,6 +76,8 @@
     <File name="./Templates/WebApplication-Empty.xpt.xml" subtype="Code" 
buildaction="EmbedAsResource" />
     <File name="./Templates/WebConfig-Application.xft.xml" subtype="Code" 
buildaction="EmbedAsResource" />
     <File name="./Templates/WebConfig-SubDir.xft.xml" subtype="Code" 
buildaction="EmbedAsResource" />
+    <File name="./Project/ProjectFolderNodeBuilderExtension.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="./Project/AspNetCommands.cs" subtype="Code" 
buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="False" 
refto="MonoDevelop.Components" />

Modified: trunk/monodevelop/Extras/AspNetAddIn/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/AspNetAddIn/ChangeLog      2007-09-11 16:01:53 UTC 
(rev 85643)
+++ trunk/monodevelop/Extras/AspNetAddIn/ChangeLog      2007-09-11 16:03:02 UTC 
(rev 85644)
@@ -1,3 +1,14 @@
+2007-09-11  Michael Hutchinson <[EMAIL PROTECTED]> 
+
+       * Project/ProjectFolderNodeBuilderExtension.cs, 
Project/AspNetCommands.cs,
+         AspNetAddIn.addin.xml, AspNetAddIn.mdp, Makefile.am: Add a 
command/menu
+         for creating ASP.NET special directories.
+       * Project/AspNetAppProject.cs: Add more WebSubtypes. Use GettextCatalog 
for
+         MessageService call. Add method for discovering non-existent special
+         ASP.NET directories.
+       * Project/VerifyCodeBehindBuildStep.cs: Don't prevent compilation if
+         documents can't be parsed.
+
 2007-09-10  Michael Hutchinson <[EMAIL PROTECTED]> 
 
        * Project/AspNetAppProject.cs: Fire SetDefaultBuildAction only when 
adding

Modified: trunk/monodevelop/Extras/AspNetAddIn/Makefile.am
===================================================================
--- trunk/monodevelop/Extras/AspNetAddIn/Makefile.am    2007-09-11 16:01:53 UTC 
(rev 85643)
+++ trunk/monodevelop/Extras/AspNetAddIn/Makefile.am    2007-09-11 16:03:02 UTC 
(rev 85644)
@@ -54,9 +54,11 @@
        Project/AspNetAppProjectBinding.cs \
        Project/AspNetAppProjectConfiguration.cs \
        Project/AspNetCodeBehindProvider.cs \
+       Project/AspNetCommands.cs \
        Project/AspNetDisplayBinding.cs \
        Project/AspNetFileDescriptionTemplate.cs \
        Project/CodeBehind.cs \
+       Project/ProjectFolderNodeBuilderExtension.cs \
        Project/VerifyCodeBehindBuildStep.cs \
        Project/XspParameters.cs
 

Modified: trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetAppProject.cs
===================================================================
--- trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetAppProject.cs    
2007-09-11 16:01:53 UTC (rev 85643)
+++ trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetAppProject.cs    
2007-09-11 16:03:02 UTC (rev 85644)
@@ -275,8 +275,14 @@
                                        return WebSubtype.WebImage;
                                case "skin":
                                        return WebSubtype.WebSkin;
-                       case "config":
+                               case "config":
                                        return WebSubtype.Config;
+                               case "browser":
+                                       return WebSubtype.BrowserDefinition;
+                               case "axd":
+                                       return WebSubtype.Axd;
+                               case "sitemap":
+                                       return WebSubtype.Sitemap;
                                default:
                                        return WebSubtype.None;
                        }
@@ -319,7 +325,7 @@
                                                
                                        //last request has failed so show user 
the error
                                        } else if (i >= (noOfRequests - 1)) {
-                                               string message = String.Format 
("Could not connect to webserver {0}", url);
+                                               string message = 
GettextCatalog.GetString ("Could not connect to webserver {0}", url);
                                                
MonoDevelop.Ide.Gui.IdeApp.Services.MessageService.ShowError (exp, message);
                                                
                                        //we still have requests to go, so 
cancel the current one and sleep for a bit
@@ -380,6 +386,29 @@
                }
                
                #endregion
+               
+               public List<string> GetNotPresentSpecialDirectories ()
+               {
+                       List<string> notPresent = new List<string> ();
+                       
+                       if (ClrVersion == MonoDevelop.Core.ClrVersion.Net_2_0)
+                               foreach (string dir in specialDirs20)
+                                       if (ProjectFiles.GetFile (Path.Combine 
(BaseDirectory, dir)) == null)
+                                               notPresent.Add (dir);
+                       
+                       return notPresent;
+               }
+       
+               static readonly string [] specialDirs20 = new string [] {
+                       "App_Code",
+                       "App_Themes",
+                       "App_Browsers",
+                       "App_Data",
+                       "App_WebReferences",
+                       "App_Resources",
+                       "App_LocalResources",
+                       "App_GlobalResources",          
+               };
        }
        
        public enum WebSubtype
@@ -393,15 +422,12 @@
                WebHandler,
                WebSkin,
                WebImage,
+               BrowserDefinition,
+               Sitemap,
                Global,
                Config,
+               Axd,
        }
        
-       public enum SpecialFiles
-       {
-       }
        
-       public enum SpecialFiles20
-       {
-       }
 }

Added: trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetCommands.cs
===================================================================
--- trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetCommands.cs      
2007-09-11 16:01:53 UTC (rev 85643)
+++ trunk/monodevelop/Extras/AspNetAddIn/Project/AspNetCommands.cs      
2007-09-11 16:03:02 UTC (rev 85644)
@@ -0,0 +1,38 @@
+// AspNetCommands.cs
+// 
+// Author:
+//   Michael Hutchinson <[EMAIL PROTECTED]>
+// 
+// Copyright (C) 2007 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;
+
+namespace AspNetAddIn
+{
+       
+       public enum AspNetCommands
+       {
+               AddAspNetDirectory,
+       }
+}

Added: 
trunk/monodevelop/Extras/AspNetAddIn/Project/ProjectFolderNodeBuilderExtension.cs
===================================================================
--- 
trunk/monodevelop/Extras/AspNetAddIn/Project/ProjectFolderNodeBuilderExtension.cs
   2007-09-11 16:01:53 UTC (rev 85643)
+++ 
trunk/monodevelop/Extras/AspNetAddIn/Project/ProjectFolderNodeBuilderExtension.cs
   2007-09-11 16:03:02 UTC (rev 85644)
@@ -0,0 +1,78 @@
+// ProjectFolderNodeBuilderExtension.cs
+//
+// Author:
+//   Michael Hutchinson <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 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;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Gui.Pads;
+using MonoDevelop.Ide.Gui.Pads.ProjectPad;
+using MonoDevelop.Components.Commands;
+
+namespace AspNetAddIn
+{
+       
+       public class ProjectFolderNodeBuilderExtension: NodeBuilderExtension
+       {
+               public override bool CanBuildNode (Type dataType)
+               {
+                       return typeof(ProjectFolder).IsAssignableFrom 
(dataType) ||
+                                       typeof(Project).IsAssignableFrom 
(dataType);
+               }
+               
+               public override Type CommandHandlerType {
+                       get { return typeof (ProjectFolderCommandHandler); }
+               }
+       }
+       
+       class ProjectFolderCommandHandler: NodeCommandHandler
+       {
+               
+               [CommandHandler (AspNetAddIn.AspNetCommands.AddAspNetDirectory)]
+               public void OnAddSpecialDirectory (object ob)
+               {
+                       AspNetAppProject proj = CurrentNode.DataItem as 
AspNetAppProject;
+                       if (proj == null)
+                               return;
+                       proj.AddDirectory ((string) ob);
+               }
+               
+               [CommandUpdateHandler 
(AspNetAddIn.AspNetCommands.AddAspNetDirectory)]
+               public void OnAddSpecialDirectoryUpdate (CommandArrayInfo info)
+               {
+                       AspNetAppProject proj = CurrentNode.DataItem as 
AspNetAppProject;
+                       if (proj == null)
+                               return;
+                       
+                       foreach (string dir in 
proj.GetNotPresentSpecialDirectories ())
+                               info.Add (dir.Replace("_", "__"), dir);         
+               }
+       }
+       
+       
+}

Modified: 
trunk/monodevelop/Extras/AspNetAddIn/Project/VerifyCodeBehindBuildStep.cs
===================================================================
--- trunk/monodevelop/Extras/AspNetAddIn/Project/VerifyCodeBehindBuildStep.cs   
2007-09-11 16:01:53 UTC (rev 85643)
+++ trunk/monodevelop/Extras/AspNetAddIn/Project/VerifyCodeBehindBuildStep.cs   
2007-09-11 16:03:02 UTC (rev 85644)
@@ -64,16 +64,21 @@
 
                                //if (File.GetLastWriteTime 
(cls.Region.FileName) >= File.GetLastWriteTime (file.FilePath)) {
                                
+                               Document doc = null; 
+                               try {
+                                       doc = aspProject.GetDocument (file);
+                               } catch (Exception e) {
+                                       monitor.ReportWarning 
(string.Format("Parser failed on {0} with error {1}. Codebehind members for 
this file will not be added.", file, e.ToString ()));
+                               }
                                
-                               
-                               Document doc = aspProject.GetDocument (file);
-                               
-                               foreach (System.CodeDom.CodeMemberField member 
in doc.MemberList.List.Values) {
+                               if (doc != null) {
+                                       foreach (System.CodeDom.CodeMemberField 
member in doc.MemberList.List.Values) {
                                                
MonoDevelop.Projects.Parser.IMember existingMember = 
BindingService.GetCompatibleMemberInClass (cls, member);
                                                if (existingMember == null) {
                                                        classesForMembers.Add 
(cls);
                                                        membersToAdd.Add 
(member);
                                                }
+                                       }
                                }
                        }
                        

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to