예제 #1
0
        void DocumentOutlineSelectionChanged(MonoDevelop.Xml.StateEngine.XNode selNode)
        {
            if (selNode == null)
            {
                return;                 // not what we are looking for
            }
            XElement el = selNode as XElement;

            if (el == null)
            {
                return;                 // not a XML tag node
            }
            bool   isRunAtServer = false;
            string id            = string.Empty;

            //XName runatName = new XName ("runat");
            //XName idName = new XName ("id");

            foreach (XAttribute attr in el.Attributes)
            {
                if (XDocumentHelper.IsXNameEqualCI(attr.Name, "runat"))
                {
                    if (attr.Value == "server")
                    {
                        isRunAtServer = true;
                    }
                    else
                    {
                        break;
                    }
                }
                else if (XDocumentHelper.IsXNameEqualCI(attr.Name, "id"))
                {
                    id = attr.Value;
                }
            }

            if (isRunAtServer && (id != string.Empty) && (host != null))
            {
                // TODO: Add a unique field to editable nodes. the id of the node is not guaranteed to be the component's Site.Name
                IComponent selected = host.DesignerHost.GetComponent(id);

                if (selected != null)
                {
                    //var properties = TypeDescriptor.GetProperties (selected) as PropertyDescriptorCollection;

                    var selServ = host.Services.GetService(typeof(ISelectionService)) as ISelectionService;
                    selServ.SetSelectedComponents(new IComponent[] { selected });
                }
            }
        }
예제 #2
0
 public override void AddChildNode(XNode newChild)
 {
     Debug.Assert(!IsClosed, "Cannot add children to a closed node.");
     base.AddChildNode(newChild);
 }