public void Reset() { memberList.Clear(); if (!(tag is IBlockNode)) { return; } var blockNode = (tag as IBlockNode); foreach (D_Parser.Dom.INode nd in blockNode.Children) { if ((nd is IBlockNode) || (nd is DEnumValue)) { memberList.Add(nd); } } memberList.Sort((x, y) => String.Compare(x.Name + DParameterDataProvider.GetNodeParamString(x), y.Name + DParameterDataProvider.GetNodeParamString(y), StringComparison.OrdinalIgnoreCase)); }
private void UpdatePath(object sender, Mono.TextEditor.DocumentLocationEventArgs e) { var SyntaxTree = Document.GetDAst(); if (SyntaxTree == null) { return; } // Resolve the hovered piece of code var loc = new CodeLocation(Document.Editor.Caret.Location.Column, Document.Editor.Caret.Location.Line); var currentblock = DResolver.SearchBlockAt(SyntaxTree, loc); //could be an enum value, which is not IBlockNode if (currentblock is DEnum) { foreach (INode nd in (currentblock as DEnum).Children) { if ((nd is DEnumValue) && ((nd.Location <= loc) && (nd.EndLocation >= loc))) { currentblock = nd as IBlockNode; break; } } } List <PathEntry> result = new List <PathEntry>(); INode node = currentblock; PathEntry entry; while ((node != null) && ((node is IBlockNode) || (node is DEnumValue))) { var icon = DIcons.GetNodeIcon(node as DNode); entry = new PathEntry(icon.IsNull?null: ImageService.GetIcon(icon.Name, IconSize.Menu), node.Name + DParameterDataProvider.GetNodeParamString(node)); entry.Position = EntryPosition.Left; entry.Tag = node; //do not include the module in the path bar if ((node.Parent != null) && !((node is DNode) && (node as DNode).IsAnonymous)) { result.Insert(0, entry); } node = node.Parent; } if (!((currentblock is DMethod) || (currentblock is DEnumValue))) { PathEntry noSelection = new PathEntry(GettextCatalog.GetString("No Selection")) { Tag = new NoSelectionCustomNode(currentblock) }; result.Add(noSelection); } entry = GetRegionEntry(Document.GetDDocument(), Document.Editor.Caret.Location); if (entry != null) { result.Add(entry); } var prev = CurrentPath; CurrentPath = result.ToArray(); OnPathChanged(new DocumentPathChangedEventArgs(prev)); }
public string GetMarkup(int n) { return(memberList[n].Name + DParameterDataProvider.GetNodeParamString(memberList[n])); }