Exemple #1
0
        /// <summary>
        /// Edit node value
        /// </summary>
        private void ACTION_EditNode()
        {
            string v = "";

            if (CONTEXT_LIST_VIEW_ITEM != null)
            {
                v = CONTEXT_LIST_VIEW_ITEM.SubItems[2].Text;
            }
            else
            {
                v = CONTEXT_XML_NODE.Value;
            }

            string res = VSUILib.VSUICommonFunctions.InputBox("Edit node value", "Value", value: v, numeric: false);

            if (res == VSUILib.VSUICommonFunctions.CANCELLED)
            {
                return;
            }

            cont.Begin();

            if (CONTEXT_LIST_VIEW_ITEM == null)
            {
                CONTEXT_XML_NODE.Value = res;
                ACTION_SetTreeNodeName(CONTEXT_TREE_NODE, CONTEXT_XML_NODE);
            }
            else
            {
                if (MENU_NODE_SELECTED_TYPE == DEFX.GET_NODETYPE(DEFX.NODE_TYPE_ATTRIBUTE))
                {
                    CONTEXT_XML_NODE.SetAttribute(MENU_NODE_SELECTED_NAME, res);
                }
                else if (MENU_NODE_SELECTED_TYPE == DEFX.GET_NODETYPE(DEFX.NODE_TYPE_COMMENT))
                {
                    VXmlComment cnode = CONTEXT_XML_NODE.GetCommentNode(MENU_NODE_SELECTED_NAME);
                    cnode.Value = res;
                }
                else if (MENU_NODE_SELECTED_TYPE == DEFX.GET_NODETYPE(DEFX.NODE_TYPE_TEXT))
                {
                    VXmlText t = CONTEXT_XML_NODE.GetTextNode(MENU_NODE_SELECTED_NAME);
                    t.Value = res;
                }
                else if (MENU_NODE_SELECTED_TYPE == DEFX.GET_NODETYPE(DEFX.NODE_TYPE_TAG))
                {
                    VXmlTag t  = CONTEXT_XML_NODE.GetTagNode(MENU_NODE_SELECTED_NAME);
                    string  tv = t.Value;
                    if (tv != res)
                    {
                        CONTEXT_XML_NODE.RemoveTag(tv);
                        CONTEXT_XML_NODE.SetTag(res);
                    }
                }
                SELECT_Node(true, CONTEXT_TREE_NODE);
            }
            cont.Commit();
        }
Exemple #2
0
        /// <summary>
        /// Show child nodes in the list view
        /// </summary>
        private void SHOW_NodeList()
        {
            CONTEXT_LIST_VIEW_ITEM = null;
            tsNode.Text            = build_path(); // CONTEXT_XML_NODE.Name;

            lvDetails.Clear();
            lvDetails.Columns.Clear();
            lvDetails.Columns.Add("Type", 100);
            lvDetails.Columns.Add("Name", 200);
            lvDetails.Columns.Add("Value", 400);

            // Attributes
            VXmlAttributeCollection an = CONTEXT_XML_NODE.Attributes;

            for (int i = 0; i < an.Count; i++)
            {
                VXmlAttribute a = an[i];
                ListViewItem  l = new ListViewItem(a.NodeType);

                l.ImageKey = a.NodeType;
                l.SubItems.Add(a.Name);
                l.SubItems.Add(a.Value);
                l.Tag = a.Name;

                lvDetails.Items.Add(l);
            }

            // Comments
            VXmlCommentCollection cnodes = CONTEXT_XML_NODE.CommentNodes;

            for (int i = 0; i < cnodes.Count; i++)
            {
                VXmlComment  c = cnodes[i];
                ListViewItem l = new ListViewItem(c.NodeType);

                l.ImageKey = c.NodeType;
                l.SubItems.Add(c.NodeType);
                l.SubItems.Add(c.Value);

                l.Tag = c.Name;
                lvDetails.Items.Add(l);
            }

            // Text nodes
            VXmlTextCollection tx = CONTEXT_XML_NODE.TextNodes;

            for (int i = 0; i < tx.Count; i++)
            {
                VXmlText     t = tx[i];
                ListViewItem l = new ListViewItem(t.NodeType);

                l.ImageKey = t.NodeType;
                l.SubItems.Add(t.NodeType);
                l.SubItems.Add(t.Value);
                l.Tag = t.Name;
                lvDetails.Items.Add(l);
            }

            // Tag nodes
            VXmlTagCollection tt = CONTEXT_XML_NODE.TagNodes;

            for (int i = 0; i < tt.Count; i++)
            {
                VXmlTag      t = tt[i];
                ListViewItem l = new ListViewItem(t.NodeType);

                l.ImageKey = t.NodeType;
                l.SubItems.Add(t.NodeType);
                l.SubItems.Add(t.Value);
                l.Tag = t.Name;
                lvDetails.Items.Add(l);
            }
        }