Exemplo n.º 1
0
        void FillBreadcrumb()
        {
            Block         block   = CodeUnit.ActiveBlock;
            List <string> classes = new List <string>();

            foreach (ClassOrStructBlock c in ClassNavigator.FindContainingClassOrStructs(block))
            {
                classes.Insert(0, c.Name);
            }
            string[] classesArray  = classes.ToArray();
            string   classesString = "";

            if (classesArray.Length > 0)
            {
                classesString = string.Join(".", classesArray);
            }
            MethodBlock method       = ClassNavigator.FindContainingMethod(block);
            string      methodString = "";

            if (method != null)
            {
                methodString = method.Name;
            }

            Breadcrumb.Text = classesString + "." + methodString;
        }
Exemplo n.º 2
0
 public override void Visit(MethodBlock block)
 {
     WriteIndent();
     Write(block.Modifiers);
     Write(block.Name);
     Visit(block.Parameters);
     NewLine();
     StartBlock();
     VisitContainer(block.VMembers);
     EndBlock();
 }
Exemplo n.º 3
0
        public void ReplaceWithMethod()
        {
            TrimName();
            MethodBlock newMethod =
                MethodBlock.Create(
                    Modifiers.GetModifierString(),
                    this.TypeBlock.Text,
                    this.NameBlock.Text);

            this.Replace(newMethod);
        }
Exemplo n.º 4
0
        public MethodBlock AddMethod(
            string methodName,
            string modifiers,
            string returnType)
        {
            MethodBlock newMethod = new MethodBlock();

            newMethod.Name = methodName;
            newMethod.Modifiers.SetMany(modifiers);
            newMethod.TypeBlock.Text = returnType;
            AddMethod(newMethod);
            return(newMethod);
        }
Exemplo n.º 5
0
        public static ParameterList FindParameters(Block point)
        {
            MethodBlock method = FindContainingMethod(point);

            if (method != null)
            {
                return(method.Parameters.Parameters);
            }

            PropertySetBlock propAccessor = FindContainingPropertyAccessor(point) as PropertySetBlock;

            if (propAccessor != null)
            {
                return(propAccessor.Parameters);
            }

            return(null);
        }
Exemplo n.º 6
0
        public static MethodBlock Create(
            string methodModifiers,
            string returnType,
            string methodName)
        {
            MethodBlock newMethod = new MethodBlock();

            if (!string.IsNullOrEmpty(methodName))
            {
                newMethod.Name = methodName;
            }
            if (!string.IsNullOrEmpty(methodModifiers))
            {
                newMethod.Modifiers.SetMany(methodModifiers);
            }
            if (!string.IsNullOrEmpty(returnType))
            {
                newMethod.Modifiers.Set(returnType);
            }
            return(newMethod);
        }
Exemplo n.º 7
0
        private void HelloWorld()
        {
            using (new Redrawer(CodeUnit))
                using (Transaction.Create(CodeUnit.ActionManager))
                {
                    CodeUnit.AddUsings(
                        "System",
                        "System.Collections.Generic",
                        "System.Text"
                        );

                    NamespaceBlock n = CodeUnit.AddNamespace("GuiLabs.Editor.Test");
                    ClassBlock     c = n.AddClass("Program", "public static");
                    MethodBlock    m = c.AddMethod("Main", "public static", "void");
                    m.VMembers.Add(new ForeachBlock());
                    //BlockStatementBlock b = new BlockStatementBlock();
                    //b.Add(new ForeachBlock());
                    //m.VMembers = b;

                    // AddEnum(n);
                    // AddInterface(n);
                }
            DisplayContextHelp();
        }
Exemplo n.º 8
0
 public virtual void Visit(MethodBlock block)
 {
 }
Exemplo n.º 9
0
 public override void Visit(MethodBlock block)
 {
 }
Exemplo n.º 10
0
 public void AddMethod(MethodBlock method)
 {
     this.VMembers.Add(method, new EmptyClassMember());
 }
Exemplo n.º 11
0
        public MethodBlock AddMethod(
			string methodName,
			string modifiers,
			string returnType)
        {
            MethodBlock newMethod = new MethodBlock();
            newMethod.Name = methodName;
            newMethod.Modifiers.SetMany(modifiers);
            newMethod.TypeBlock.Text = returnType;
            AddMethod(newMethod);
            return newMethod;
        }
Exemplo n.º 12
0
        public static MethodBlock Create(
			string methodModifiers,
			string returnType,
			string methodName)
        {
            MethodBlock newMethod = new MethodBlock();
            if (!string.IsNullOrEmpty(methodName))
            {
                newMethod.Name = methodName;
            }
            if (!string.IsNullOrEmpty(methodModifiers))
            {
                newMethod.Modifiers.SetMany(methodModifiers);
            }
            if (!string.IsNullOrEmpty(returnType))
            {
                newMethod.Modifiers.Set(returnType);
            }
            return newMethod;
        }
Exemplo n.º 13
0
 public override void Visit(MethodBlock block)
 {
 }
Exemplo n.º 14
0
 public override void Visit(MethodBlock block)
 {
     WriteIndent();
     Write(block.Modifiers);
     Write(block.Name);
     Visit(block.Parameters);
     NewLine();
     StartBlock();
     VisitContainer(block.VMembers);
     EndBlock();
 }
Exemplo n.º 15
0
		public virtual void Visit(MethodBlock block)
		{

		}
Exemplo n.º 16
0
 public void AddMethod(MethodBlock method)
 {
     this.VMembers.Add(method, new EmptyClassMember());
 }