DefaultClass AddClass(NavigateToItem item, IDocument document) { var defaultClass = new DefaultClass(this, item.GetFullName()); defaultClass.BodyRegion = item.ToRegion(document); defaultClass.Region = defaultClass.BodyRegion; if (item.HasContainer()) { IClass parentClass = FindParentClass(item); parentClass.InnerClasses.Add(defaultClass); } else { Classes.Add(defaultClass); } return defaultClass; }
void AddInterface(NavigateToItem item, IDocument document) { DefaultClass c = AddClass(item, document); c.ClassType = ClassType.Interface; }
void UpdateMethodRegions(DefaultMethod method, NavigateToItem item, IDocument document) { DomRegion region = item.ToRegion(document); method.Region = new DomRegion( region.BeginLine, region.BeginColumn, region.BeginLine, region.BeginColumn); method.BodyRegion = region; }
IClass FindParentClass(NavigateToItem item) { string containerParentName = item.GetContainerParentName(); if (containerParentName != null) { IClass parentClass = FindClass(containerParentName); return FindClass(parentClass.InnerClasses, item.containerName); } else { return FindClass(item.containerName); } }
void AddModule(NavigateToItem item, IDocument document) { DefaultClass c = AddClass(item, document); c.ClassType = ClassType.Module; }
void AddMethod(NavigateToItem item, IDocument document) { IClass c = FindParentClass(item); var method = new DefaultMethod(c, item.name); UpdateMethodRegions(method, item, document); c.Methods.Add(method); }