Beispiel #1
0
 public static method_info edit_element(method_info nm, node_info ninf, NodeGenerator.NodeGenerator _ng)
 {
     method_editor me = new method_editor(nm, ninf, _ng);
     if (me.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(me.nm.method_text))
         snm = me.nm;
     else snm = null;
     return snm;
 }
Beispiel #2
0
        public method_editor(method_info nm, node_info ninf, NodeGenerator.NodeGenerator ng)
		{
			InitializeComponent();
            if (nm != null)
                this.nm = nm;
            else this.nm = new method_info();

            this.ninf=ninf;
			this.ng=ng;

			set_element();
		}
Beispiel #3
0
 public void add_method(method_info nfi)
 {
     _methods.Add(nfi);
 }
Beispiel #4
0
        private void AddAllForList_Click(object sender, EventArgs e)
        {
            if (subnodes.Items.Count == 0)
                return;
            var ListItemType = subnodes.Items[0].ToString();
            var ListName = "";
            var NodeType = node_name.Text;
            if (ListItemType.ToLower().StartsWith("list"))
            {
                var i1 = ListItemType.IndexOf("<");
                var i2 = ListItemType.IndexOf(">");
                ListName = ListItemType.Substring(i2 + 2);
                ListItemType = ListItemType.Substring(i1 + 1, i2 - i1 - 1);
            }
            else return;
//            nm.method_header = "void Add(SourceContext sc)";
            string templateListConstructor = "{0}({1} _{1}, SourceContext sc)\r\n{{\r\n    Add(_{1},sc);\r\n}}";
            string templateListAddNoSC = "{0} Add({1} _{1})\r\n{{\r\n    {2}.Add(_{1});\r\n    return this;\r\n}}";
            string templateListAdd = "{0} Add({1} _{1}, SourceContext sc)\r\n{{\r\n    {2}.Add(_{1});\r\n    source_context = sc;\r\n    return this;\r\n}}";
            method_info nm = new method_info();
            nm.method_text = string.Format(templateListConstructor, NodeType, ListItemType);
            methods.Items.Add(nm);
            nm = new method_info();
            nm.method_text = string.Format(templateListAddNoSC, NodeType, ListItemType, ListName);
            methods.Items.Add(nm);
            nm = new method_info();
            nm.method_text = string.Format(templateListAdd, NodeType, ListItemType, ListName);
            methods.Items.Add(nm);
        }