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; }
public override void Visit(MethodBlock block) { WriteIndent(); Write(block.Modifiers); Write(block.Name); Visit(block.Parameters); NewLine(); StartBlock(); VisitContainer(block.VMembers); EndBlock(); }
public void ReplaceWithMethod() { TrimName(); MethodBlock newMethod = MethodBlock.Create( Modifiers.GetModifierString(), this.TypeBlock.Text, this.NameBlock.Text); this.Replace(newMethod); }
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); }
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); }
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); }
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(); }
public virtual void Visit(MethodBlock block) { }
public override void Visit(MethodBlock block) { }
public void AddMethod(MethodBlock method) { this.VMembers.Add(method, new EmptyClassMember()); }
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; }
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; }
public override void Visit(MethodBlock block) { }
public override void Visit(MethodBlock block) { WriteIndent(); Write(block.Modifiers); Write(block.Name); Visit(block.Parameters); NewLine(); StartBlock(); VisitContainer(block.VMembers); EndBlock(); }
public virtual void Visit(MethodBlock block) { }
public void AddMethod(MethodBlock method) { this.VMembers.Add(method, new EmptyClassMember()); }