Exemplo n.º 1
0
		//
		// NOTE: MS' documentation for directives is at http://msdn.microsoft.com/en-us/library/t8syafc7.aspx
		//
		// FIXME: gettextise this
		public static CompletionDataList GetDirectives (WebSubtype type)
		{
			CompletionDataList list = new CompletionDataList ();
			
			if (type == WebSubtype.WebForm) {
				list.Add ("Implements", null, "Declare that this page implements an interface.");
				list.Add ("Page", null, "Define properties of this page.");
				list.Add ("PreviousPageType", null, "Strongly type the page's PreviousPage property.");
				list.Add ("MasterType", null, "Strongly type the page's Master property.");
			} else if (type == WebSubtype.MasterPage) {
				list.Add ("Implements", null, "Declare that this master page implements an interface.");
				list.Add ("Master", null, "Define properties of this master page.");
				list.Add ("MasterType", null, "Strongly type the page's Master property.");
			} else if (type == WebSubtype.WebControl) {
				list.Add ("Control", null, "Define properties of this user control.");
				list.Add ("Implements", null, "Declare that this control implements an interface.");
			} else {
				return null;
			}
			
			list.Add ("Assembly", null, "Reference an assembly.");
			list.Add ("Import", null, "Import a namespace.");
			
			if (type != WebSubtype.MasterPage) {
				list.Add ("OutputCache", null, "Set output caching behaviour.");
			}
			
			list.Add ("Reference", null, "Reference a page or user control.");
			list.Add ("Register", null, "Register a user control or custom web controls.");
			
			return list.Count > 0? list : null;
		}
		public AspNetParsedDocument (string fileName, WebSubtype type, RootNode rootNode, PageInfo info) : base (fileName)
		{
			Flags |= ParsedDocumentFlags.NonSerializable;
			Info = info;
			RootNode = rootNode;
			Type = type;
		}
Exemplo n.º 3
0
		// Constructor used for testing the XDOM
		public AspNetParsedDocument (string fileName, WebSubtype type, PageInfo info, XDocument xDoc) : 
			base (fileName)
		{
			Flags |= ParsedDocumentFlags.NonSerializable;
			Info = info;
			Type = type;
			XDocument = xDoc;
		}
			void SetSubtype (WebSubtype type, DirectiveNode node)
			{
				if (info.Subtype != WebSubtype.None) {
					Add (ErrorType.Error, node, "Unexpected directive {0}", node.Name);
					return;
				}
				
				info.Subtype = type;
				
				if (node.Attributes == null)
					return;
				
				info.InheritedClass = node.Attributes ["inherits"] as string;
				if (info.ClassName == null)
					info.ClassName = node.Attributes ["classname"] as string;
				info.CodeBehindFile = node.Attributes ["codebehind"] as string;
				info.Language = node.Attributes ["language"] as string;
				info.CodeFile = node.Attributes ["codefile"] as string;
			}
		static string GetDefaultBaseClass (WebSubtype type)
		{
			switch (type) {
			case WebSubtype.WebForm:
				return "System.Web.UI.Page";
			case WebSubtype.MasterPage:
				return "System.Web.UI.MasterPage";
			case WebSubtype.WebControl:
				return "System.Web.UI.UserControl";
			}
			throw new InvalidOperationException (string.Format ("Unexpected filetype '{0}'", type));
		}
Exemplo n.º 6
0
		void SetSubtype (WebSubtype type, WebFormsDirective directive, List<Error> errors)
		{
			if (Subtype != WebSubtype.None) {
				errors.Add (new Error (ErrorType.Error, GettextCatalog.GetString ("Unexpected directive {0}", directive.Name.FullName), directive.Region));
				return;
			}
			
			Subtype = type;
						
			InheritedClass = GetAttributeValueCI (directive.Attributes, "inherits");
			if (ClassName == null)
				ClassName = GetAttributeValueCI (directive.Attributes, "classname");
			CodeBehindFile = GetAttributeValueCI (directive.Attributes, "codebehind");
			Language = GetAttributeValueCI (directive.Attributes, "language");
			CodeFile = GetAttributeValueCI (directive.Attributes, "codefile");
		}