~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/addins/AspNetAddIn/Project/AspNetDisplayBinding.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
using System;
3
 
 
4
 
using MonoDevelop.Ide.Codons;
5
 
using MonoDevelop.Ide.Gui;
6
 
 
7
 
namespace AspNetAddIn
8
 
{
9
 
        
10
 
        
11
 
        public class AspNetDisplayBinding : IDisplayBinding
12
 
        {
13
 
                
14
 
                public string DisplayName {
15
 
                        get { return "ASP.NET Source"; }
16
 
                }
17
 
                
18
 
 
19
 
                public bool CanCreateContentForFile(string fileName)
20
 
                {                       
21
 
                        WebSubtype type = AspNetAppProject.DetermineWebSubtype (System.IO.Path.GetExtension (fileName));
22
 
                        
23
 
                        switch (type) {
24
 
                                case WebSubtype.WebForm:
25
 
                                case WebSubtype.WebControl:
26
 
                                case WebSubtype.WebHandler:
27
 
                                case WebSubtype.WebService:
28
 
                                case WebSubtype.MasterPage:     
29
 
                                        IDisplayBinding db = IdeApp.Workbench.DisplayBindings.GetBindingForMimeType ("text");
30
 
                                        return (db != null);
31
 
                                default:
32
 
                                        return false;
33
 
                        }
34
 
                }
35
 
 
36
 
                public bool CanCreateContentForMimeType (string mimetype)
37
 
                {
38
 
                        switch (mimetype) {
39
 
                                case "application/x-aspx":
40
 
                                case "application/x-ascx":
41
 
                                case "application/x-asmx":
42
 
                                case "application/x-ashx":
43
 
                                case "application/x-asax":
44
 
                                case "application/x-master-page":
45
 
                                        return true;
46
 
                                default:
47
 
                                        return false;
48
 
                        }
49
 
                }
50
 
                
51
 
                public IViewContent CreateContentForFile (string fileName)
52
 
                {
53
 
                        IDisplayBinding db = IdeApp.Workbench.DisplayBindings.GetBindingForMimeType ("text/plain");
54
 
                        return db.CreateContentForFile (fileName);
55
 
                }
56
 
                
57
 
                public IViewContent CreateContentForMimeType (string mimeType, System.IO.Stream content)
58
 
                {
59
 
                        //SourceEditor AddIn won't open won't the web application mimetypes directly
60
 
                        IDisplayBinding db = IdeApp.Workbench.DisplayBindings.GetBindingForMimeType ("text/plain");
61
 
                        return db.CreateContentForMimeType ("text/plain", content);
62
 
                }
63
 
                
64
 
                
65
 
        }
66
 
}