public override ItemToolboxNode GetNode (Type t, ToolboxItemAttribute tba, 
		    string attributeCategory, string fullPath, ClrVersion referencedRuntime)
		{
			if (referencedRuntime != ClrVersion.Net_1_1
			    && referencedRuntime != ClrVersion.Net_2_0)
				return null;
			
			bool reflectedRuntime1;
			if (typeof (System.Web.UI.Control).IsAssignableFrom (t))
				reflectedRuntime1 = false;
			else if (CanRuntime1 && SWUControl1.IsAssignableFrom (t))
				reflectedRuntime1 = true;
			else
				return null;
			
			Type toolboxItemType = (tba.ToolboxItemType == null) ? typeof (ToolboxItem) : tba.ToolboxItemType;
			
			//FIXME: fix WebControlToolboxItem so that this isn't necessary
			//right now it's totally broken in mono
			if (typeof (System.Web.UI.Design.WebControlToolboxItem).IsAssignableFrom (toolboxItemType))
				toolboxItemType = typeof (ToolboxItem);
			
			//Create the ToolboxItem. The ToolboxItemToolboxNode will destroy it, but need to
			//be able to extract data from it first.
			ToolboxItem item = (ToolboxItem) Activator.CreateInstance (toolboxItemType, new object[] {t});
			WebFormsToolboxNode node = new WebFormsToolboxNode (item);
			
			//get the default markup for the tag
			string webText = reflectedRuntime1? GetWebText1 (t) : GetWebText (t);
			if (!string.IsNullOrEmpty (webText))
				node.Text = webText;
			
			if (!string.IsNullOrEmpty (attributeCategory))
				node.Category = attributeCategory;
			else if (reflectedRuntime1)
				node.Category = GuessCategory1 (t);
			else
				node.Category = GuessCategory (t);
			
			if (!string.IsNullOrEmpty (fullPath))
				node.Type.AssemblyLocation = fullPath;
			
			//prevent system.web 1.1 from being shown for 2.0 runtime
			if (CanRuntime1 && webAssem1.FullName == t.Assembly.FullName) {
				node.ItemFilters.Add (new ToolboxItemFilterAttribute ("ClrVersion.Net_2_0", ToolboxItemFilterType.Prevent));
			}
			
			//set filters fom supported runtimes
			if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_1_1) {
				node.ItemFilters.Add (new ToolboxItemFilterAttribute ("ClrVersion.Net_1_1", ToolboxItemFilterType.Require));
			} else if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_2_0) {
				node.ItemFilters.Add (new ToolboxItemFilterAttribute ("ClrVersion.Net_2_0", ToolboxItemFilterType.Require));
			}
			
			return node;
		}
        public override ItemToolboxNode GetNode(Type t, ToolboxItemAttribute tba,
                                                string attributeCategory, string fullPath, ClrVersion referencedRuntime)
        {
            if (referencedRuntime != ClrVersion.Net_1_1 &&
                referencedRuntime != ClrVersion.Net_2_0)
            {
                return(null);
            }

            bool reflectedRuntime1;

            if (typeof(System.Web.UI.Control).IsAssignableFrom(t))
            {
                reflectedRuntime1 = false;
            }
            else if (CanRuntime1 && SWUControl1.IsAssignableFrom(t))
            {
                reflectedRuntime1 = true;
            }
            else
            {
                return(null);
            }

            Type toolboxItemType = (tba.ToolboxItemType == null) ? typeof(ToolboxItem) : tba.ToolboxItemType;

            //FIXME: fix WebControlToolboxItem so that this isn't necessary
            //right now it's totally broken in mono
            if (typeof(System.Web.UI.Design.WebControlToolboxItem).IsAssignableFrom(toolboxItemType))
            {
                toolboxItemType = typeof(ToolboxItem);
            }

            //Create the ToolboxItem. The ToolboxItemToolboxNode will destroy it, but need to
            //be able to extract data from it first.
            ToolboxItem         item = (ToolboxItem)Activator.CreateInstance(toolboxItemType, new object[] { t });
            WebFormsToolboxNode node = new WebFormsToolboxNode(item);

            //get the default markup for the tag
            string webText = reflectedRuntime1? GetWebText1(t) : GetWebText(t);

            if (!string.IsNullOrEmpty(webText))
            {
                node.Text = webText;
            }

            if (!string.IsNullOrEmpty(attributeCategory))
            {
                node.Category = attributeCategory;
            }
            else if (reflectedRuntime1)
            {
                node.Category = GuessCategory1(t);
            }
            else
            {
                node.Category = GuessCategory(t);
            }

            if (!string.IsNullOrEmpty(fullPath))
            {
                node.Type.AssemblyLocation = fullPath;
            }

            //prevent system.web 1.1 from being shown for 2.0 runtime
            if (CanRuntime1 && webAssem1.FullName == t.Assembly.FullName)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_2_0", ToolboxItemFilterType.Prevent));
            }

            //set filters fom supported runtimes
            if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_1_1)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_1_1", ToolboxItemFilterType.Require));
            }
            else if (referencedRuntime == MonoDevelop.Core.ClrVersion.Net_2_0)
            {
                node.ItemFilters.Add(new ToolboxItemFilterAttribute("ClrVersion.Net_2_0", ToolboxItemFilterType.Require));
            }

            return(node);
        }
예제 #3
0
        public override bool Equals(object obj)
        {
            WebFormsToolboxNode other = obj as WebFormsToolboxNode;

            return((other != null) && (this.text != other.text) && base.Equals(other));
        }